@sentryos/create-sentryos
v0.1.1
Published
SentryOS CLI scaffold for creating TypeScript plugin and app development environments.
Maintainers
Readme
create-sentryos
開發工具:快速建立 SentryOS TypeScript plugin / app 開發環境,並同時產生型別定義檔案。
直接使用命令建立範本
不用先安裝也能執行:
npx @sentryos/create-sentryos plugin my-plugin
npx @sentryos/create-sentryos app my-app如果已經安裝過套件,可直接使用:
create-sentryos plugin my-plugin
create-sentryos app my-appPlugin 開發範本
建立後會產生以下結構:
package.jsontsconfig.jsonsrc/plugin.tstypes/sentryos-plugin.d.tsREADME.md
此插件範本不會產生 plugin.json,因為該檔案不是必要的。
範本使用 TypeScript,並提供 build 指令產生單一輸出檔案:
npm install
npm run build輸出檔案:
dist/plugin.bundle.js
App 開發範本
建立後會產生以下結構:
package.jsontsconfig.jsonmanifest.jsonsrc/main.tstypes/sentryos-plugin.d.tsREADME.md
App 範本採用 TypeScript,並且入口會直接以整份編譯後的 dist/main.js 執行,無須 export default。
App 必須透過 globalThis 註冊回呼,例如 onFileOpen 或 onWindowEvent,因為系統會直接在執行環境中呼叫這些全域函式。
npm install
npm run build輸出檔案:
dist/main.js
型別定義
插件與 App 範本都會包含 types/sentryos-plugin.d.ts,可直接參考 SentryPlugin / PluginContext 型別。
import type { SentryPlugin } from './types/sentryos-plugin';進階打包
如果你想使用 create-sentryos 的內建打包腳本,請在套件目錄執行:
npm install
npm run bundle-plugin -- src/plugin.ts dist/plugin.bundle.js但通常開發者只要在產生的 plugin 專案中執行 npm run build 即可。
