create-ax-trusted-plugin 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,22 +1,27 @@
1
- # @ax-npm/create-trusted-plugin
1
+ # create-ax-trusted-plugin
2
2
 
3
3
  可信(internal)插件**脚手架**:一条命令生成一个基于 `@ax-npm/host-trusted-sdk-v4` 的可信插件骨架
4
4
  (Module Federation remote + 共享 Vue + `activate(ctx)` + 自定义元素面板 + 调 `map.flyTo` + 遥测订阅)。
5
5
 
6
+ > 脚手架本身已发**公网 npm**,生成这步**零配置**;生成出的工程才走私有源(`192.168.1.209` GitLab)拉
7
+ > `@ax-npm/*` 依赖,届时只需一个 `GITLAB_TOKEN`(无需手建任何 `.npmrc`,工程自带)。
8
+
6
9
  ## 用法
7
10
  ```bash
8
11
  # 交互式(缺参数会提示输入 id/标题/锚点)
9
- npm create @ax-npm/trusted-plugin@latest my-panel
12
+ npm create ax-trusted-plugin@latest my-panel
10
13
 
11
14
  # 非交互(传参)
12
- npm create @ax-npm/trusted-plugin@latest my-panel -- --title "我的面板" --anchor top-right
15
+ npm create ax-trusted-plugin@latest my-panel -- --title "我的面板" --anchor top-right
13
16
  ```
14
17
  等价于直接跑 bin:`node bin/index.mjs my-panel --title "我的面板" --anchor top-right`。
15
18
 
16
- 生成 `my-panel/` 后:
19
+ 生成 `my-panel/` 后(把 `GITLAB_TOKEN` 换成你的只读 PAT,按所用 shell 选一行):
17
20
  ```bash
18
21
  cd my-panel
19
- export GITLAB_TOKEN=<读权限 PAT>
22
+ export GITLAB_TOKEN=<读权限 PAT> # bash / git-bash
23
+ # $env:GITLAB_TOKEN="<读权限 PAT>" # PowerShell
24
+ # set GITLAB_TOKEN=<读权限 PAT> # cmd
20
25
  npm install
21
26
  npm run dev
22
27
  ```
@@ -36,8 +41,15 @@ npm run dev
36
41
  `tsconfig.json`、`.npmrc`、`.gitignore`、`README.md`。
37
42
 
38
43
  ## 发布(维护者)
44
+ 脚手架包发**公网 npm**(`publishConfig` 已指向 `registry.npmjs.org`、`access: public`):
39
45
  ```bash
40
- export GITLAB_TOKEN=<写权限 PAT>
41
- npm publish # publishConfig GitLab 项目 1243
46
+ npm login --registry https://registry.npmjs.org/ # 首次
47
+ npm publish --otp=<6位验证码> # npm 强制 2FA,验证码来自验证器 App
42
48
  ```
49
+ - 若提示包名被占,改 `package.json` 的 `name`(及随之的 `npm create <name>` 用法)。
50
+ - 自动化/CI 免输码:在 npm 生成「可绕过 2FA 的 Granular Access Token」,
51
+ 以 `//registry.npmjs.org/:_authToken=<token>` 注入后 `npm publish`。
52
+
53
+ > 注意:`template/` 内仍引用私网地址 `192.168.1.209`(RFC1918 不可路由,非机密),发公网后会公开可见。
54
+
43
55
  源码仓:GitLab 项目 1244。
package/bin/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- // @ax-npm/create-trusted-plugin —— 可信(internal)插件脚手架。
2
+ // create-ax-trusted-plugin —— 可信(internal)插件脚手架(发布于公网 npm)。
3
3
  // 用法:
4
- // npm create @ax-npm/trusted-plugin <id> [-- --title "标题" --anchor top-right]
4
+ // npm create ax-trusted-plugin <id> [-- --title "标题" --anchor top-right]
5
5
  // node bin/index.mjs <id> --title "标题" --anchor top-right
