rigjs 3.0.25 → 3.0.30

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/lib/tag/index.ts CHANGED
@@ -16,9 +16,13 @@ let red = chalk.red;
16
16
  const load = async () => {
17
17
  try {
18
18
  let pkgJson = JSON.parse(fs.readFileSync('package.json').toString());
19
- let pkgJson5 = json5.parse(fs.readFileSync('package.rig.json5').toString());
19
+ let pkgJson5 = null
20
+ try{
21
+ pkgJson5 = json5.parse(fs.readFileSync('package.rig.json5').toString());
22
+ }catch (e) {
23
+ print.warn('no validate package.rig.json5 found, use package.json')
24
+ }
20
25
 
21
- console.log(pkgJson);
22
26
  let version = pkgJson.version;
23
27
  if (!fs.existsSync('.git')) {
24
28
  print.error('.git not found at the level of package.json');
@@ -27,7 +31,7 @@ const load = async () => {
27
31
  }
28
32
  let statusProcess = shell.exec('git status', {silent: true});
29
33
  if (statusProcess.stdout.indexOf('nothing to commit') >= 0) {
30
- if(pkgJson5.tag_template){
34
+ if(pkgJson5&&pkgJson5.tag_template){
31
35
  let tagStr = `${pkgJson5.tag_template}`;
32
36
 
33
37
  try{
@@ -47,6 +51,26 @@ const load = async () => {
47
51
  print.error(`create tag failed:${e.message}`);
48
52
  process.exit(1)
49
53
  }
54
+ }else if (pkgJson&&pkgJson.rig_tag_template){
55
+ let tagStr = `${pkgJson.rig_tag_template}`;
56
+
57
+ try{
58
+ const fields = pkgJson.tag_template.match(/(?<={)[^{}]+(?=})/g)
59
+ fields.forEach((field: string) => {
60
+ const value = pkgJson[field];
61
+ if (value) {
62
+ tagStr = tagStr.replace(`{${field}}`, value)
63
+ } else {
64
+ print.error(`field:${field} not found in package.json`);
65
+ process.exit(1)
66
+ }
67
+ });
68
+ shell.exec(`git tag ${tagStr}`);
69
+ print.succeed(`tag:${tagStr} created.`);
70
+ }catch(e:any){
71
+ print.error(`create tag failed:${e.message}`);
72
+ process.exit(1)
73
+ }
50
74
  }else{
51
75
  shell.exec(`git tag ${version}`);
52
76
  print.succeed(`tag:${version} created.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "3.0.25",
3
+ "version": "3.0.30",
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",
@@ -13,7 +13,10 @@
13
13
  "workspaces"
14
14
  ],
15
15
  "main": "index.js",
16
- "repository": "https://github.com/FlashHand/rig",
16
+ "repository":{
17
+ "type": "git",
18
+ "url": "https://github.com/FlashHand/rig"
19
+ },
17
20
  "author": "ralwayne",
18
21
  "license": "MIT",
19
22
  "bin": {