rigjs 2.0.19-alpha.4 → 2.1.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.
@@ -4,6 +4,7 @@ import shell from 'shelljs';
4
4
  import path from 'path';
5
5
  import fs from 'fs';
6
6
  import vueEnv from '../vue-env';
7
+ const print = require('../print');
7
8
 
8
9
  const JSON5 = require('json5');
9
10
 
@@ -48,9 +49,11 @@ export default async (cmd: any) => {
48
49
  const ep = cicdCmd.endpoints[i];
49
50
  try {
50
51
  //替换define中的$public_path
51
- Object.keys(ep.defines).forEach(key => {
52
- ep.defines[key] = ep.defines[key].replace(regexPublicPath, ep.publicPath);
53
- })
52
+ if (ep.defines){
53
+ Object.keys(ep.defines).forEach(key => {
54
+ ep.defines[key] = ep.defines[key].replace(regexPublicPath, ep.publicPath);
55
+ });
56
+ }
54
57
  } catch (e) {
55
58
  console.log('JSON5 error:', ep.defines, e.message);
56
59
  }
@@ -66,6 +69,7 @@ export default async (cmd: any) => {
66
69
  switch (frameworktype) {
67
70
  case FrameworkType.vue: {
68
71
  vueEnv.useEnv(ep.vue_env!, ep.extra_env);
72
+ //推测vue脚本
69
73
  if (!ep.build) ep.build = 'npx vue-cli-service build --mode rig';
70
74
  }
71
75
  break;
@@ -73,8 +77,8 @@ export default async (cmd: any) => {
73
77
  break;
74
78
  }
75
79
  ep.build = ep.build.replace(regexPublicPath, ep.publicPath);
80
+ print.info(`using build script:${ep.build}`);
76
81
  shell.exec(ep.build);
77
-
78
82
  //setup default defines and replace text in built source.
79
83
  if (!ep.defines) ep.defines = {};
80
84
  ep.defines['__DEPLOY_DIR__'] = ep.deployDir;
@@ -33,7 +33,7 @@ export interface DeployTarget {
33
33
  original: string;
34
34
  original_regexp: string;
35
35
  final?: string;
36
- };
36
+ } | undefined;
37
37
  }
38
38
 
39
39
  /**
@@ -80,6 +80,10 @@ export default async (cmd: any) => {
80
80
  ? endpoint.uri_rewrite
81
81
  : target.uri_rewrite;
82
82
 
83
+ if (!uriRewrite) {
84
+ continue;
85
+ }
86
+
83
87
  for (const domain of endpoint.domains) {
84
88
  setRewriteUriPromises.push(
85
89
  setRewriteUri(
@@ -103,7 +107,11 @@ export default async (cmd: any) => {
103
107
  console.log('Set RWrite URI Done');
104
108
 
105
109
  //刷新cdn
106
- await refreshCache(urls, cdn);
110
+ if (urls.length > 0) {
111
+ await refreshCache(urls, cdn);
112
+ } else {
113
+ console.log('Not Have To RefreshCache');
114
+ }
107
115
  console.log('Publish Done-----');
108
116
  } catch (e: any) {
109
117
  console.error(e.message);
package/lib/tag/index.js CHANGED
@@ -11,26 +11,28 @@ const print = require('../print');
11
11
  let red = chalk.red;
12
12
 
13
13
 
14
- const load = async ()=>{
15
- try {
16
- let pkgJson = JSON.parse(fs.readFileSync('package.json').toString());
17
- let version = pkgJson.version;
18
- if (!fs.existsSync('.git')) {
19
- print.error('.git not found at the level of package.json');
20
- print.error('should run "rig tag" in the directory with both .git and package.json');
21
- return;
22
- }
23
- let statusProcess = shell.exec('git status',{silent:true});
24
- if (statusProcess.stdout.indexOf('nothing to commit')>=0) {
25
- shell.exec(`git tag ${version}`);
26
- print.succeed(`tag:${version} created.`);
27
- }else {
28
- print.error(statusProcess.stdout);
29
- }
30
- }catch (e){
31
- console.log(red(e.message));
32
- }
14
+ const load = async () => {
15
+ try {
16
+ let pkgJson = JSON.parse(fs.readFileSync('package.json').toString());
17
+ let version = pkgJson.version;
18
+ if (!fs.existsSync('.git')) {
19
+ print.error('.git not found at the level of package.json');
20
+ print.error('should run "rig tag" in the directory with both .git and package.json');
21
+ process.exit(1)
22
+ }
23
+ let statusProcess = shell.exec('git status', {silent: true});
24
+ if (statusProcess.stdout.indexOf('nothing to commit') >= 0) {
25
+ shell.exec(`git tag ${version}`);
26
+ print.succeed(`tag:${version} created.`);
27
+ } else {
28
+ print.error(statusProcess.stdout);
29
+ process.exit(1)
30
+ }
31
+ } catch (e) {
32
+ console.log(red(e.message));
33
+ process.exit(1)
34
+ }
33
35
  }
34
36
  module.exports = {
35
- load
37
+ load
36
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "2.0.19-alpha.4",
3
+ "version": "2.1.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,8 +28,8 @@
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": "yarn build & npm publish --registry=https://registry.npmjs.org",
32
- "deliver:alpha": "yarn build & npm publish --registry=https://registry.npmjs.org --tag alpha",
31
+ "deliver": "rig tag & yarn build & npm publish --registry=https://registry.npmjs.org",
32
+ "deliver:alpha": "rig tag & yarn build & npm publish --registry=https://registry.npmjs.org --tag alpha",
33
33
  "build": "esbuild lib/rig/index.ts --platform=node --bundle --minify --outfile=built/index.js --external:shelljs"
34
34
  },
35
35
  "dependencies": {