一覧へ戻る
jag-k/rollup-plugin-scriptable(新しいタブで開きます)
主要言語: TypeScript
Create a Scriptable bundle from your project
- star 数
- 1
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2022/08/14
主要言語: TypeScript
Create a Scriptable bundle from your project
Create a Scriptable bundle from your project
npm i -D @jag-k/rollup-plugin-scriptable
// rollup.config.js import scriptableBundle from "@jag-k/rollup-plugin-scriptable"; import * as config from "./config.json"; export default { input: 'src/index.js', output: [ { file: `dist/widget.js`, format: 'es', plugins: [scriptableBundle(config)] } ] };
// config.json { "always_run_in_app": false, "icon": { "color": "blue", "glyph": "users" }, "name": "Widget", "share_sheet_inputs": [] }
After build, you will get 2 files:
dist
├── HASS Persons.js
└── HASS Persons.scriptable
In .js file added banner for Scriptable app.
.scriptable file contains bundle for Scriptable app.
This is config.json file with script key which value is compiled code.
You can use rollup-plugin-copy to copy files to iCloud for easy
development and debugging Scriptable scripts.
// rollup.config.js import { homedir } from 'os'; import scriptableBundle from '@jag-k/rollup-plugin-scriptable'; import copy from 'rollup-plugin-copy'; import * as config from './config.json'; export default { input: 'src/main.js', output: [ { file: `dist/${config.name}.js`, format: 'es', plugins: [scriptableBundle(config)] }, ], plugins: process.env.COPY_TO_ICLOUD === 'true' ? [ copy({ hook: 'writeBundle', targets: [ { src: `dist/*.js`, dest: `${homedir()}/Library/Mobile Documents/iCloud~dk~simonbs~Scriptable/Documents/` }, ] }) ] : [] };