test-clis-devs 1.0.0

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/LICENSE.md ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # newCli
2
+ 安装lerna
3
+ cnpm i -D lerna
4
+
5
+ 全局安装
6
+ cnpm i -g lerna
7
+
8
+ 初始化
9
+ 要先在package.json添加
10
+ "workspaces": [
11
+ "packages/*"
12
+ ]
13
+ lerna init
14
+
15
+ 强力清除
16
+ npm cache clean --force
17
+ rm -rf node_modules package-lock.json
18
+
19
+ 创建子包
20
+ cnpm init -w ./packages/包名
21
+
22
+ 安装特定依赖(相当于lerna旧版本的lerna add)
23
+ cnpm install 依赖包名 依赖包名(若是本地 packages/依赖包名/) (安装多个) 全局安装
24
+ cnpm install 依赖包名 -w packages/包名/
25
+
26
+ 卸载依赖(相当于lerna就版本的lerna bootstrap)
27
+ cnpm uninstall 依赖包名 依赖包名(若是本地 packages/依赖包名/) (卸载多个) 全局卸载
28
+ tips:本地依赖包卸载后需要手动去package.json和package-lock.json中删除依赖
29
+
30
+ 帮助
31
+ lerna -h
32
+
33
+ 开发和测试----------------------------------------------------------------
34
+
35
+ 在每个包下同时执行,但是不包括主包
36
+ lerna exec -- 执行命令
37
+
38
+ 在某个包执行命令
39
+ lerna exec --scope 包名(package.json中) -- 执行命令
40
+
41
+ 在每个包下执行script命令
42
+ lerna run 执行脚本名称
43
+
44
+ 某个包下执行命令
45
+ lerna run --scope 包名(package.json中) 执行命令
46
+
47
+ exec和run区别
48
+ 执行方式:exec是直接执行命令,run是执行package.json中的script
49
+ 灵活性:exec适合临时或通用操作,run更适合标准化流程
50
+ 依赖管理:run依赖脚本,exec无需预定义,但需要手动处理路径和参数
51
+ 使用场景:run适合标准化的构建、测试、部署等流程,exec用于底层操作,如清理,调试,run用于高层任务,如构建/测试
52
+
53
+ 发布上线----------------------------------------------------------------
54
+ 查看当前已上线的版本号
55
+ lerna version
56
+
57
+ 查看有哪些变更,以及哪些package将会被发布
58
+ lerna changed
59
+
60
+ 查看提交后的变更
61
+ lerna diff
62
+
63
+ 发布
64
+ lerna publish(全部提交完毕后执行)
65
+ 发布前需要在每个子包的packag.json中添加"publishConfig": {
66
+ "access": "public"
67
+ }
68
+ npm cache clean --force
69
+
70
+ tips:发布是Lerna 中用于将 Monorepo 中的包发布到 NPM registry 的核心命令,它自动化处理版本检测、Git 标签创建和包发布等流程。‌
71
+
72
+ git相关
73
+ git add . 提交所有变更
74
+ git commit -m '提交信息'
75
+
76
+ 关联远程仓库
77
+ git remote -v 查看远程仓库
78
+
79
+ git remote add origin git@github.com:xxx/xxx.git 关联远程仓库
80
+
81
+ git pull origin main 拉取远程仓库
82
+
83
+ git push -u origin main 第一次推送到远程库
84
+
85
+ git push origin main 推送main分支
86
+
87
+ git push origin maingit push origin master --tags 推送tag
88
+
89
+
90
+ 就差上传到github和发布
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ function add(){
2
+ return 2 + 2;
3
+ }
4
+
5
+ module.exports = {
6
+ add
7
+ };
@@ -0,0 +1,103 @@
1
+ 0 silly argv {
2
+ 0 silly argv _: [ 'publish' ],
3
+ 0 silly argv private: false,
4
+ 0 silly argv composed: 'publish',
5
+ 0 silly argv lernaVersion: '9.0.3',
6
+ 0 silly argv '$0': '/opt/homebrew/lib/node_modules/lerna/dist/cli.js'
7
+ 0 silly argv }
8
+ 1 notice cli v9.0.3
9
+ 2 verbose packageConfigs Explicit "packages" configuration found in lerna.json. Resolving packages using the configured glob(s): ["packages/*"]
10
+ 3 verbose rootPath /Users/joker/code/test-clis-devs
11
+ 4 verbose session d19e9de7f640e34a
12
+ 5 verbose user-agent lerna/9.0.3/node@v25.2.1+arm64 (darwin)
13
+ 6 silly argv {
14
+ 6 silly argv _: [ 'publish' ],
15
+ 6 silly argv private: false,
16
+ 6 silly argv composed: 'publish',
17
+ 6 silly argv lernaVersion: '9.0.3'
18
+ 6 silly argv }
19
+ 7 verbose packageConfigs Explicit "packages" configuration found in lerna.json. Resolving packages using the configured glob(s): ["packages/*"]
20
+ 8 verbose rootPath /Users/joker/code/test-clis-devs
21
+ 9 info current version 0.0.9
22
+ 10 silly isAnythingCommitted
23
+ 11 verbose isAnythingCommitted 1
24
+ 12 silly getCurrentBranch
25
+ 13 verbose currentBranch main
26
+ 14 silly remoteBranchExists
27
+ 15 silly isBehindUpstream
28
+ 16 silly isBehindUpstream main is behind origin/main by 0 commit(s) and ahead by 0
29
+ 17 silly hasTags
30
+ 18 verbose hasTags true
31
+ 19 silly git-describe.sync "v0.0.9-1-g3b61cd4" => {"lastTagName":"v0.0.9","lastVersion":"v0.0.9","refCount":"1","sha":"3b61cd4","isDirty":false}
32
+ 20 info Looking for changed packages since v0.0.9
33
+ 21 silly checking diff packages/core
34
+ 22 silly found diff in test-clis-devs/packages/core/lib/index.js
35
+ 22 silly found diff in test-clis-devs/packages/core/package.json
36
+ 23 verbose filtered diff [
37
+ 23 verbose filtered diff 'test-clis-devs/packages/core/lib/index.js',
38
+ 23 verbose filtered diff 'test-clis-devs/packages/core/package.json'
39
+ 23 verbose filtered diff ]
40
+ 24 verbose updated @test-clis-devs/core
41
+ 25 verbose git-describe undefined => "v0.0.9-1-g3b61cd4"
42
+ 26 silly git-describe parsed => {"lastTagName":"v0.0.9","lastVersion":"v0.0.9","refCount":"1","sha":"3b61cd4","isDirty":false}
43
+ 27 info execute Skipping releases
44
+ 28 silly lifecycle No script for "preversion" in "test-clis-devs", continuing
45
+ 29 silly lifecycle No script for "preversion" in "@test-clis-devs/core", continuing
46
+ 30 verbose version @test-clis-devs/core has no lockfile. Skipping lockfile update.
47
+ 31 silly lifecycle No script for "version" in "@test-clis-devs/core", continuing
48
+ 32 silly lifecycle No script for "version" in "test-clis-devs", continuing
49
+ 33 silly gitAdd [ 'packages/core/package.json', 'lerna.json' ]
50
+ 34 silly gitCommit v0.0.10
51
+ 35 verbose git [ 'commit', '-m', 'v0.0.10' ]
52
+ 36 silly gitTag v0.0.10 git tag %s -m %s
53
+ 37 verbose git [ 'tag', 'v0.0.10', '-m', 'v0.0.10' ]
54
+ 38 silly lifecycle No script for "postversion" in "@test-clis-devs/core", continuing
55
+ 39 silly lifecycle No script for "postversion" in "test-clis-devs", continuing
56
+ 40 info git Pushing tags...
57
+ 41 silly gitPush origin main
58
+ 42 info publish Publishing packages to npm...
59
+ 43 notice Skipping all user and access validation due to third-party registry
60
+ 44 notice Make sure you're authenticated properly ¯\_(ツ)_/¯
61
+ 45 silly getCurrentSHA
62
+ 46 verbose getCurrentSHA 57984756b119e6c3804c8842d3f3d63ffb6eebc7
63
+ 47 silly lifecycle No script for "prepublish" in "test-clis-devs", continuing
64
+ 48 silly lifecycle No script for "prepare" in "test-clis-devs", continuing
65
+ 49 silly lifecycle No script for "prepublishOnly" in "test-clis-devs", continuing
66
+ 50 silly lifecycle No script for "prepack" in "test-clis-devs", continuing
67
+ 51 verbose pack-directory packages/core
68
+ 52 silly lifecycle No script for "prepublish" in "@test-clis-devs/core", continuing
69
+ 53 silly lifecycle No script for "prepare" in "@test-clis-devs/core", continuing
70
+ 54 silly lifecycle No script for "prepublishOnly" in "@test-clis-devs/core", continuing
71
+ 55 silly lifecycle No script for "prepack" in "@test-clis-devs/core", continuing
72
+ 56 silly lifecycle No script for "postpack" in "@test-clis-devs/core", continuing
73
+ 57 verbose packed packages/core
74
+ 58 silly lifecycle No script for "postpack" in "test-clis-devs", continuing
75
+ 59 verbose publish @test-clis-devs/core
76
+ 60 silly FetchError: request to https://registry.npmjs.org/@test-clis-devs%2fcore failed, reason: read ECONNRESET
77
+ 60 silly at ClientRequest.<anonymous> (/Users/joker/code/test-clis-devs/node_modules/.store/minipass-fetch@5.0.0/node_modules/minipass-fetch/lib/index.js:130:14)
78
+ 60 silly at ClientRequest.emit (node:events:508:28)
79
+ 60 silly at emitErrorEvent (node:_http_client:108:11)
80
+ 60 silly at _destroy (node:_http_client:962:9)
81
+ 60 silly at onSocketNT (node:_http_client:982:5)
82
+ 60 silly at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
83
+ 60 silly FetchError: request to https://registry.npmjs.org/@test-clis-devs%2fcore failed, reason: read ECONNRESET
84
+ 60 silly at ClientRequest.<anonymous> (/Users/joker/code/test-clis-devs/node_modules/.store/minipass-fetch@5.0.0/node_modules/minipass-fetch/lib/index.js:130:14)
85
+ 60 silly at ClientRequest.emit (node:events:508:28)
86
+ 60 silly at emitErrorEvent (node:_http_client:108:11)
87
+ 60 silly at _destroy (node:_http_client:962:9)
88
+ 60 silly at onSocketNT (node:_http_client:982:5)
89
+ 60 silly at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
90
+ 60 silly code: 'ECONNRESET',
91
+ 60 silly errno: 'ECONNRESET',
92
+ 60 silly syscall: 'read',
93
+ 60 silly type: 'system'
94
+ 60 silly }
95
+ 61 warn notice Package failed to publish: @test-clis-devs/core
96
+ 62 error ECONNRESET request to https://registry.npmjs.org/@test-clis-devs%2fcore failed, reason: read ECONNRESET
97
+ 63 error errno "ECONNRESET" is not a valid exit code - exiting with code 1
98
+ 64 error FetchError: request to https://registry.npmjs.org/@test-clis-devs%2fcore failed, reason: read ECONNRESET
99
+ 64 error at ClientRequest.<anonymous> (/Users/joker/code/test-clis-devs/node_modules/.store/minipass-fetch@5.0.0/node_modules/minipass-fetch/lib/index.js:130:14)
100
+ 64 error at ClientRequest.emit (node:events:508:28)
101
+ 64 error at emitErrorEvent (node:_http_client:108:11)
102
+ 64 error at _destroy (node:_http_client:962:9)
103
+ 64 error at onSocketNT (node:_http_client:982:5)
package/lerna.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "node_modules/lerna/schemas/lerna-schema.json",
3
+ "version": "0.0.10",
4
+ "packages": [
5
+ "packages/*"
6
+ ],
7
+ "command": {
8
+ "publish": {
9
+ "access": "public"
10
+ }
11
+ }
12
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "test-clis-devs",
3
+ "version": "1.0.0",
4
+ "description": "test-clis-devs",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": ["core"],
10
+ "author": "wssface",
11
+ "license": "ISC",
12
+ "type": "commonjs",
13
+ "devDependencies": {
14
+ "lerna": "^9.0.3"
15
+ },
16
+ "workspaces": [
17
+ "packages/*",
18
+ "packages/core",
19
+ ".packages/utils"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "registry": "https://registry.npmjs.org/"
24
+ }
25
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ greet: function(name) {
3
+ return `Hello, ${name}!`;
4
+ }
5
+ };
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@test-clis-devs/core",
3
+ "version": "0.0.10",
4
+ "description": "test-clis-devs core",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "gitHead": "57984756b119e6c3804c8842d3f3d63ffb6eebc7"
15
+ }