用 react 来写 scriptable 脚本的插件。
npm install scriptable-transform用 react 来写 scriptable 脚本的插件。
> 本项目和原项目在思路上有点不同,所以如果提 PR 的话改动太大,所以干脆就直接重写了。
``bash`
npm install -D scriptable-transform
`.babelrc
// .babelrc
{
...
"plugins": [
...
[
"@babel/plugin-transform-react-jsx",
{
"throwIfNamespace": false,
"runtime": "automatic",
"importSource": "scriptable-transform"
}
]
]
}
`
`tsx
import { render } from 'scriptable-transform';
const root = new ListWidget();
function App() {
return (
<>
>
);
}
render(
root.presentMedium().then();
``