Skip to content

Commit

Permalink
添加手机安装环境
Browse files Browse the repository at this point in the history
  • Loading branch information
im3x-dev committed Nov 2, 2020
1 parent 3d6dfab commit 09e79d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
2. `npm install` 安装依赖环境
3. `npm start` 在 vscode 中运行服务

## 手机安装
复制 [install-runtime.js](install-runtime.js) 文件内容,手机打开 Scriptable 应用,点击+号新建,长按粘贴,点击运行即可

## 手机连接
分别复制 `「小件件」开发环境.js``「小件件」小组件示例.js` 源码到 `Scriptable` 应用里
我推荐的小组件命名: `「源码」小组件名`,这样当写的插件多了(打包后的和开发中的)就不容易混淆了
Expand Down
8 changes: 8 additions & 0 deletions install-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const FILE_MGR = FileManager[module.filename.includes('Documents/iCloud~') ? 'iCloud' : 'local']();
await Promise.all(['「小件件」开发环境.js', '「源码」小组件示例.js'].map(async js => {
const REQ = new Request(`https://gitee.com/im3x/Scriptables/raw/v2-dev/Scripts/${encodeURIComponent(js)}`);
const RES = await REQ.load();
FILE_MGR.write(FILE_MGR.joinPath(FILE_MGR.documentsDirectory(), js), RES);
}));
FILE_MGR.remove(module.filename);
Safari.open("scriptable:///open?scriptName="+encodeURIComponent('「源码」小组件示例'));

0 comments on commit 09e79d6

Please sign in to comment.