jjb-cmd 1.0.10 → 1.0.11

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/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "jjb-cmd",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "jjb脚手架工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "node bin/command.js help",
8
- "publish": "npm publish"
7
+ "test": "node bin/command.js help"
9
8
  },
10
9
  "bin": {
11
10
  "jjb-cmd": "bin/command.js"
package/src/cli.merge.js CHANGED
@@ -28,27 +28,34 @@ module.exports = (input, source) => {
28
28
  const settingJson = JSON.parse(fs.readFileSync(`${projectPath}/${inputRegion}/setting.json`).toString());
29
29
  TileItems(settingJson.items, () => {
30
30
 
31
- fromFileData.router.forEach(fromItem => {
32
- const itemPathArr = fromItem.pathAdr.split(fromItem.region);
33
- const filePathArr = itemPathArr[1].split('/');
34
- const application = filePathArr[1];
35
- if (!applicationJson[application]) {
36
- applicationJson[application] = {
37
- routerConfig: [],
38
- routerPath: []
39
- };
40
- }
41
- applicationJson[application].routerConfig.push(`{ path: '${fromItem.path}', component: () => import('${fromItem.file}') }`);
42
- applicationJson[application].routerPath.push(fromItem.path);
31
+ Object.keys(fromFileData).forEach(fileKey => {
32
+ fromFileData[fileKey].forEach(fromItem => {
33
+ const itemPathArr = fromItem.pathAdr.split(fromItem.region);
34
+ const filePathArr = itemPathArr[1].split('/');
35
+ const application = filePathArr[1];
36
+ if (!applicationJson[application]) {
37
+ applicationJson[application] = {
38
+ routerConfig: [],
39
+ routerPath: []
40
+ };
41
+ }
42
+ applicationJson[application].routerConfig.push(`{ path: '${fromItem.path}', component: () => import('${fromItem.file}') }`);
43
+ applicationJson[application].routerPath.push(fromItem.path);
43
44
 
44
- let applicationStr = filePathArr.join('/');
45
+ let applicationStr = filePathArr.join('/');
45
46
 
46
- const strArr = applicationStr.split('/');
47
- utils.CreatePaths(applicationPath, strArr.slice(0, strArr.length - 1)).then(() => {
48
- const fileContent = fs.readFileSync(fromItem.pathAdr).toString();
49
- fs.writeFileSync(`${vesselPath}/${applicationStr}`, fileContent);
50
- });
47
+ const strArr = applicationStr.split('/');
48
+ utils.CreatePaths(applicationPath, strArr.slice(0, strArr.length - 1)).then(() => {
49
+ if (fromItem.pathAdr.match(/(.png|.svg)/) != null) {
50
+ const imageFile = fs.readFileSync(fromItem.pathAdr, 'binary');
51
+ fs.writeFileSync(`${applicationPath}/${applicationStr}`, imageFile, 'binary');
52
+ } else {
53
+ const fileContent = fs.readFileSync(fromItem.pathAdr).toString();
54
+ fs.writeFileSync(`${applicationPath}/${applicationStr}`, fileContent);
55
+ }
56
+ });
51
57
 
58
+ });
52
59
  });
53
60
 
54
61
  });
package/src/cli.pull.js CHANGED
@@ -60,7 +60,7 @@ module.exports = input => {
60
60
  let commonToolsFile = fs.readFileSync(commonToolsPath).toString();
61
61
  let commonWebsiteFile = fs.readFileSync(commonWebsitePath).toString();
62
62
  commonToolsFile = commonToolsFile.replace('return __planA();', 'return process.env;');
63
- commonWebsiteFile = commonWebsiteFile.replace(/const\srelation\s=\srequire\(`\/src\/application\/\${module.code}\/enumerate\/menu`\)\.default;/, 'const relation = require(`/src/enumerate/menu`).default;');
63
+ commonWebsiteFile = commonWebsiteFile.replace(/const\srelation\s=\srequire\(`~\/application\/\${module.code}\/enumerate\/menu`\)\.default;/, "const relation = require('~/enumerate/menu').default;");
64
64
  fs.writeFileSync(commonToolsPath, commonToolsFile);
65
65
  fs.writeFileSync(commonWebsitePath, commonWebsiteFile);
66
66
  } else {