@ixon-cdk/core 1.2.0-next.0 → 1.2.0-next.2
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/meta-files.js +5 -6
- package/package.json +6 -6
- package/template/template.service.js +22 -0
- package/utils.js +14 -9
package/meta-files.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const { globSync } = require('glob');
|
|
3
4
|
const { debounce, uniq } = require('lodash');
|
|
4
5
|
const rimraf = require('rimraf');
|
|
5
6
|
|
|
@@ -23,12 +24,10 @@ module.exports = {
|
|
|
23
24
|
);
|
|
24
25
|
paths.forEach((_path) => {
|
|
25
26
|
const globFilePath = _path.replaceAll('\\', '/');
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_copyFileNameFromToSync(fileName, inputDir, outputDir);
|
|
31
|
-
});
|
|
27
|
+
globSync(globFilePath).forEach(file => {
|
|
28
|
+
const fileName = file.slice(inputDir.length + 1);
|
|
29
|
+
_copyFileNameFromToSync(fileName, inputDir, outputDir);
|
|
30
|
+
});
|
|
32
31
|
});
|
|
33
32
|
},
|
|
34
33
|
watchAssets(assets, inputDir, outputDir) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixon-cdk/core",
|
|
3
|
-
"version": "1.2.0-next.
|
|
3
|
+
"version": "1.2.0-next.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "",
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"app-root-dir": "^1.0.2",
|
|
10
10
|
"archiver": "^5.3.1",
|
|
11
|
-
"axios": "^
|
|
11
|
+
"axios": "^1.3.4",
|
|
12
12
|
"chalk": "^4.1.2",
|
|
13
13
|
"chokidar": "^3.5.3",
|
|
14
14
|
"cors": "^2.8.5",
|
|
15
15
|
"crypto-js": "^4.1.1",
|
|
16
|
-
"express": "^4.
|
|
17
|
-
"glob": "^
|
|
16
|
+
"express": "^4.18.2",
|
|
17
|
+
"glob": "^9.2.1",
|
|
18
18
|
"livereload": "^0.9.3",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
20
|
"opener": "^1.5.2",
|
|
21
21
|
"prompts": "^2.4.2",
|
|
22
|
-
"rimraf": "^3.
|
|
23
|
-
"yargs": "^17.
|
|
22
|
+
"rimraf": "^4.3.1",
|
|
23
|
+
"yargs": "^17.7.1"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -184,6 +184,11 @@ module.exports = class TemplateService {
|
|
|
184
184
|
if (_result) {
|
|
185
185
|
variantIdx = _result.variantIdx;
|
|
186
186
|
}
|
|
187
|
+
|
|
188
|
+
if (variantIdx === undefined) {
|
|
189
|
+
logErrorMessage("No variant selected");
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
187
192
|
}
|
|
188
193
|
|
|
189
194
|
schema = this._interpolateSchema(schema, context);
|
|
@@ -194,6 +199,23 @@ module.exports = class TemplateService {
|
|
|
194
199
|
moduleNames.forEach((name) => ensureModule(name));
|
|
195
200
|
}
|
|
196
201
|
|
|
202
|
+
// optionally install types
|
|
203
|
+
if (/typescript/i.test(schema.variants[variantIdx].name)) {
|
|
204
|
+
ensureModule('@ixon-cdk/types');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// install dependencies
|
|
208
|
+
if (variantIdx !== null) {
|
|
209
|
+
const deps = schema.variants[variantIdx].dependencies;
|
|
210
|
+
const devDeps = schema.variants[variantIdx].devDependencies;
|
|
211
|
+
if (!!deps) {
|
|
212
|
+
Object.keys(deps).forEach(name => ensureModule(name, deps[name], false));
|
|
213
|
+
}
|
|
214
|
+
if (!!devDeps) {
|
|
215
|
+
Object.keys(devDeps).forEach(name => ensureModule(name, devDeps[name]));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
197
219
|
const componentRoot = this._configSrv.getNewComponentRoot();
|
|
198
220
|
|
|
199
221
|
schema.files.forEach((file) => {
|
package/utils.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const chalk = require('chalk');
|
|
4
|
+
const { globSync } = require('glob');
|
|
4
5
|
const flow = require('lodash/flow');
|
|
5
6
|
const camelCase = require('lodash/camelCase');
|
|
6
7
|
const upperFirst = require('lodash/upperFirst');
|
|
7
8
|
|
|
9
|
+
function dirContains(dir, globPattern) {
|
|
10
|
+
const files = globSync(path.join(dir, globPattern));
|
|
11
|
+
return !!files.length;
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
function getArgv() {
|
|
9
15
|
const remain = process.argv.slice(2);
|
|
10
16
|
const { argv } = require('yargs/yargs')(remain).version(false);
|
|
@@ -45,19 +51,17 @@ function moduleExists(moduleName) {
|
|
|
45
51
|
return exists;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
|
-
function ensureModule(moduleName) {
|
|
49
|
-
if (!moduleName.startsWith('@ixon-cdk/')) {
|
|
50
|
-
logErrorMessage('Cannot install this module.');
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
54
|
+
function ensureModule(moduleName, moduleVersion = null, dev = true) {
|
|
53
55
|
if (!moduleExists(moduleName)) {
|
|
54
|
-
console.log(`Installing package '${moduleName}'...`);
|
|
55
56
|
if (moduleName.startsWith('@ixon-cdk/')) {
|
|
56
57
|
const cdkVersion = require('./package.json').version;
|
|
57
|
-
|
|
58
|
-
} else {
|
|
59
|
-
require('child_process').execSync(`npm install --save-dev ${moduleName}`);
|
|
58
|
+
moduleVersion = cdkVersion;
|
|
60
59
|
}
|
|
60
|
+
const v = !!moduleVersion ? '@' + moduleVersion : '';
|
|
61
|
+
console.log(`Installing package '${moduleName}${v}...`);
|
|
62
|
+
require('child_process').execSync(
|
|
63
|
+
`npm install --save${dev ? '-dev' : ''} ${moduleName}${v}`,
|
|
64
|
+
);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -122,6 +126,7 @@ async function getFiles(dir) {
|
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
module.exports = {
|
|
129
|
+
dirContains,
|
|
125
130
|
getArgv,
|
|
126
131
|
getRootDir,
|
|
127
132
|
logErrorMessage,
|