rigjs 1.0.33 → 2.0.0-alpha.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.
Files changed (52) hide show
  1. package/bin/rig.js +1 -1
  2. package/built/index.js +70 -0
  3. package/demo/babel.config.js +5 -0
  4. package/demo/cicd.rig.json5 +9 -0
  5. package/demo/jsconfig.json +19 -0
  6. package/demo/package.json +41 -11
  7. package/demo/package.rig.json5 +0 -6
  8. package/demo/public/favicon.ico +0 -0
  9. package/demo/public/index.html +17 -0
  10. package/demo/rig_helper.js +7 -7
  11. package/demo/src/App.vue +28 -0
  12. package/demo/src/assets/logo.png +0 -0
  13. package/demo/src/components/HelloWorld.vue +58 -0
  14. package/demo/src/main.js +8 -0
  15. package/demo/vue.config.js +4 -0
  16. package/demo/yarn.lock +5644 -0
  17. package/lib/build/index.ts +17 -0
  18. package/lib/check/index.d.ts +6 -0
  19. package/lib/check/index.js +0 -1
  20. package/lib/classes/cicd/CICD.ts +110 -0
  21. package/lib/classes/cicd/CICDCmd.ts +65 -0
  22. package/lib/classes/cicd/Deploy/AliDeploy.ts +0 -0
  23. package/lib/classes/cicd/Deploy/HuaweiDeploy.ts +0 -0
  24. package/lib/classes/cicd/Deploy/index.ts +0 -0
  25. package/lib/classes/cicd/DirLevel.ts +49 -0
  26. package/lib/classes/cicd/Endpoint.ts +87 -0
  27. package/lib/define/index.ts +47 -0
  28. package/lib/deploy/index.ts +41 -0
  29. package/lib/deps/index.d.ts +6 -0
  30. package/lib/env/index.d.ts +4 -0
  31. package/lib/info/index.d.ts +6 -0
  32. package/lib/info/index.js +1 -0
  33. package/lib/init/cicd.rig.json5 +9 -0
  34. package/lib/init/index.d.ts +6 -0
  35. package/lib/init/index.js +49 -34
  36. package/lib/init/rig_helper.js +14 -0
  37. package/lib/install/index.d.ts +5 -0
  38. package/lib/install/index.js +1 -2
  39. package/lib/postinstall/index.d.ts +6 -0
  40. package/lib/preinstall/index.d.ts +6 -0
  41. package/lib/rig/index.ts +48 -0
  42. package/lib/tag/index.d.ts +6 -0
  43. package/lib/tag/index.js +0 -3
  44. package/lib/utils/fsHelper.ts +10 -0
  45. package/lib/utils/index.js +4 -1
  46. package/lib/utils/{regex.js → regex.ts} +9 -3
  47. package/package.json +10 -2
  48. package/tsconfig.json +50 -0
  49. package/.github/workflows/npm-publish.yml +0 -44
  50. package/demo/package.rig2.json5 +0 -8
  51. package/demo/test.js +0 -18
  52. package/lib/rig/index.js +0 -17
@@ -7,7 +7,7 @@
7
7
  const shell = require('shelljs');
8
8
  const print = require('../print')
9
9
  //加载命令控制器
10
- const load = async (cmd) => {
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
  }
@@ -0,0 +1,6 @@
1
+ declare namespace postinstall {
2
+ function load(): void;
3
+ const name: string;
4
+
5
+ }
6
+ export default postinstall;
@@ -0,0 +1,6 @@
1
+ declare namespace preinstall {
2
+ function load(): void;
3
+ const name: string;
4
+
5
+ }
6
+ export default preinstall;
@@ -0,0 +1,48 @@
1
+ import {Command} from 'commander';
2
+
3
+ const program = new Command();
4
+ console.log('Hello rigjs');
5
+ import check from '../check';
6
+
7
+ program.command('check').action(check.load);
8
+ import init from '../init';
9
+
10
+ program.command('init').action(init.load);
11
+ import install from '../install';
12
+
13
+ program.command('install').action(install.load);
14
+ program.command('i').action(install.load);
15
+ import preinstall from '../preinstall';
16
+ import postinstall from '../postinstall';
17
+
18
+ program.command('preinstall').action(preinstall.load);
19
+ program.command('postinstall').action(postinstall.load);
20
+ import tag from '../tag';
21
+
22
+ program.command('tag').action(tag.load);
23
+ import info from '../info';
24
+
25
+ program.command('info').action(info.load);
26
+ import build from '../build';
27
+
28
+ program.command('build')
29
+ .option('-s, --schema <schema>', 'specify params in tree_schema')
30
+ .option('-p , --params <params>', 'replace words in cicd.rig.json5, only words in ${} are replacable')
31
+ .action(build);
32
+ // import define from '../define';
33
+ //
34
+ // program.command('define')
35
+ // .option('-s, --schema <schema>', 'specify params in tree_schema')
36
+ // .option('-p , --params <params>', 'replace words in cicd.rig.json5, only words in ${} are replacable')
37
+ // .action(define);
38
+ import deploy from '../deploy';
39
+
40
+ program.command('deploy')
41
+ .option('-s, --schema <schema>', 'specify params in tree_schema')
42
+ .option('-p , --params <params>', 'replace words in cicd.rig.json5, only words in ${} are replacable')
43
+ .action(deploy);
44
+ import env from '../env';
45
+
46
+ program.option('-e, --env <env>', 'specify env').action(env.load);
47
+ program.version(require('../../package.json').version, '-v,--version');
48
+ program.parse(process.argv);
@@ -0,0 +1,6 @@
1
+ declare namespace tag {
2
+ function load(): void;
3
+ const name: string;
4
+
5
+ }
6
+ export default tag;
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 ()=>{
@@ -0,0 +1,10 @@
1
+ import fs from 'fs';
2
+
3
+ const JSON5 = require('json5');
4
+ const readCICDConfig = () => {
5
+ const cicdStr = fs.readFileSync(`${process.cwd()}/cicd.rig.json5`);
6
+ return JSON5.parse(cicdStr);
7
+ }
8
+ export default {
9
+ readCICDConfig
10
+ }
@@ -5,6 +5,9 @@
5
5
  * @date 2020/10/10 3:58 PM
6
6
  */
7
7
  const regex = require('./regex');
8
+ const fsHelper = require('./fsHelper');
9
+
8
10
  module.exports ={
9
- regex
11
+ regex,
12
+ fsHelper
10
13
  }
@@ -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
- module.exports = {
10
- gitURL,
11
- path
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": "1.0.33",
3
+ "version": "2.0.0-alpha.0",
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,22 @@
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/shelljs": "^0.8.11",
38
+ "ali-oss": "^6.17.1",
34
39
  "chalk": "^4.1.0",
35
40
  "commander": "6.1.0",
36
41
  "inquirer": "7.3.3",
37
42
  "json5": "2.1.3",
38
43
  "ora": "^5.1.0",
39
44
  "shelljs": "^0.8.4"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^17.0.21"
40
48
  }
41
49
  }
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}}
@@ -1,8 +0,0 @@
1
- [
2
- {
3
- name: "r-foundation",
4
- source: "git@git.rys.cn:f2e-common/r-foundation.git",
5
- version: "1.0.1",
6
- dev: true
7
- }
8
- ]
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);