rigjs 1.0.34 → 2.0.0-alpha.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/bin/rig.js +1 -1
- package/built/index.js +384 -0
- package/demo/.env.oem1 +4 -0
- package/demo/.env.oem2 +4 -0
- package/demo/babel.config.js +5 -0
- package/demo/cicd.rig.json5 +55 -0
- package/demo/jsconfig.json +19 -0
- package/demo/package.json +43 -11
- package/demo/package.rig.json5 +0 -6
- package/demo/public/favicon.ico +0 -0
- package/demo/public/index.html +17 -0
- package/demo/rig_helper.js +7 -7
- package/demo/src/App.vue +28 -0
- package/demo/src/assets/logo.png +0 -0
- package/demo/src/components/HelloWorld.vue +58 -0
- package/demo/src/main.js +8 -0
- package/demo/vue.config.js +8 -0
- package/demo/yarn.lock +6068 -0
- package/lib/build/index.ts +21 -0
- package/lib/check/index.d.ts +6 -0
- package/lib/check/index.js +0 -1
- package/lib/classes/cicd/CICD.ts +112 -0
- package/lib/classes/cicd/CICDCmd.ts +65 -0
- package/lib/classes/cicd/Deploy/AliDeploy.ts +46 -0
- package/lib/classes/cicd/Deploy/CDN.ts +126 -0
- package/lib/classes/cicd/Deploy/HuaweiDeploy.ts +0 -0
- package/lib/classes/cicd/Deploy/index.ts +0 -0
- package/lib/classes/cicd/DirLevel.ts +49 -0
- package/lib/classes/cicd/Endpoint.ts +87 -0
- package/lib/define/index.ts +47 -0
- package/lib/deploy/index.ts +60 -0
- package/lib/deps/index.d.ts +6 -0
- package/lib/env/index.d.ts +4 -0
- package/lib/info/index.d.ts +6 -0
- package/lib/init/cicd.rig.json5 +9 -0
- package/lib/init/index.d.ts +6 -0
- package/lib/init/index.js +49 -34
- package/lib/init/rig_helper.js +14 -0
- package/lib/install/index.d.ts +5 -0
- package/lib/install/index.js +1 -2
- package/lib/postinstall/index.d.ts +6 -0
- package/lib/preinstall/index.d.ts +6 -0
- package/lib/rig/index.ts +49 -0
- package/lib/tag/index.d.ts +6 -0
- package/lib/tag/index.js +0 -3
- package/lib/utils/fsHelper.ts +10 -0
- package/lib/utils/index.js +4 -1
- package/lib/utils/{regex.js → regex.ts} +9 -3
- package/package.json +16 -3
- package/tsconfig.json +50 -0
- package/.github/workflows/npm-publish.yml +0 -44
- package/demo/package.rig2.json5 +0 -8
- package/demo/test.js +0 -18
- package/lib/rig/index.js +0 -17
package/lib/init/index.js
CHANGED
|
@@ -4,24 +4,22 @@
|
|
|
4
4
|
* @author Wang Bo (ralwayne@163.com)
|
|
5
5
|
* @date 2020/10/9 6:14 PM
|
|
6
6
|
*/
|
|
7
|
-
const shell = require('shelljs');
|
|
8
7
|
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
10
8
|
const json5 = require('json5');
|
|
11
|
-
const inquirer = require('inquirer');
|
|
12
9
|
const chalk = require('chalk');
|
|
13
10
|
let log = console.log;
|
|
14
11
|
let green = chalk.green;
|
|
15
|
-
let red = chalk.red;
|
|
16
12
|
let redBright = chalk.redBright;
|
|
17
13
|
|
|
18
|
-
let yellow = chalk.yellow;
|
|
19
|
-
|
|
20
14
|
//加载命令控制器
|
|
21
15
|
|
|
22
|
-
const load = async (
|
|
16
|
+
const load = async () => {
|
|
23
17
|
try {
|
|
24
18
|
console.log(chalk.blue('exec init'));
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(`${process.cwd()}/package.json`));
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
25
23
|
//检查当前目录是否存在package.json
|
|
26
24
|
if (!(fs.existsSync('package.json') && fs.lstatSync('package.json').isFile())) {
|
|
27
25
|
console.log(chalk.red('Please run this in the root directory of project!Must have a validate package.json'));
|
|
@@ -32,7 +30,7 @@ const load = async (cmd) => {
|
|
|
32
30
|
console.log(chalk.green('package.rig.json5 already exists~'));
|
|
33
31
|
} else {
|
|
34
32
|
//创建package.rig.json5.json5
|
|
35
|
-
let template
|
|
33
|
+
let template = `[
|
|
36
34
|
// {
|
|
37
35
|
// name: "your project name",
|
|
38
36
|
// source: "git ssh url",
|
|
@@ -43,26 +41,43 @@ const load = async (cmd) => {
|
|
|
43
41
|
console.log(chalk.green('create package.rig.json5'));
|
|
44
42
|
fs.writeFileSync('./package.rig.json5', template);
|
|
45
43
|
}
|
|
46
|
-
if (fs.existsSync(
|
|
44
|
+
if (fs.existsSync(`${process.cwd()}/rig_helper.js`)) {
|
|
47
45
|
console.log(chalk.green('rig_helper.js already exists~'));
|
|
48
|
-
}else{
|
|
49
|
-
|
|
46
|
+
} else {
|
|
47
|
+
console.log(chalk.green('create rig_helper.js'));
|
|
48
|
+
let template = `const json5 = require('json5');
|
|
50
49
|
const fs = require('fs');
|
|
51
50
|
const getPkgs = () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
\tlet pkgArr = json5.parse(fs.readFileSync('./package.rig.json5'));
|
|
52
|
+
\tlet flatPkgArr = pkgArr.map((item, index) => {
|
|
53
|
+
\t\treturn item.name;
|
|
54
|
+
\t});
|
|
55
|
+
\tconsole.log(flatPkgArr);
|
|
56
|
+
\treturn flatPkgArr;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
module.exports = {
|
|
61
|
-
|
|
60
|
+
\tgetPkgs
|
|
62
61
|
}
|
|
63
62
|
`
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
fs.writeFileSync(`${process.cwd()}/rig_helper.js`, template);
|
|
64
|
+
}
|
|
65
|
+
if (fs.existsSync(`${process.cwd()}/cicd.rig.json5`)) {
|
|
66
|
+
console.log(chalk.green('cicd.rig.json5 already exists~'));
|
|
67
|
+
} else {
|
|
68
|
+
console.log(chalk.green('create cicd.rig.json5'));
|
|
69
|
+
let template = `{
|
|
70
|
+
tree_schema: '{app}/{env}/{oem}',
|
|
71
|
+
source: {
|
|
72
|
+
root_path: 'dist',
|
|
73
|
+
},
|
|
74
|
+
target: {},
|
|
75
|
+
endpoints: {},
|
|
76
|
+
groups: [],
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
fs.writeFileSync(`${process.cwd()}/cicd.rig.json5`, template);
|
|
80
|
+
|
|
66
81
|
}
|
|
67
82
|
//检查rigs是否存在
|
|
68
83
|
if (fs.existsSync('./rigs') && fs.lstatSync('./rigs').isDirectory()) {
|
|
@@ -111,21 +126,21 @@ module.exports = {
|
|
|
111
126
|
"rigs/*",
|
|
112
127
|
"rigs_dev/*"
|
|
113
128
|
],
|
|
114
|
-
scripts:{
|
|
115
|
-
preinstall:"rig preinstall",
|
|
116
|
-
postinstall:"rig postinstall",
|
|
129
|
+
scripts: {
|
|
130
|
+
preinstall: "rig preinstall",
|
|
131
|
+
postinstall: "rig postinstall",
|
|
117
132
|
},
|
|
118
|
-
devDependencies:{
|
|
119
|
-
json5:'2.1.3'
|
|
133
|
+
devDependencies: {
|
|
134
|
+
json5: '2.1.3'
|
|
120
135
|
}
|
|
121
136
|
}
|
|
122
137
|
pkgJSON.private = inserted.private;
|
|
123
138
|
//初始化workspaces
|
|
124
139
|
if (pkgJSON.workspaces && pkgJSON.workspaces instanceof Array) {
|
|
125
|
-
if (pkgJSON.workspaces.indexOf('rigs/*')
|
|
140
|
+
if (pkgJSON.workspaces.indexOf('rigs/*') === -1) {
|
|
126
141
|
pkgJSON.workspaces.push('rigs/*')
|
|
127
142
|
}
|
|
128
|
-
if (pkgJSON.workspaces.indexOf('rigs_dev/*')
|
|
143
|
+
if (pkgJSON.workspaces.indexOf('rigs_dev/*') === -1) {
|
|
129
144
|
pkgJSON.workspaces.push('rigs_dev/*')
|
|
130
145
|
}
|
|
131
146
|
|
|
@@ -134,26 +149,26 @@ module.exports = {
|
|
|
134
149
|
}
|
|
135
150
|
//初始化pre/post-install
|
|
136
151
|
if (pkgJSON.scripts && pkgJSON.scripts instanceof Object) {
|
|
137
|
-
if (pkgJSON.scripts.preinstall && pkgJSON.scripts.preinstall.indexOf(inserted.scripts.preinstall)<0) {
|
|
152
|
+
if (pkgJSON.scripts.preinstall && pkgJSON.scripts.preinstall.indexOf(inserted.scripts.preinstall) < 0) {
|
|
138
153
|
pkgJSON.scripts.preinstall = `${pkgJSON.scripts.preinstall} && ${inserted.scripts.preinstall}`
|
|
139
|
-
}else{
|
|
154
|
+
} else {
|
|
140
155
|
pkgJSON.scripts.preinstall = inserted.scripts.preinstall;
|
|
141
156
|
}
|
|
142
|
-
if (pkgJSON.scripts.postinstall && pkgJSON.scripts.postinstall.indexOf(inserted.scripts.postinstall)<0) {
|
|
157
|
+
if (pkgJSON.scripts.postinstall && pkgJSON.scripts.postinstall.indexOf(inserted.scripts.postinstall) < 0) {
|
|
143
158
|
pkgJSON.scripts.postinstall = `${pkgJSON.scripts.postinstall} && ${inserted.scripts.postinstall}`
|
|
144
|
-
}else{
|
|
159
|
+
} else {
|
|
145
160
|
pkgJSON.scripts.postinstall = inserted.scripts.postinstall;
|
|
146
161
|
}
|
|
147
162
|
} else {
|
|
148
163
|
pkgJSON.scripts = inserted.scripts
|
|
149
164
|
}
|
|
150
|
-
if (pkgJSON.devDependencies){
|
|
165
|
+
if (pkgJSON.devDependencies) {
|
|
151
166
|
//TODO:可优化
|
|
152
167
|
pkgJSON.devDependencies.json5 = inserted.devDependencies.json5;
|
|
153
|
-
}else{
|
|
168
|
+
} else {
|
|
154
169
|
pkgJSON.devDependencies = inserted.devDependencies;
|
|
155
170
|
}
|
|
156
|
-
fs.writeFileSync('package.json', JSON.stringify(pkgJSON,null,2));
|
|
171
|
+
fs.writeFileSync('package.json', JSON.stringify(pkgJSON, null, 2));
|
|
157
172
|
log(green('package.json updated'))
|
|
158
173
|
} catch (e) {
|
|
159
174
|
log(redBright(e.message));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const json5 = require('json5');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const getPkgs = () => {
|
|
4
|
+
let pkgArr = json5.parse(fs.readFileSync('./package.rig.json5'));
|
|
5
|
+
let flatPkgArr = pkgArr.map((item, index) => {
|
|
6
|
+
return item.name;
|
|
7
|
+
});
|
|
8
|
+
console.log(flatPkgArr);
|
|
9
|
+
return flatPkgArr;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
getPkgs
|
|
14
|
+
}
|
package/lib/install/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const shell = require('shelljs');
|
|
8
8
|
const print = require('../print')
|
|
9
9
|
//加载命令控制器
|
|
10
|
-
const load = async (
|
|
10
|
+
const load = async () => {
|
|
11
11
|
print.info('start installing\n');
|
|
12
12
|
try {
|
|
13
13
|
let yarnProcess = shell.exec('yarn install',{silent:true});
|
|
@@ -24,6 +24,5 @@ const load = async (cmd) => {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
module.exports = {
|
|
27
|
-
name: 'install',
|
|
28
27
|
load
|
|
29
28
|
}
|
package/lib/rig/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {Command} from 'commander';
|
|
2
|
+
|
|
3
|
+
const program = new Command();
|
|
4
|
+
console.log('Hello');
|
|
5
|
+
|
|
6
|
+
import check from '../check';
|
|
7
|
+
|
|
8
|
+
program.command('check').action(check.load);
|
|
9
|
+
import init from '../init';
|
|
10
|
+
|
|
11
|
+
program.command('init').action(init.load);
|
|
12
|
+
import install from '../install';
|
|
13
|
+
|
|
14
|
+
program.command('install').action(install.load);
|
|
15
|
+
program.command('i').action(install.load);
|
|
16
|
+
import preinstall from '../preinstall';
|
|
17
|
+
import postinstall from '../postinstall';
|
|
18
|
+
|
|
19
|
+
program.command('preinstall').action(preinstall.load);
|
|
20
|
+
program.command('postinstall').action(postinstall.load);
|
|
21
|
+
import tag from '../tag';
|
|
22
|
+
|
|
23
|
+
program.command('tag').action(tag.load);
|
|
24
|
+
import info from '../info';
|
|
25
|
+
|
|
26
|
+
program.command('info').action(info.load);
|
|
27
|
+
import build from '../build';
|
|
28
|
+
|
|
29
|
+
program.command('build')
|
|
30
|
+
.option('-s, --schema <schema>', 'specify params in tree_schema')
|
|
31
|
+
.option('-p , --params <params>', 'replace words in cicd.rig.json5, only words in ${} are replacable')
|
|
32
|
+
.action(build);
|
|
33
|
+
// import define from '../define';
|
|
34
|
+
//
|
|
35
|
+
// program.command('define')
|
|
36
|
+
// .option('-s, --schema <schema>', 'specify params in tree_schema')
|
|
37
|
+
// .option('-p , --params <params>', 'replace words in cicd.rig.json5, only words in ${} are replacable')
|
|
38
|
+
// .action(define);
|
|
39
|
+
import deploy from '../deploy';
|
|
40
|
+
|
|
41
|
+
program.command('deploy')
|
|
42
|
+
.option('-s, --schema <schema>', 'specify params in tree_schema')
|
|
43
|
+
.option('-p , --params <params>', 'replace words in cicd.rig.json5, only words in ${} are replacable')
|
|
44
|
+
.action(deploy);
|
|
45
|
+
import env from '../env';
|
|
46
|
+
|
|
47
|
+
program.option('-e, --env <env>', 'specify env').action(env.load);
|
|
48
|
+
program.version(require('../../package.json').version, '-v,--version');
|
|
49
|
+
program.parse(process.argv);
|
package/lib/tag/index.js
CHANGED
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
* @date 2020/10/15 3:28 PM
|
|
6
6
|
*/
|
|
7
7
|
const fs = require('fs');
|
|
8
|
-
const JSON5 = require('json5');
|
|
9
8
|
const shell = require('shelljs');
|
|
10
9
|
const chalk = require('chalk');
|
|
11
10
|
const print = require('../print');
|
|
12
11
|
let red = chalk.red;
|
|
13
|
-
let greenBright = chalk.greenBright;
|
|
14
|
-
let redBright = chalk.redBright;
|
|
15
12
|
|
|
16
13
|
|
|
17
14
|
const load = async ()=>{
|
package/lib/utils/index.js
CHANGED
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
const gitURL = /(?:git|ssh|https?|git@[-\w.]+):(\/\/)?(.*?)(\.git)(\/?|\#[-\d\w._]+?)$/;
|
|
8
8
|
const path = /^(\/\w+){0,2}\/?$/;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 文字下划线中划线
|
|
11
|
+
* @type {RegExp}
|
|
12
|
+
*/
|
|
13
|
+
const dynamicDir = /(^\[[\w\-]+\]$)|(^\{[\w\-]+\}$)/
|
|
14
|
+
export default {
|
|
15
|
+
gitURL,
|
|
16
|
+
path,
|
|
17
|
+
dynamicDir
|
|
12
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rigjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
4
|
"description": "A multi-repos dev tool based on yarn and git.Rig is inspired by cocoapods. Not like those monorepo solutions,rig is a tool for organizing multi-repos.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modular",
|
|
@@ -28,14 +28,27 @@
|
|
|
28
28
|
"c": "d demo && node ../lib/rig/index.js check",
|
|
29
29
|
"envmake": "cd demo && node ../lib/rig/index.js --env prod_view_zhs",
|
|
30
30
|
"t": "node lib/rig/index.js tag",
|
|
31
|
-
"deliver": "npm publish --registry=https://registry.npmjs.org"
|
|
31
|
+
"deliver": "npm publish --registry=https://registry.npmjs.org",
|
|
32
|
+
"build": "esbuild lib/rig/index.ts --platform=node --bundle --minify --outfile=built/index.js --external:shelljs"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
35
|
+
"@types/ali-oss": "^6.16.3",
|
|
36
|
+
"@types/json5": "^2.2.0",
|
|
37
|
+
"@types/qs": "^6.9.7",
|
|
38
|
+
"@types/shelljs": "^0.8.11",
|
|
39
|
+
"@types/uuid": "^8.3.4",
|
|
40
|
+
"ali-oss": "^6.17.1",
|
|
41
|
+
"axios": "^0.26.1",
|
|
34
42
|
"chalk": "^4.1.0",
|
|
35
43
|
"commander": "6.1.0",
|
|
44
|
+
"dayjs": "^1.11.0",
|
|
36
45
|
"inquirer": "7.3.3",
|
|
37
46
|
"json5": "2.1.3",
|
|
38
47
|
"ora": "^5.1.0",
|
|
39
|
-
"shelljs": "^0.8.4"
|
|
48
|
+
"shelljs": "^0.8.4",
|
|
49
|
+
"uuid": "^8.3.2"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^17.0.21"
|
|
40
53
|
}
|
|
41
54
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2015",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"strict": true,
|
|
6
|
+
"importHelpers": true,
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"outDir": "./built",
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"types": [
|
|
17
|
+
"node"
|
|
18
|
+
],
|
|
19
|
+
"paths": {
|
|
20
|
+
"@/*": [
|
|
21
|
+
"./lib/*"
|
|
22
|
+
],
|
|
23
|
+
"@root/*": [
|
|
24
|
+
"./*"
|
|
25
|
+
],
|
|
26
|
+
"@static/*": [
|
|
27
|
+
"static/*"
|
|
28
|
+
],
|
|
29
|
+
"tslib": [
|
|
30
|
+
"node_modules/tslib/tslib.d.ts"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"lib": [
|
|
34
|
+
"es2015"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"include": [
|
|
38
|
+
"index.ts",
|
|
39
|
+
"rigs/**/*.ts",
|
|
40
|
+
"src/**/*.ts",
|
|
41
|
+
"lib/**/*.ts",
|
|
42
|
+
"lib/**/*.d.ts",
|
|
43
|
+
"lib/**/*.js",
|
|
44
|
+
"test/**/*.ts",
|
|
45
|
+
"typings/**/*.ts",
|
|
46
|
+
],
|
|
47
|
+
"exclude": [
|
|
48
|
+
"node_modules"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
build:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
- uses: actions/setup-node@v1
|
|
17
|
-
with:
|
|
18
|
-
node-version: 12
|
|
19
|
-
|
|
20
|
-
publish-npm:
|
|
21
|
-
needs: build
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v2
|
|
25
|
-
- uses: actions/setup-node@v1
|
|
26
|
-
with:
|
|
27
|
-
node-version: 12
|
|
28
|
-
registry-url: https://registry.npmjs.org/
|
|
29
|
-
- run: npm publish
|
|
30
|
-
env:
|
|
31
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
32
|
-
|
|
33
|
-
publish-gpr:
|
|
34
|
-
needs: build
|
|
35
|
-
runs-on: ubuntu-latest
|
|
36
|
-
steps:
|
|
37
|
-
- uses: actions/checkout@v2
|
|
38
|
-
- uses: actions/setup-node@v1
|
|
39
|
-
with:
|
|
40
|
-
node-version: 12
|
|
41
|
-
registry-url: https://npm.pkg.github.com/
|
|
42
|
-
- run: npm publish
|
|
43
|
-
env:
|
|
44
|
-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/demo/package.rig2.json5
DELETED
package/demo/test.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// const fs = require('fs');
|
|
2
|
-
// let pkgStr = fs.readFileSync('package.json').toString();
|
|
3
|
-
// let pkg = JSON.parse(pkgStr);
|
|
4
|
-
// console.log(pkg);
|
|
5
|
-
// pkg.info = 'test';
|
|
6
|
-
// // fs.('package.json');
|
|
7
|
-
// fs.writeFileSync('package.json', JSON.stringify(pkg,null,2));
|
|
8
|
-
// pkgStr = fs.readFileSync('package.json').toString();
|
|
9
|
-
// pkg = JSON.parse(pkgStr);
|
|
10
|
-
// console.log(pkg);
|
|
11
|
-
//
|
|
12
|
-
console.log(/^([a-z]+-){1,3}([0-9]+)(\.([0-9]+)){3}$/.test('a-a-1.2.1.1'));
|
|
13
|
-
//cmd
|
|
14
|
-
// console.log(/^(\.([0-9]+)){3}$/.test('a-a-1.2.1.1'));
|
|
15
|
-
console.log('a-a-1.2.1.1'.split(/(?<=[a-z])-(?=[0-9])/));
|
|
16
|
-
|
|
17
|
-
//抓取版本
|
|
18
|
-
|
package/lib/rig/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { Command } = require('commander');
|
|
2
|
-
const program = new Command();
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
program.command('check').action(require('../check').load);
|
|
5
|
-
program.command('init').action(require('../init').load);
|
|
6
|
-
program.command('install').action(require('../install').load);
|
|
7
|
-
program.command('i').action(require('../install').load);
|
|
8
|
-
program.command('publish').action(require('../publish').load);
|
|
9
|
-
program.command('p').action(require('../publish').load);
|
|
10
|
-
program.command('preinstall').action(require('../preinstall').load);
|
|
11
|
-
program.command('postinstall').action(require('../postinstall').load);
|
|
12
|
-
program.command('tag').action(require('../tag').load);
|
|
13
|
-
program.command('info').action(require('../info').load);
|
|
14
|
-
program.option('-e, --env <env>', 'specify env').action(require('../env').load);
|
|
15
|
-
|
|
16
|
-
program.version(require('../../package.json').version,'-v,--version');
|
|
17
|
-
program.parse(process.argv);
|