@share-crm/sharedev-cli 0.0.4 → 0.0.5-rc.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@share-crm/sharedev-cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.5-rc.1",
4
4
  "private": false,
5
5
  "description": "sharedev command line tool",
6
6
  "type": "module",
@@ -18,29 +18,45 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "build": "tsc --noEmit && webpack --config build/webpack/webpack.prod.cjs",
21
+ "build:debug": "tsc --noEmit && webpack --config build/webpack/webpack.debug.cjs",
22
+ "build:bin": "bun build --compile --target=bun-darwin-x64 src/cli.ts --outfile scripts/sharedev-darwin-x64 && bun build --compile --target=bun-darwin-arm64 src/cli.ts --outfile scripts/sharedev-darwin-arm64 && bun build --compile --target=bun-windows-x64 src/cli.ts --outfile scripts/sharedev-windows-x64.exe",
23
+ "build:all": "npm run build && npm run build:bin",
21
24
  "dev": "tsc --noEmit --watch & webpack --config build/webpack/webpack.dev.cjs --watch",
22
25
  "dev2": "node src/cli.ts",
23
26
  "typecheck": "tsc --noEmit",
24
27
  "prettier": "prettier --write ./src/**/*.ts",
25
- "publish": "npm publish --registry=http://registry-npm.firstshare.cn/"
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "test:coverage": "vitest run --coverage"
26
31
  },
27
32
  "dependencies": {
28
33
  "@clack/prompts": "^1.1.0",
29
34
  "@mariozechner/pi-coding-agent": "^0.62.0",
30
- "axios": "^1.11.0",
35
+ "@share-crm/sharecrm-cli": "^1.1.17",
36
+ "adm-zip": "^0.6.1",
37
+ "axios": "~1.13.0",
31
38
  "chalk": "^5.6.2",
32
39
  "commander": "^14.0.1",
33
- "fast-xml-parser": "^5.2.5",
34
40
  "extract-zip": "^2.0.1",
41
+ "fast-xml-parser": "^5.2.5",
35
42
  "fs-extra": "^11.3.2",
36
- "ora": "^9.3.0"
43
+ "lodash-es": "^4.18.1",
44
+ "ora": "^9.3.0",
45
+ "terser-webpack-plugin": "^5.6.1"
46
+ },
47
+ "optionalDependencies": {
48
+ "@share-crm/beefly": "^1.0.10"
37
49
  },
38
50
  "devDependencies": {
51
+ "@types/adm-zip": "^0.6.0",
39
52
  "@types/extract-zip": "^2.0.3",
40
53
  "@types/fs-extra": "^11.0.4",
54
+ "@types/lodash-es": "^4.17.12",
41
55
  "@types/node": "^24.3.0",
56
+ "@vitest/coverage-v8": "^4.1.8",
42
57
  "ts-loader": "^9.5.4",
43
58
  "typescript": "^5.9.2",
59
+ "vitest": "^3.2.6",
44
60
  "webpack": "^5.101.3",
45
61
  "webpack-cli": "^6.0.1",
46
62
  "webpack-merge": "^6.0.1"
package/readme.md CHANGED
@@ -290,6 +290,52 @@ sharedev
290
290
 
291
291
  ---
292
292
 
293
+ ## 本地调试方式
294
+
295
+ ### 步骤一:安装依赖并构建
296
+
297
+ ```bash
298
+ cd packages/share-dev-cli
299
+ npm install
300
+ npm run build
301
+ ```
302
+
303
+ ### 步骤二:全局链接
304
+
305
+ ```bash
306
+ # 在 packages/share-dev-cli 目录下执行
307
+ npm link
308
+ ```
309
+
310
+ 执行后,`sharedev` 命令会被注册为全局可执行命令,指向当前构建产物 `dist/sharedev.js`。
311
+
312
+ > **注意**:如果 `npm link` 报 `ENOTEMPTY` 错误,说明全局 node_modules 中已存在该包的旧目录,npm 无法原子替换。手动删除后重试即可:
313
+ >
314
+ > ```bash
315
+ > rm -rf /Users/wujing/.nvm/versions/node/v23.6.0/lib/node_modules/@share-crm/sharedev-cli
316
+ > npm link
317
+ > ```
318
+ >
319
+ > 若使用其他 Node 版本,将路径中的 `v23.6.0` 替换为实际版本号(可通过 `node -v` 查看)。
320
+
321
+ > 调试结束后可执行 `npm unlink -g sharedev` 解除链接。
322
+
323
+ ### 步骤三:在测试目录中执行命令
324
+
325
+ 进入任意含有 `.sharedev/settings.json` 的测试目录,运行命令:
326
+
327
+ ```bash
328
+ sharedev --help
329
+ sharedev apl list
330
+ sharedev apl pull <apiName>
331
+ sharedev pwc pull <apiName> --type component
332
+ sharedev pwc dev <filePath>
333
+ ```
334
+
335
+ 每次修改源码后,重新执行 `npm run build`(或保持 `npm run dev` 在后台运行),无需重复 `npm link`。
336
+
337
+ ---
338
+
293
339
  ## 实施计划
294
340
 
295
341
  ### 第一期(最小可用)
@@ -321,4 +367,4 @@ sharedev
321
367
  1. **VS Code 扩展能力不可直接迁移**:CLI 中用 Node 文件系统 API、终端交互、本地快照替代 VS Code API
322
368
  2. **配置是前置条件**:`.sharedev/settings.json` 缺失时不能继续执行,不能带空配置发请求
323
369
  3. **不要暴露 certificate**:`certificate` 字段不能明文打印到日志
324
- 4. **APL 和 PWC 抽象层次不同**:APL 是单文件函数,PWC 是多目录组件,工作区模型不共用
370
+ 4. **APL 和 PWC 抽象层次不同**:APL 是单文件函数,PWC 是多目录组件,工作区模型不共用
@@ -1,15 +0,0 @@
1
- /*!
2
- * mime-db
3
- * Copyright(c) 2014 Jonathan Ong
4
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
5
- * MIT Licensed
6
- */
7
-
8
- /*!
9
- * mime-types
10
- * Copyright(c) 2014 Jonathan Ong
11
- * Copyright(c) 2015 Douglas Christopher Wilson
12
- * MIT Licensed
13
- */
14
-
15
- /*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors */