rigjs 2.0.19-alpha.1 → 2.0.19-alpha.4

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,10 +4,11 @@ import shell from 'shelljs';
4
4
  import path from 'path';
5
5
  import fs from 'fs';
6
6
  import vueEnv from '../vue-env';
7
+
7
8
  const JSON5 = require('json5');
8
9
 
9
10
  const replaceDefine = (target: string, defines?: Define) => {
10
- console.log('start replaceDefine');
11
+ console.log(`start replaceDefine:${target}`);
11
12
  const dirs = fs.readdirSync(target);
12
13
  for (let dir of dirs) {
13
14
  const stat = fs.statSync(path.join(target, dir));
@@ -45,7 +46,6 @@ export default async (cmd: any) => {
45
46
 
46
47
  for (let i = 0; i < cicdCmd.endpoints.length; i++) {
47
48
  const ep = cicdCmd.endpoints[i];
48
- ep.build = ep.build.replace(regexPublicPath, ep.publicPath);
49
49
  try {
50
50
  //替换define中的$public_path
51
51
  Object.keys(ep.defines).forEach(key => {
@@ -56,21 +56,23 @@ export default async (cmd: any) => {
56
56
  }
57
57
  let frameworktype: FrameworkType | undefined;
58
58
  //判断是否要生成环境变量文件,以及生成环境变量的操作
59
- if (ep.vue_env){
59
+ if (ep.vue_env) {
60
60
  frameworktype = FrameworkType.vue;
61
61
  }
62
- if (!ep.extra_env)ep.extra_env = {};
62
+ if (!ep.extra_env) ep.extra_env = {};
63
63
  ep.extra_env['PUBLIC_PATH'] = ep.publicPath;
64
64
  ep.extra_env['OUTPUT_DIR'] = path.join(cicd.source.root_path, ep.dir);
65
65
 
66
- switch (frameworktype){
67
- case FrameworkType.vue:{
68
- vueEnv.useEnv(ep.vue_env!,ep.extra_env);
66
+ switch (frameworktype) {
67
+ case FrameworkType.vue: {
68
+ vueEnv.useEnv(ep.vue_env!, ep.extra_env);
69
+ if (!ep.build) ep.build = 'npx vue-cli-service build --mode rig';
69
70
  }
70
71
  break;
71
72
  default:
72
73
  break;
73
74
  }
75
+ ep.build = ep.build.replace(regexPublicPath, ep.publicPath);
74
76
  shell.exec(ep.build);
75
77
 
76
78
  //setup default defines and replace text in built source.
@@ -4,6 +4,8 @@
4
4
  root_path: 'dist',
5
5
  },
6
6
  target: {},
7
- endpoints: {},
7
+ endpoints: {
8
+
9
+ },
8
10
  groups: [],
9
11
  }
@@ -23,12 +23,7 @@ const useEnv = (mode,extra)=>{
23
23
  }
24
24
  print.info(`using env:`)
25
25
  console.log(content);
26
- fs.writeFile('./.env.rig', content, {flag: "w"}, err => {
27
- if (err){
28
- print.error(err);
29
- process.exit(1)
30
- }
31
- });
26
+ fs.writeFileSync('./.env.rig', content, {flag: "w"});
32
27
  } else {
33
28
  print.error("请先在env.rig.json5文件中配置" + mode + "模式的环境变量");
34
29
  process.exit(1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "2.0.19-alpha.1",
3
+ "version": "2.0.19-alpha.4",
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",