lincd-cli 0.2.53 → 0.2.57
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 +13 -70
- package/lib/cli.js +3 -0
- package/lib/config-grunt.js +12 -5
- package/lib/plugins/check-imports.js +4 -4
- package/package.json +1 -1
package/lib/cli-methods.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.executeCommandForPackage = exports.addCapacitor = exports.addLinesToFile = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.buildPackage = exports.register = exports.createPackage = exports.depCheck = exports.createComponent = exports.createSetComponent = exports.createShape = exports.setNameVariables = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.warn = exports.createApp = void 0;
|
|
15
|
+
exports.executeCommandForPackage = exports.addCapacitor = exports.addLinesToFile = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.buildPackage = exports.register = exports.createPackage = exports.depCheck = exports.checkImports = exports.createComponent = exports.createSetComponent = exports.createShape = exports.setNameVariables = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.warn = exports.createApp = void 0;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
18
|
const utils_1 = require("./utils");
|
|
@@ -385,7 +385,8 @@ function buildAll(options) {
|
|
|
385
385
|
// (target ? ' ' + target : '') +
|
|
386
386
|
// (target2 ? ' ' + target2 : ''),
|
|
387
387
|
false, false, {}, false);
|
|
388
|
-
|
|
388
|
+
log(chalk_1.default.cyan('Building ' + pkg.packageName));
|
|
389
|
+
process.stdout.write(packagesLeft + ' packages left\r');
|
|
389
390
|
}
|
|
390
391
|
return command
|
|
391
392
|
.catch(({ error, stdout, stderr }) => {
|
|
@@ -741,6 +742,14 @@ const createComponent = (name, basePath = process.cwd()) => __awaiter(void 0, vo
|
|
|
741
742
|
}
|
|
742
743
|
});
|
|
743
744
|
exports.createComponent = createComponent;
|
|
745
|
+
const checkImports = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
746
|
+
//read the source of all ts/tsx files in the src folder
|
|
747
|
+
//if there is an import that imports a lincd package with /src/ in it, then warn
|
|
748
|
+
//if there is an import that imports outside of the src folder, then warn
|
|
749
|
+
//TODO: use dependency-cruiser for this
|
|
750
|
+
//https://github.com/sverweij/dependency-cruiser/blob/HEAD/doc/api.md
|
|
751
|
+
});
|
|
752
|
+
exports.checkImports = checkImports;
|
|
744
753
|
const depCheck = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
745
754
|
(0, depcheck_1.default)(process.cwd(), {}, (results) => {
|
|
746
755
|
if (results.missing) {
|
|
@@ -1268,8 +1277,6 @@ var buildUpdated = function (back, target, target2, test = false) {
|
|
|
1268
1277
|
if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated) {
|
|
1269
1278
|
needRebuild = true;
|
|
1270
1279
|
}
|
|
1271
|
-
// console.log(pkg.path,lastModifiedSource.lastModifiedTime,lastModifiedBundle.lastModifiedTime);
|
|
1272
|
-
// console.log(pkg.path,new Date(lastModifiedSource.lastModified).toString(),new Date(lastModifiedBundle.lastModified).toString());
|
|
1273
1280
|
if (needRebuild || rebuildAllModules) {
|
|
1274
1281
|
//TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
|
|
1275
1282
|
// log(packageName+' modified since last commit on '+now.toString());
|
|
@@ -1312,70 +1319,6 @@ var buildUpdated = function (back, target, target2, test = false) {
|
|
|
1312
1319
|
}
|
|
1313
1320
|
});
|
|
1314
1321
|
return;
|
|
1315
|
-
var p = Promise.resolve('');
|
|
1316
|
-
packages.forEach((pkg) => {
|
|
1317
|
-
let packageName = pkg.packageName;
|
|
1318
|
-
p = p
|
|
1319
|
-
.then((previousResult) => {
|
|
1320
|
-
let lastModifiedSource = getLastModifiedSourceTime(pkg.path);
|
|
1321
|
-
let lastModifiedBundle = getLastBuildTime(pkg.path);
|
|
1322
|
-
// console.log(pkg.path,lastModifiedSource.lastModifiedTime,lastModifiedBundle.lastModifiedTime);
|
|
1323
|
-
// console.log(pkg.path,new Date(lastModifiedSource.lastModified).toString(),new Date(lastModifiedBundle.lastModified).toString());
|
|
1324
|
-
debugInfo('# Checking package ' + packageName);
|
|
1325
|
-
if (lastModifiedSource.lastModifiedTime >
|
|
1326
|
-
lastModifiedBundle.lastModifiedTime) {
|
|
1327
|
-
//TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
|
|
1328
|
-
// log(packageName+' modified since last commit on '+now.toString());
|
|
1329
|
-
debugInfo(chalk_1.default.cyan('Last modified source: ' +
|
|
1330
|
-
lastModifiedSource.lastModifiedName +
|
|
1331
|
-
' on ' +
|
|
1332
|
-
lastModifiedSource.lastModified.toString()));
|
|
1333
|
-
debugInfo(chalk_1.default.cyan('Last build: ' +
|
|
1334
|
-
(lastModifiedBundle &&
|
|
1335
|
-
typeof lastModifiedBundle.lastModified !== 'undefined'
|
|
1336
|
-
? lastModifiedBundle.lastModified.toString()
|
|
1337
|
-
: 'never')));
|
|
1338
|
-
if (test) {
|
|
1339
|
-
debugInfo('need to build ' + packageName);
|
|
1340
|
-
}
|
|
1341
|
-
else {
|
|
1342
|
-
log('building ' + packageName);
|
|
1343
|
-
}
|
|
1344
|
-
if (!test) {
|
|
1345
|
-
return (0, utils_1.execPromise)('cd ' +
|
|
1346
|
-
pkg.path +
|
|
1347
|
-
' && yarn build' +
|
|
1348
|
-
(target ? ' ' + target : '') +
|
|
1349
|
-
(target2 ? ' ' + target2 : '')).then((res) => {
|
|
1350
|
-
if (res.indexOf('Aborted due to warnings') !== -1 ||
|
|
1351
|
-
res.indexOf('Fatal error') !== -1) {
|
|
1352
|
-
console.log(res);
|
|
1353
|
-
return (previousResult + ' ' + chalk_1.default.red(packageName + ' failed\n'));
|
|
1354
|
-
}
|
|
1355
|
-
console.log(chalk_1.default.green(packageName + ' successfully built'));
|
|
1356
|
-
return (previousResult + ' ' + chalk_1.default.green(packageName + ' built\n'));
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
return (previousResult +
|
|
1360
|
-
' ' +
|
|
1361
|
-
chalk_1.default.blue(packageName + ' should be build\n'));
|
|
1362
|
-
}
|
|
1363
|
-
return previousResult;
|
|
1364
|
-
})
|
|
1365
|
-
.catch(({ error, stdout, stderr }) => {
|
|
1366
|
-
console.log(stdout);
|
|
1367
|
-
return previousResult + ' ' + chalk_1.default.red(packageName + ' failed\n');
|
|
1368
|
-
});
|
|
1369
|
-
});
|
|
1370
|
-
return p.then((messages) => {
|
|
1371
|
-
if (messages == '') {
|
|
1372
|
-
console.log(chalk_1.default.green('Nothing to rebuild.'));
|
|
1373
|
-
}
|
|
1374
|
-
else {
|
|
1375
|
-
console.log('Summary: \n' + messages);
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
// });
|
|
1379
1322
|
});
|
|
1380
1323
|
};
|
|
1381
1324
|
exports.buildUpdated = buildUpdated;
|
|
@@ -1384,11 +1327,11 @@ const needsRebuilding = function (pkg, log = false) {
|
|
|
1384
1327
|
let lastModifiedBundle = getLastBuildTime(pkg.path);
|
|
1385
1328
|
let result = lastModifiedSource.lastModifiedTime > lastModifiedBundle.lastModifiedTime;
|
|
1386
1329
|
if (log) {
|
|
1387
|
-
|
|
1330
|
+
console.log(chalk_1.default.cyan('Last modified source: ' +
|
|
1388
1331
|
lastModifiedSource.lastModifiedName +
|
|
1389
1332
|
' on ' +
|
|
1390
1333
|
lastModifiedSource.lastModified.toString()));
|
|
1391
|
-
|
|
1334
|
+
console.log(chalk_1.default.cyan('Last build: ' +
|
|
1392
1335
|
(lastModifiedBundle &&
|
|
1393
1336
|
typeof lastModifiedBundle.lastModified !== 'undefined'
|
|
1394
1337
|
? lastModifiedBundle.lastModified.toString()
|
package/lib/cli.js
CHANGED
|
@@ -126,6 +126,9 @@ program.command('dev [target] [mode]').action((target, mode) => {
|
|
|
126
126
|
program.command('depcheck').action((target, mode) => {
|
|
127
127
|
(0, cli_methods_1.depCheck)();
|
|
128
128
|
});
|
|
129
|
+
program.command('check-imports').action((target, mode) => {
|
|
130
|
+
(0, cli_methods_1.checkImports)();
|
|
131
|
+
});
|
|
129
132
|
program
|
|
130
133
|
.command('package')
|
|
131
134
|
.action((name, command, args) => {
|
package/lib/config-grunt.js
CHANGED
|
@@ -85,9 +85,15 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
85
85
|
]));
|
|
86
86
|
grunt.registerTask('build-es6', (0, utils_1.flatten)([
|
|
87
87
|
'prepare-build',
|
|
88
|
-
buildFrontend ? 'webpack:build-es6' : null,
|
|
88
|
+
// buildFrontend ? 'webpack:build-es6' : null,
|
|
89
89
|
buildServer
|
|
90
|
-
? [
|
|
90
|
+
? [
|
|
91
|
+
'clean:lib',
|
|
92
|
+
'exec:build-lib',
|
|
93
|
+
'copy:lib',
|
|
94
|
+
'exec:depcheck',
|
|
95
|
+
'exec:check-imports',
|
|
96
|
+
]
|
|
91
97
|
: null,
|
|
92
98
|
// 'exec:shapes',
|
|
93
99
|
]));
|
|
@@ -114,6 +120,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
114
120
|
beforeBuildCommand: config.beforeBuildCommand,
|
|
115
121
|
'server-dev': 'tsc -w',
|
|
116
122
|
depcheck: 'yarn lincd depcheck',
|
|
123
|
+
'check-imports': 'yarn lincd check-imports',
|
|
117
124
|
test: 'tsc -w',
|
|
118
125
|
// shapes: 'lincd shapes',
|
|
119
126
|
'css-declarations': 'tcm -p **/*.scss',
|
|
@@ -149,19 +156,19 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
149
156
|
},
|
|
150
157
|
concurrent: {
|
|
151
158
|
dev: (0, utils_1.flatten)([
|
|
152
|
-
buildFrontend ? 'webpack:dev' : null,
|
|
159
|
+
// buildFrontend ? 'webpack:dev' : null,
|
|
153
160
|
buildServer ? 'exec:server-dev' : null,
|
|
154
161
|
// buildServer ? 'watch:css-module-transforms' : null,
|
|
155
162
|
// 'exec:css-declarations-watch'
|
|
156
163
|
]),
|
|
157
164
|
'dev-prod': (0, utils_1.flatten)([
|
|
158
|
-
buildFrontend ? 'webpack:dev-prod' : null,
|
|
165
|
+
// buildFrontend ? 'webpack:dev-prod' : null,
|
|
159
166
|
buildServer ? 'exec:server-dev' : null,
|
|
160
167
|
// buildServer ? 'watch:css-module-transforms' : null,
|
|
161
168
|
// 'exec:css-declarations-watch'
|
|
162
169
|
]),
|
|
163
170
|
'dev-es5': (0, utils_1.flatten)([
|
|
164
|
-
buildFrontend ? 'webpack:dev-es5' : null,
|
|
171
|
+
// buildFrontend ? 'webpack:dev-es5' : null,
|
|
165
172
|
buildServer ? 'exec:server-dev' : null,
|
|
166
173
|
// buildServer ? 'watch:css-module-transforms' : null,
|
|
167
174
|
// 'exec:css-declarations-watch'
|
|
@@ -34,15 +34,15 @@ function handler(source) {
|
|
|
34
34
|
//save as userRequest?
|
|
35
35
|
let resource = this._module.resource;
|
|
36
36
|
let relativePath = this._module.resourceResolveData.relativePath;
|
|
37
|
-
|
|
37
|
+
console.log('-----');
|
|
38
38
|
// for (let key in this) {
|
|
39
39
|
// console.log(key, this[key]);
|
|
40
40
|
// }
|
|
41
41
|
let isRelativeReq = request.indexOf('./') === 0 || request.indexOf('../') === 0;
|
|
42
42
|
// if (isRelativeReq) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
console.log('rootContext', rootContext);
|
|
44
|
+
console.log('context', context);
|
|
45
|
+
console.log('request', request);
|
|
46
46
|
// // console.log('userRequest', userRequest);
|
|
47
47
|
// // console.log('resource', resource);
|
|
48
48
|
// console.log('relativePath', relativePath);
|