rigjs 3.0.23 → 3.0.25

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.
@@ -14,7 +14,7 @@ const load = async () => {
14
14
  let rigJson5Str = fs.readFileSync('package.rig.json5');
15
15
  let rigJson5 = json5.parse(rigJson5Str);
16
16
  let hasErr = false;
17
- for (let dep of rigJson5) {
17
+ for (let dep of rigJson5.dependencies) {
18
18
  if (dep.dev) {
19
19
  hasErr = true;
20
20
  print.error(`${dep.name} is in developing!\nUse correct version and set dev to false!`);
package/lib/tag/index.ts CHANGED
@@ -5,15 +5,19 @@
5
5
  * @date 2020/10/15 3:28 PM
6
6
  */
7
7
  const fs = require('fs');
8
- import shell from "shelljs";
8
+ import shell, {cat} from "shelljs";
9
9
  import chalk from "chalk";
10
10
  import print from '../print'
11
+ import json5 from 'json5';
12
+
11
13
  let red = chalk.red;
12
14
 
13
15
 
14
16
  const load = async () => {
15
17
  try {
16
18
  let pkgJson = JSON.parse(fs.readFileSync('package.json').toString());
19
+ let pkgJson5 = json5.parse(fs.readFileSync('package.rig.json5').toString());
20
+
17
21
  console.log(pkgJson);
18
22
  let version = pkgJson.version;
19
23
  if (!fs.existsSync('.git')) {
@@ -23,9 +27,32 @@ const load = async () => {
23
27
  }
24
28
  let statusProcess = shell.exec('git status', {silent: true});
25
29
  if (statusProcess.stdout.indexOf('nothing to commit') >= 0) {
26
- shell.exec(`git tag ${version}`);
27
- print.succeed(`tag:${version} created.`);
30
+ if(pkgJson5.tag_template){
31
+ let tagStr = `${pkgJson5.tag_template}`;
32
+
33
+ try{
34
+ const fields = pkgJson5.tag_template.match(/(?<={)[^{}]+(?=})/g)
35
+ fields.forEach((field: string) => {
36
+ const value = pkgJson[field];
37
+ if (value) {
38
+ tagStr = tagStr.replace(`{${field}}`, value)
39
+ } else {
40
+ print.error(`field:${field} not found in package.json`);
41
+ process.exit(1)
42
+ }
43
+ });
44
+ shell.exec(`git tag ${tagStr}`);
45
+ print.succeed(`tag:${tagStr} created.`);
46
+ }catch(e:any){
47
+ print.error(`create tag failed:${e.message}`);
48
+ process.exit(1)
49
+ }
50
+ }else{
51
+ shell.exec(`git tag ${version}`);
52
+ print.succeed(`tag:${version} created.`);
53
+ }
28
54
  } else {
55
+ print.error('please commit your changes before tag');
29
56
  print.error(statusProcess.stdout);
30
57
  process.exit(1)
31
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "3.0.23",
3
+ "version": "3.0.25",
4
4
  "description": "A multi-repos dev tool based on yarn and git.Rigjs is intended to be the simplest way to develop,share and deliver codes between different developers or different projects.",
5
5
  "keywords": [
6
6
  "modular",
@@ -25,7 +25,7 @@
25
25
  "p": "cd demo && node ../lib/rig/index.js publish",
26
26
  "posti": "cd demo && node ../lib/rig/index.js postinstall",
27
27
  "prei": "cd demo && node ../built/index.js preinstall",
28
- "c": "d demo && node ../lib/rig/index.js check",
28
+ "c": "cd 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
31
  "deliver": "npm publish --registry=https://registry.npmjs.org",