6
6
  // 把 template/ 复制到 <id>/,按 id/title/anchor 做占位替换(dotfile 以 _ 前缀存放,生成时改名)。
7
7
  import { readdir, readFile, writeFile, mkdir, stat } from 'node:fs/promises';
@@ -95,7 +95,10 @@ async function main() {
95
95
  console.log(`\n✓ 已生成可信插件:${rel}`);
96
96
  console.log('\n下一步:');
97
97
  console.log(` cd ${rel}`);
98
- console.log(' export GITLAB_TOKEN=<读权限 PAT>');
98
+ console.log(' # 设只读 PAT(按所用 shell 选一行):');
99
+ console.log(' export GITLAB_TOKEN=<读权限 PAT> # bash / git-bash');
100
+ console.log(' $env:GITLAB_TOKEN="<读权限 PAT>" # PowerShell');
101
+ console.log(' set GITLAB_TOKEN=<读权限 PAT> # cmd');
99
102
  console.log(' npm install');
100
103
  console.log(' npm run dev # build:watch + 静态托管 + host-dev,浏览器调试\n');
101
104
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ax-trusted-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "可信(internal)插件脚手架:一条命令生成一个基于 @ax-npm/host-trusted-sdk-v4 的可信插件骨架(Module Federation remote + 共享 Vue + activate(ctx))。用法:npm create ax-trusted-plugin <id>。生成器本身无机密,公网可装;生成出的工程仍走私有源拉 @ax-npm/* 依赖。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,11 +1,13 @@
1
1
  # __ID__
2
2
 
3
3
  可信(internal)插件:经 Module Federation 融入宿主进程、共享宿主 Vue、拿完整 `ctx`。
4
- `@ax-npm/create-trusted-plugin` 脚手架生成。
4
+ `create-ax-trusted-plugin` 脚手架生成。
5
5
 
6
6
  ## 开发
7
7
  ```bash
8
- export GITLAB_TOKEN=<读权限 PAT>
8
+ export GITLAB_TOKEN=<读权限 PAT> # bash / git-bash
9
+ # $env:GITLAB_TOKEN="<读权限 PAT>" # PowerShell(别用 set / %VAR%)
10
+ # set GITLAB_TOKEN=<读权限 PAT> # cmd
9
11
  npm install
10
12
  npm run dev # build:watch + serve(:5174) + host-dev(:5173)
11
13
  ```
@@ -9,17 +9,19 @@
9
9
  "build:watch": "vite build --watch",
10
10
  "serve": "node serve.mjs",
11
11
  "dev": "vite build && concurrently -k -n build,serve,host -c blue,magenta,green \"vite build --watch\" \"node serve.mjs\" \"host-dev --plugin http://localhost:5174\"",
12
+ "dev:electron": "vite build && concurrently -k -n build,serve,host -c blue,magenta,green \"vite build --watch\" \"node serve.mjs\" \"host-dev --electron --plugin http://localhost:5174\"",
12
13
  "typecheck": "vue-tsc --noEmit"
13
14
  },
14
15
  "dependencies": {
15
- "@ax-npm/host-trusted-sdk-v4": "^1.0.0",
16
+ "@ax-npm/host-trusted-sdk-v4": "^1.0.1",
16
17
  "vue": "^3.4.0"
17
18
  },
18
19
  "devDependencies": {
19
- "@ax-npm/host-dev-v4": "^1.0.4",
20
+ "@ax-npm/host-dev-v4": "^1.0.7",
20
21
  "@originjs/vite-plugin-federation": "^1.3.5",
21
22
  "@vitejs/plugin-vue": "^5.0.0",
22
23
  "concurrently": "^9.0.0",
24
+ "electron": "^39.0.0",
23
25
  "pinia": "^2.1.7",
24
26
  "typescript": "^5.4.0",
25
27
  "vite": "^5.2.0",