lincd-cli 0.2.32 → 0.2.34
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/lib/cli-methods.js +878 -1093
- package/lib/cli.js +28 -28
- package/lib/config-grunt.js +47 -65
- package/lib/config-webpack.js +87 -146
- package/lib/index.js +9 -6
- package/lib/interfaces.js +1 -1
- package/lib/plugins/declaration-plugin.js +40 -51
- package/lib/plugins/externalise-modules.js +15 -40
- package/lib/plugins/watch-run.js +10 -13
- package/lib/utils.js +77 -127
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
exports
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const cli_methods_1 = require("./cli-methods");
|
|
5
5
|
require('require-extensions');
|
|
6
6
|
var program = require('commander');
|
|
7
7
|
var fs = require('fs-extra');
|
|
8
8
|
var path = require('path');
|
|
9
9
|
program
|
|
10
10
|
.command('create-app')
|
|
11
|
-
.action(
|
|
11
|
+
.action((name) => {
|
|
12
12
|
return (0, cli_methods_1.createApp)(name);
|
|
13
13
|
})
|
|
14
14
|
.description('Creates a new folder with all the required files for a LINCD app')
|
|
15
15
|
.argument('<name>', 'the name of your LINCD app. To use spaces, wrap the name in double quotes.');
|
|
16
16
|
program
|
|
17
17
|
.command('create-package')
|
|
18
|
-
.action(
|
|
18
|
+
.action((name, uriBase) => {
|
|
19
19
|
return (0, cli_methods_1.createPackage)(name, uriBase);
|
|
20
20
|
})
|
|
21
21
|
.description('Create a new folder with all the required files for a new LINCD package')
|
|
@@ -23,103 +23,103 @@ program
|
|
|
23
23
|
.argument('[uri_base]', 'The base URL used for data of this package. Leave blank to use the URL of your package on lincd.org after you register it');
|
|
24
24
|
program
|
|
25
25
|
.command('create-shape')
|
|
26
|
-
.action(
|
|
26
|
+
.action((name, uriBase) => {
|
|
27
27
|
return (0, cli_methods_1.createShape)(name);
|
|
28
28
|
})
|
|
29
29
|
.description('Creates a new ShapeClass file for your package. Execute this from your package folder.')
|
|
30
30
|
.argument('<name>', 'The name of the shape. Will be used for the file name and the class name');
|
|
31
31
|
program
|
|
32
32
|
.command('create-component')
|
|
33
|
-
.action(
|
|
33
|
+
.action((name, uriBase) => {
|
|
34
34
|
return (0, cli_methods_1.createComponent)(name);
|
|
35
35
|
})
|
|
36
36
|
.description('Creates a new Component file for your package. Execute this from your package folder.')
|
|
37
37
|
.argument('<name>', 'The name of the component. Will be used for the file name and the export name');
|
|
38
38
|
program
|
|
39
39
|
.command('create-set-component')
|
|
40
|
-
.action(
|
|
40
|
+
.action((name, uriBase) => {
|
|
41
41
|
return (0, cli_methods_1.createSetComponent)(name);
|
|
42
42
|
})
|
|
43
43
|
.description('Creates a new SetComponent file for your package. Execute this from your package folder.')
|
|
44
44
|
.argument('<name>', 'The name of the component. Will be used for the file name and the export name');
|
|
45
45
|
program
|
|
46
46
|
.command('create-ontology')
|
|
47
|
-
.action(
|
|
47
|
+
.action((prefix, uriBase) => {
|
|
48
48
|
return (0, cli_methods_1.createOntology)(prefix, uriBase);
|
|
49
49
|
})
|
|
50
50
|
.description('Creates a new ontology file for your package. Execute this from your package folder.')
|
|
51
51
|
.argument('<suggested-prefix>', 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object')
|
|
52
52
|
.argument('[uribase]', "Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package");
|
|
53
|
-
program.command('app [action]', { hidden: true }).action(
|
|
53
|
+
program.command('app [action]', { hidden: true }).action(() => {
|
|
54
54
|
(0, cli_methods_1.register)('http://localhost:4101');
|
|
55
55
|
});
|
|
56
|
-
program.command('register-local', { hidden: true }).action(
|
|
56
|
+
program.command('register-local', { hidden: true }).action(() => {
|
|
57
57
|
(0, cli_methods_1.register)('http://localhost:4101');
|
|
58
58
|
});
|
|
59
|
-
program.command('register-dev', { hidden: true }).action(
|
|
59
|
+
program.command('register-dev', { hidden: true }).action(() => {
|
|
60
60
|
(0, cli_methods_1.register)('https://dev-registry.lincd.org');
|
|
61
61
|
});
|
|
62
62
|
program
|
|
63
63
|
.command('register')
|
|
64
|
-
.action(
|
|
64
|
+
.action(() => {
|
|
65
65
|
(0, cli_methods_1.register)('https://registry.lincd.org');
|
|
66
66
|
})
|
|
67
67
|
.description('Register (a new version of) this package to the LINCD registry. If successful your package will appear on www.lincd.org');
|
|
68
68
|
program
|
|
69
69
|
.command('info')
|
|
70
|
-
.action(
|
|
70
|
+
.action(() => {
|
|
71
71
|
var ownPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
72
72
|
console.log(ownPackage.version);
|
|
73
73
|
console.log('Running from: ' + __dirname);
|
|
74
74
|
})
|
|
75
75
|
.description("Log the version of this tool and the path that it's running from");
|
|
76
|
-
program.command('build [target] [target2]', { isDefault: true }).action(
|
|
76
|
+
program.command('build [target] [target2]', { isDefault: true }).action((target, target2) => {
|
|
77
77
|
(0, cli_methods_1.buildPackage)(target, target2);
|
|
78
78
|
});
|
|
79
|
-
program.command('build-metadata').action(
|
|
79
|
+
program.command('build-metadata').action(() => {
|
|
80
80
|
(0, cli_methods_1.buildMetadata)();
|
|
81
81
|
});
|
|
82
|
-
program.command('publish-updated').action(
|
|
82
|
+
program.command('publish-updated').action(() => {
|
|
83
83
|
return (0, cli_methods_1.publishUpdated)();
|
|
84
84
|
});
|
|
85
|
-
program.command('publish [version]').action(
|
|
85
|
+
program.command('publish [version]').action((version) => {
|
|
86
86
|
return (0, cli_methods_1.publishPackage)(null, false, null, version);
|
|
87
87
|
});
|
|
88
|
-
program.command('status').action(
|
|
88
|
+
program.command('status').action(() => {
|
|
89
89
|
//log which packages need to be published
|
|
90
|
-
return (0, cli_methods_1.publishUpdated)(true).then(
|
|
90
|
+
return (0, cli_methods_1.publishUpdated)(true).then(() => {
|
|
91
91
|
//log which packages need to be build
|
|
92
92
|
return (0, cli_methods_1.buildUpdated)(undefined, '', '', true);
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
|
-
program.command('build-updated [target] [target2]').action(
|
|
95
|
+
program.command('build-updated [target] [target2]').action((target, target2) => {
|
|
96
96
|
return (0, cli_methods_1.buildUpdated)(1, target, target2);
|
|
97
97
|
});
|
|
98
|
-
program.command('build-updated-since [num-commits-back] [target] [target2]').action(
|
|
98
|
+
program.command('build-updated-since [num-commits-back] [target] [target2]').action((back, target, target2) => {
|
|
99
99
|
return (0, cli_methods_1.buildUpdated)(back, target, target2);
|
|
100
100
|
});
|
|
101
|
-
program.command('build-all [target] [target2] [target3]').action(
|
|
101
|
+
program.command('build-all [target] [target2] [target3]').action((target, target2, target3) => {
|
|
102
102
|
(0, cli_methods_1.buildAll)(target, target2, target3);
|
|
103
103
|
});
|
|
104
|
-
program.command('all [action] [filter] [filter-value]').action(
|
|
104
|
+
program.command('all [action] [filter] [filter-value]').action((command, filter, filterValue) => {
|
|
105
105
|
(0, cli_methods_1.executeCommandForEachPackage)((0, cli_methods_1.getLincdPackages)(), command, filter, filterValue);
|
|
106
106
|
});
|
|
107
107
|
// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {
|
|
108
108
|
// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);
|
|
109
109
|
// });
|
|
110
|
-
program.command('dev [target] [mode]').action(
|
|
110
|
+
program.command('dev [target] [mode]').action((target, mode) => {
|
|
111
111
|
(0, cli_methods_1.developPackage)(target, mode);
|
|
112
112
|
});
|
|
113
113
|
program
|
|
114
114
|
.command('package')
|
|
115
|
-
.action(
|
|
116
|
-
|
|
115
|
+
.action((name, command, args) => {
|
|
116
|
+
let fullCommand = command
|
|
117
117
|
? command +
|
|
118
118
|
' ' +
|
|
119
119
|
' ' +
|
|
120
120
|
args
|
|
121
121
|
.slice(0, 3)
|
|
122
|
-
.filter(
|
|
122
|
+
.filter((a) => a && true)
|
|
123
123
|
.join(' ')
|
|
124
124
|
: null;
|
|
125
125
|
(0, cli_methods_1.executeCommandForPackage)(name, fullCommand);
|
|
@@ -132,7 +132,7 @@ program
|
|
|
132
132
|
.argument('<name>', 'the name of the package. Can be a part of the name.')
|
|
133
133
|
.argument('[command]', 'the lincd command you want to execute. Like dev or build')
|
|
134
134
|
.argument('[args...]', 'the additional arguments of that command');
|
|
135
|
-
program.command('enable-capacitor').action(
|
|
135
|
+
program.command('enable-capacitor').action(() => {
|
|
136
136
|
(0, cli_methods_1.addCapacitor)();
|
|
137
137
|
});
|
|
138
138
|
program.parse(process.argv);
|
package/lib/config-grunt.js
CHANGED
|
@@ -1,42 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
|
-
exports.__esModule = true;
|
|
28
|
-
var config_webpack_1 = require("./config-webpack");
|
|
29
|
-
var utils_1 = require("./utils");
|
|
30
|
-
var fs = require('fs');
|
|
31
|
-
var chalk = require('chalk');
|
|
32
|
-
var path = require('path');
|
|
33
|
-
function generateGruntConfig(moduleName, config) {
|
|
34
|
-
if (config === void 0) { config = {}; }
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_webpack_1 = require("./config-webpack");
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
function generateGruntConfig(moduleName, config = {}) {
|
|
35
9
|
return function (grunt) {
|
|
36
10
|
setupGrunt(grunt, moduleName, config);
|
|
37
11
|
};
|
|
38
12
|
}
|
|
39
|
-
exports
|
|
13
|
+
exports.default = generateGruntConfig;
|
|
40
14
|
function setupGrunt(grunt, moduleName, config) {
|
|
41
15
|
var buildServer = !config.environment || config.environment == 'nodejs' || config.environment == 'polymorphic';
|
|
42
16
|
var buildFrontend = !config.environment || config.environment == 'browser' || config.environment == 'polymorphic';
|
|
@@ -70,17 +44,17 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
70
44
|
//defaults
|
|
71
45
|
grunt.registerTask('default', ['prepare-build', 'concurrent:dev']);
|
|
72
46
|
grunt.registerTask('dev', targetES6 ? ['prepare-build', 'dev-es6'] : ['prepare-build', 'dev-es5']);
|
|
73
|
-
grunt.registerTask('build', targets.map(
|
|
47
|
+
grunt.registerTask('build', targets.map((target) => 'build-' + target));
|
|
74
48
|
if (buildFrontend) {
|
|
75
|
-
grunt.registerTask('build-frontend',
|
|
49
|
+
grunt.registerTask('build-frontend', ['prepare-build', ...targets.map((target) => 'webpack:build-' + target)]);
|
|
76
50
|
}
|
|
77
51
|
grunt.registerTask('build-production', (0, utils_1.flatten)([
|
|
78
52
|
'clean:lib',
|
|
79
53
|
'prepare-build',
|
|
80
|
-
buildFrontend ? targets.map(
|
|
54
|
+
buildFrontend ? targets.map((target) => 'webpack:prod-' + target) : null,
|
|
81
55
|
buildServer ? ['exec:build-lib', 'copy:lib'] : null,
|
|
82
56
|
]));
|
|
83
|
-
|
|
57
|
+
let prepareBuild = ['postcss:cssjson'];
|
|
84
58
|
if (config.beforeBuildCommand) {
|
|
85
59
|
prepareBuild.push('exec:beforeBuildCommand');
|
|
86
60
|
}
|
|
@@ -125,7 +99,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
125
99
|
test: 'tsc -w',
|
|
126
100
|
// shapes: 'lincd shapes',
|
|
127
101
|
'css-declarations': 'tcm -p **/*.scss',
|
|
128
|
-
'postcss-modules': 'yarn postcss --use postcss-import postcss-nested postcss-modules -o build/draft.css -i scss/*'
|
|
102
|
+
'postcss-modules': 'yarn postcss --use postcss-import postcss-nested postcss-modules -o build/draft.css -i scss/*',
|
|
129
103
|
},
|
|
130
104
|
copy: {
|
|
131
105
|
lib: {
|
|
@@ -136,24 +110,24 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
136
110
|
src: ['**/*.json', '**/*.d.ts', '**/*.scss', '**/*.css'],
|
|
137
111
|
dest: 'lib/',
|
|
138
112
|
cwd: 'src/',
|
|
139
|
-
filter: 'isFile'
|
|
113
|
+
filter: 'isFile',
|
|
140
114
|
},
|
|
141
|
-
]
|
|
142
|
-
}
|
|
115
|
+
],
|
|
116
|
+
},
|
|
143
117
|
},
|
|
144
118
|
postcss: {
|
|
145
119
|
options: {
|
|
146
120
|
map: true,
|
|
147
121
|
processors: [require('postcss-modules')({ generateScopedName: utils_1.generateScopedName })],
|
|
148
122
|
syntax: require('postcss-scss'),
|
|
149
|
-
writeDest: false
|
|
123
|
+
writeDest: false,
|
|
150
124
|
},
|
|
151
125
|
cssjson: {
|
|
152
|
-
src: 'src/**/*.scss'
|
|
153
|
-
}
|
|
126
|
+
src: 'src/**/*.scss',
|
|
127
|
+
},
|
|
154
128
|
},
|
|
155
129
|
clean: {
|
|
156
|
-
lib: ['lib/']
|
|
130
|
+
lib: ['lib/'],
|
|
157
131
|
},
|
|
158
132
|
concurrent: {
|
|
159
133
|
dev: (0, utils_1.flatten)([
|
|
@@ -177,48 +151,51 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
177
151
|
options: {
|
|
178
152
|
logConcurrentOutput: true,
|
|
179
153
|
logTaskName: 3,
|
|
180
|
-
logBlacklist: []
|
|
181
|
-
}
|
|
154
|
+
logBlacklist: [],
|
|
155
|
+
},
|
|
182
156
|
},
|
|
183
157
|
webpack: {
|
|
184
158
|
options: {
|
|
185
159
|
stats: {
|
|
186
160
|
chunks: false,
|
|
187
|
-
version: false
|
|
188
|
-
|
|
161
|
+
version: false,
|
|
162
|
+
// warningsFilter: (warning) => {
|
|
163
|
+
// return warning.indexOf('There are multiple modules') !== -1;
|
|
164
|
+
// },
|
|
165
|
+
},
|
|
189
166
|
},
|
|
190
167
|
dev: (0, config_webpack_1.generateWebpackConfig)('dev', moduleName, Object.assign({
|
|
191
168
|
target: 'es6',
|
|
192
|
-
watch: true
|
|
169
|
+
watch: true,
|
|
193
170
|
}, config, config.es6, config.dev)),
|
|
194
171
|
'dev-prod': (0, config_webpack_1.generateWebpackConfig)('dev', moduleName, Object.assign({
|
|
195
172
|
target: 'es6',
|
|
196
173
|
watch: true,
|
|
197
|
-
productionMode: true
|
|
174
|
+
productionMode: true,
|
|
198
175
|
}, config, config.es6, config.prod)),
|
|
199
176
|
'dev-es5': (0, config_webpack_1.generateWebpackConfig)('dev-es5', moduleName, Object.assign({
|
|
200
177
|
target: 'es5',
|
|
201
|
-
watch: true
|
|
178
|
+
watch: true,
|
|
202
179
|
}, config, config.es5, config.dev)),
|
|
203
180
|
'build-es6': (0, config_webpack_1.generateWebpackConfig)('build-es6', moduleName, Object.assign({
|
|
204
181
|
target: 'es6',
|
|
205
|
-
watch: false
|
|
182
|
+
watch: false,
|
|
206
183
|
}, config, config.es6, config.dev)),
|
|
207
184
|
'build-es5': (0, config_webpack_1.generateWebpackConfig)('build-es5', moduleName, Object.assign({
|
|
208
185
|
target: 'es5',
|
|
209
|
-
watch: false
|
|
186
|
+
watch: false,
|
|
210
187
|
}, config, config.es5, config.dev)),
|
|
211
188
|
'prod-es5': (0, config_webpack_1.generateWebpackConfig)('prod-es5', moduleName, Object.assign({
|
|
212
189
|
target: 'es5',
|
|
213
190
|
watch: false,
|
|
214
|
-
productionMode: true
|
|
191
|
+
productionMode: true,
|
|
215
192
|
}, config, config.es5, config.prod)),
|
|
216
193
|
'prod-es6': (0, config_webpack_1.generateWebpackConfig)('prod-es6', moduleName, Object.assign({
|
|
217
194
|
target: 'es6',
|
|
218
195
|
watch: false,
|
|
219
|
-
productionMode: true
|
|
220
|
-
}, config, config.es6, config.prod))
|
|
221
|
-
}
|
|
196
|
+
productionMode: true,
|
|
197
|
+
}, config, config.es6, config.prod)),
|
|
198
|
+
},
|
|
222
199
|
});
|
|
223
200
|
//load the npm grunt task modules
|
|
224
201
|
[
|
|
@@ -228,12 +205,12 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
228
205
|
'grunt-contrib-clean',
|
|
229
206
|
'grunt-contrib-copy',
|
|
230
207
|
'@lodder/grunt-postcss',
|
|
231
|
-
].forEach(
|
|
208
|
+
].forEach((taskName) => {
|
|
232
209
|
(0, utils_1.debug)(config, 'loading grunt task ' + taskName);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
210
|
+
let localPath = path.resolve(__dirname, '..', 'node_modules', taskName, 'tasks');
|
|
211
|
+
let localPath2 = path.resolve(__dirname, '..', '..', 'node_modules', taskName, 'tasks');
|
|
212
|
+
let workspacePath = path.resolve(__dirname, '..', '..', '..', 'node_modules', taskName, 'tasks');
|
|
213
|
+
let nestedWorkspacePath = path.resolve(__dirname, '..', '..', '..', '..', 'node_modules', taskName, 'tasks');
|
|
237
214
|
if (fs.existsSync(localPath)) {
|
|
238
215
|
// grunt.loadNpmTasks(taskName);
|
|
239
216
|
(0, utils_1.debug)('Loading from ' + localPath);
|
|
@@ -255,7 +232,12 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
255
232
|
grunt.task.loadTasks(nestedWorkspacePath);
|
|
256
233
|
}
|
|
257
234
|
else {
|
|
258
|
-
(0, utils_1.warn)(
|
|
235
|
+
(0, utils_1.warn)(`Could not load grunt task module ${taskName}
|
|
236
|
+
Could not find task at any of these paths:
|
|
237
|
+
${localPath}
|
|
238
|
+
${localPath2}
|
|
239
|
+
${workspacePath}
|
|
240
|
+
${nestedWorkspacePath}`);
|
|
259
241
|
}
|
|
260
242
|
});
|
|
261
243
|
}
|