@farris/jit-engine 1.3.302 → 1.3.303

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/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ 1.3.303
2
+
3
+ 支持版本校验功能
4
+
1
5
  1.3.302
2
6
 
3
7
  移动页面标题、tab过滤条件修复
package/bin/index.js CHANGED
@@ -1,19 +1,22 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  "use strict";
3
4
 
4
5
  const yargs = require("yargs");
5
6
  const path = require("path");
6
7
  const jitEngine = require('../lib/index');
8
+ const versionCheck = require("../lib/command/check")
7
9
 
8
10
  const FILE_PATH = 'file path';
9
11
  const METADATA_CONFIG = 'metadata config';
10
-
12
+ const jsonPath = "allowempty";
13
+ const projectName = "bo-featurenoah-front";
11
14
 
12
15
  yargs.options({
13
16
  'metaDataPath': {
14
17
  alias: 'mp',
15
18
  demand: true,
16
- default: path.resolve(__dirname, '../lib/config/sagi_object'),
19
+ default: path.resolve(__dirname, '../lib/config/' + jsonPath),
17
20
  describe: '元数据存放路径',
18
21
  type: 'string',
19
22
  group: FILE_PATH
@@ -21,28 +24,28 @@ yargs.options({
21
24
  'publishPath': {
22
25
  alias: 'pp',
23
26
  demand: true,
24
- default: path.resolve(__dirname, '../lib/publish/sagi_object'),
27
+ default: path.resolve(__dirname, '../lib/publish/' + jsonPath),
25
28
  describe: '代码生成目录',
26
29
  type: 'string',
27
30
  group: FILE_PATH
28
31
  },
29
- 'formFileName':{
32
+ 'formFileName': {
30
33
  alias: 'fn',
31
- default: 'Form_SagiObject.frm',
34
+ default: 't.frm',
32
35
  describe: '表单名称',
33
36
  type: 'string',
34
37
  group: METADATA_CONFIG
35
38
  },
36
39
  'cmd': {
37
40
  alias: 'cmd',
38
- default: 'Form_SagiObject.frm.command.json',
41
+ default: 't.frm.command',
39
42
  describe: 'Command 配置文件名',
40
43
  type: 'string',
41
44
  group: METADATA_CONFIG
42
45
  },
43
46
  'sm': {
44
47
  alias: 'sm',
45
- default: 'Form_SagiObject.frm.sm.json',
48
+ default: 't.frm.sm',
46
49
  describe: 'StateMachine 配置文件名',
47
50
  type: 'string',
48
51
  group: METADATA_CONFIG
@@ -67,8 +70,69 @@ yargs.options({
67
70
  describe: '端口号',
68
71
  type: 'string',
69
72
  group: METADATA_CONFIG
73
+ },
74
+ "ngVersion": {
75
+ alias: 'nv',
76
+ default: 'ng7',
77
+ describe: '编译的ng版本',
78
+ type: 'string',
79
+ group: METADATA_CONFIG
80
+ },
81
+ "projectName": {
82
+ alias: 'pn',
83
+ default: projectName,
84
+ describe: '工程名称',
85
+ type: 'string',
86
+ group: METADATA_CONFIG
87
+ },
88
+ "entryProject": {
89
+ alias: 'ep',
90
+ default: projectName,
91
+ describe: '默认的工程',
92
+ type: 'string',
93
+ group: METADATA_CONFIG
94
+ },
95
+ "projectRoute": {
96
+ alias: 'pr',
97
+ default: projectName + '.route.json',
98
+ describe: '默认的工程',
99
+ type: 'string',
100
+ group: METADATA_CONFIG
101
+ },
102
+ "linkedNodeModules": {
103
+ alias: 'lnm',
104
+ default: 'c:/projects/node_modules',
105
+ describe: '引用的node_modules路径',
106
+ type: 'string',
107
+ group: METADATA_CONFIG
108
+ },
109
+ "formatCode": {
110
+ alias: 'FYBXD',
111
+ default: 'true',
112
+ type: 'string',
113
+ group: METADATA_CONFIG
114
+ },
115
+ "eapiPath": {
116
+ alias: 'eapip',
117
+ default: 'D:/工作目录/ng7-jit-engine/farris-jit-engine/lib/config/eapifilename/',
118
+ type: 'string',
119
+ group: METADATA_CONFIG
120
+ },
121
+ "serviceUnitPath": {
122
+ default: 'TM/CM',
123
+ type: 'string',
124
+ group: METADATA_CONFIG
125
+ },
126
+ "isMobileApprove":{
127
+ default: false,
128
+ type: 'string',
129
+ group: METADATA_CONFIG
130
+ },
131
+ "mobileApproveFormCode":{
132
+ default: 'idpform',
133
+ type: 'string',
134
+ group: METADATA_CONFIG
70
135
  }
71
-
72
136
  });
73
137
 
74
138
  yargs.parse(process.argv.slice(2), (err, argv, output) => {
@@ -82,13 +146,28 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
82
146
  return;
83
147
  }
84
148
 
85
- try {
86
-
87
- jitEngine.jit(argv);
149
+ const command = process.argv.slice(2)[0];
150
+ if (command === 'check') {
151
+ if (argv.path) {
152
+ let result;
153
+ return versionCheck.checkVersion(argv.path, (result) => {
154
+ if (result.needUpdate) {
155
+ process.exit(1);
156
+ } else {
157
+ process.exit(0);
158
+ }
159
+ })
160
+ } else {
161
+ console.log('node_modules目录为空。');
162
+ process.exit(-1);
163
+ }
164
+ }
88
165
 
166
+ try {
167
+ jitEngine.jit(argv);
89
168
  } catch (e) {
90
169
  console.log(e);
91
170
  throw e;
92
171
  }
93
172
 
94
- });
173
+ })
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkVersion = void 0;
4
+ function checkVersion(dir, callback) {
5
+ let output = {
6
+ needUpdate: false,
7
+ updateList: []
8
+ };
9
+ const readPackageTree = require('read-package-tree');
10
+ readPackageTree(dir, (_err, physicalTree) => {
11
+ try {
12
+ const nodes = physicalTree.children;
13
+ let map = new Map();
14
+ for (const key in nodes) {
15
+ if (nodes.hasOwnProperty(key)) {
16
+ const element = nodes[key];
17
+ const packageData = element.package || {};
18
+ const id = packageData['_id'];
19
+ if (id) {
20
+ const atIndex = id.lastIndexOf('@');
21
+ const prefix = id.slice(0, atIndex);
22
+ const suffix = id.slice(atIndex + 1);
23
+ map.set(prefix, suffix);
24
+ }
25
+ }
26
+ }
27
+ const packageJson = physicalTree.package;
28
+ if (packageJson) {
29
+ const dependencies = packageJson.dependencies;
30
+ Object.keys(dependencies).forEach((key) => {
31
+ if (key.startsWith('@farris') || key.startsWith('@gsp')) {
32
+ if (dependencies.hasOwnProperty(key)) {
33
+ const packageJsonVersion = dependencies[key];
34
+ const nodeModulesVersion = map.get(key);
35
+ if (nodeModulesVersion) {
36
+ if (packageJsonVersion !== nodeModulesVersion && !isValidVersion(nodeModulesVersion, packageJsonVersion)) {
37
+ const info = {
38
+ name: key,
39
+ nodeModulesVersion: nodeModulesVersion,
40
+ packageJsonVersion: packageJsonVersion
41
+ };
42
+ output.needUpdate = true;
43
+ output.updateList.push(info);
44
+ }
45
+ }
46
+ else {
47
+ const info = {
48
+ name: key,
49
+ nodeModulesVersion: "",
50
+ packageJsonVersion: packageJsonVersion
51
+ };
52
+ output.needUpdate = true;
53
+ output.updateList.push(info);
54
+ }
55
+ }
56
+ }
57
+ });
58
+ if (output && output.needUpdate) {
59
+ console.log('The node_modules need to be updated, with the following update list:');
60
+ const updateList = output.updateList;
61
+ updateList.forEach((item) => {
62
+ console.log(item.name + '@' + item.packageJsonVersion);
63
+ });
64
+ }
65
+ callback(output);
66
+ }
67
+ }
68
+ catch (error) {
69
+ output.needUpdate = false;
70
+ }
71
+ });
72
+ }
73
+ exports.checkVersion = checkVersion;
74
+ function isValidVersion(versionToCheck, rangeSpecifier) {
75
+ let minVersion, maxMajor;
76
+ if (rangeSpecifier.startsWith('^')) {
77
+ const [major, minor, patch] = rangeSpecifier.slice(1).split('.').map(Number);
78
+ minVersion = `${major}.${minor}.${patch}`;
79
+ maxMajor = major + 1;
80
+ }
81
+ else {
82
+ return false;
83
+ }
84
+ function parseVersion(v) {
85
+ return v.split('.').map(Number);
86
+ }
87
+ const parsedVersionToCheck = parseVersion(versionToCheck);
88
+ const parsedMinVersion = parseVersion(minVersion);
89
+ for (let i = 0; i < parsedMinVersion.length; i++) {
90
+ if (parsedVersionToCheck[i] < parsedMinVersion[i])
91
+ return false;
92
+ if (parsedVersionToCheck[i] > parsedMinVersion[i])
93
+ break;
94
+ }
95
+ if (parsedVersionToCheck[0] === parsedMinVersion[0]) {
96
+ }
97
+ else if (parsedVersionToCheck[0] >= maxMajor) {
98
+ return false;
99
+ }
100
+ return true;
101
+ }
102
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {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K,gBAAgB,CAAC,CAAC,CAAC,EAAE;KAEpD;SAAM,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,QAAS,EAAE;QAC7C,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,56 +1,57 @@
1
- {
2
- "name": "@farris/jit-engine",
3
- "version": "1.3.302",
4
- "description": "",
5
- "main": "./lib/index.js",
6
- "bin": {
7
- "jit": "./bin/index.js"
8
- },
9
- "engines": {
10
- "node": ">= 6.9.0",
11
- "npm": ">= 3.0.0"
12
- },
13
- "files": [
14
- "lib/",
15
- "bin/",
16
- "ioc.config"
17
- ],
18
- "scripts": {
19
- "build": "npm run build-ts && npm run copy-static-assets",
20
- "build-q": "npm run build-ts",
21
- "test": "jest --coverage ",
22
- "watch-test": "npm run test --watchAll",
23
- "build-ts": "tsc",
24
- "tslint": "tslint -c tslint.json -p tsconfig.json",
25
- "copy-static-assets": "ts-node copyStaticAssets.ts"
26
- },
27
- "keywords": [
28
- "jit",
29
- "engine",
30
- "jit-engine"
31
- ],
32
- "author": "Noah",
33
- "license": "ISC",
34
- "dependencies": {
35
- "fs-extra": "^8.1.0",
36
- "lodash": "^4.17.10",
37
- "prettier": "^1.18.2",
38
- "pug": "^2.0.0-rc.4",
39
- "typescript-ioc": "^1.2.4",
40
- "yargs": "^12.0.1"
41
- },
42
- "devDependencies": {
43
- "@types/fs-extra": "^8.1.1",
44
- "@types/jest": "24.0.15",
45
- "@types/lodash": "^4.14.91",
46
- "@types/node": "^12.6.1",
47
- "@types/prettier": "^1.18.0",
48
- "@types/pug": "^2.0.4",
49
- "@types/yargs": "^11.1.1",
50
- "jest": "^24.8.0",
51
- "ts-jest": "^24.0.2",
52
- "ts-node": "^8.3.0",
53
- "tslint": "^5.18.0",
54
- "typescript": "^4.3.5"
55
- }
56
- }
1
+ {
2
+ "name": "@farris/jit-engine",
3
+ "version": "1.3.303",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "bin": {
7
+ "jit": "./bin/index.js"
8
+ },
9
+ "engines": {
10
+ "node": ">= 6.9.0",
11
+ "npm": ">= 3.0.0"
12
+ },
13
+ "files": [
14
+ "lib/",
15
+ "bin/",
16
+ "ioc.config"
17
+ ],
18
+ "scripts": {
19
+ "build": "npm run build-ts && npm run copy-static-assets",
20
+ "build-q": "npm run build-ts",
21
+ "test": "jest --coverage ",
22
+ "watch-test": "npm run test --watchAll",
23
+ "build-ts": "tsc",
24
+ "tslint": "tslint -c tslint.json -p tsconfig.json",
25
+ "copy-static-assets": "ts-node copyStaticAssets.ts"
26
+ },
27
+ "keywords": [
28
+ "jit",
29
+ "engine",
30
+ "jit-engine"
31
+ ],
32
+ "author": "Noah",
33
+ "license": "ISC",
34
+ "dependencies": {
35
+ "fs-extra": "^8.1.0",
36
+ "lodash": "^4.17.10",
37
+ "prettier": "^1.18.2",
38
+ "pug": "^2.0.0-rc.4",
39
+ "read-package-tree": "^5.3.1",
40
+ "typescript-ioc": "^1.2.4",
41
+ "yargs": "^12.0.1"
42
+ },
43
+ "devDependencies": {
44
+ "@types/fs-extra": "^8.1.1",
45
+ "@types/jest": "24.0.15",
46
+ "@types/lodash": "^4.14.91",
47
+ "@types/node": "^12.6.1",
48
+ "@types/prettier": "^1.18.0",
49
+ "@types/pug": "^2.0.4",
50
+ "@types/yargs": "^11.1.1",
51
+ "jest": "^24.8.0",
52
+ "ts-jest": "^24.0.2",
53
+ "ts-node": "^8.3.0",
54
+ "tslint": "^5.18.0",
55
+ "typescript": "^3.5.3"
56
+ }
57
+ }