lincd-cli 0.2.54 → 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 +11 -69
- package/lib/cli.js +3 -0
- package/lib/config-grunt.js +11 -4
- 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");
|
|
@@ -742,6 +742,14 @@ const createComponent = (name, basePath = process.cwd()) => __awaiter(void 0, vo
|
|
|
742
742
|
}
|
|
743
743
|
});
|
|
744
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;
|
|
745
753
|
const depCheck = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
746
754
|
(0, depcheck_1.default)(process.cwd(), {}, (results) => {
|
|
747
755
|
if (results.missing) {
|
|
@@ -1269,8 +1277,6 @@ var buildUpdated = function (back, target, target2, test = false) {
|
|
|
1269
1277
|
if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated) {
|
|
1270
1278
|
needRebuild = true;
|
|
1271
1279
|
}
|
|
1272
|
-
// console.log(pkg.path,lastModifiedSource.lastModifiedTime,lastModifiedBundle.lastModifiedTime);
|
|
1273
|
-
// console.log(pkg.path,new Date(lastModifiedSource.lastModified).toString(),new Date(lastModifiedBundle.lastModified).toString());
|
|
1274
1280
|
if (needRebuild || rebuildAllModules) {
|
|
1275
1281
|
//TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
|
|
1276
1282
|
// log(packageName+' modified since last commit on '+now.toString());
|
|
@@ -1313,70 +1319,6 @@ var buildUpdated = function (back, target, target2, test = false) {
|
|
|
1313
1319
|
}
|
|
1314
1320
|
});
|
|
1315
1321
|
return;
|
|
1316
|
-
var p = Promise.resolve('');
|
|
1317
|
-
packages.forEach((pkg) => {
|
|
1318
|
-
let packageName = pkg.packageName;
|
|
1319
|
-
p = p
|
|
1320
|
-
.then((previousResult) => {
|
|
1321
|
-
let lastModifiedSource = getLastModifiedSourceTime(pkg.path);
|
|
1322
|
-
let lastModifiedBundle = getLastBuildTime(pkg.path);
|
|
1323
|
-
// console.log(pkg.path,lastModifiedSource.lastModifiedTime,lastModifiedBundle.lastModifiedTime);
|
|
1324
|
-
// console.log(pkg.path,new Date(lastModifiedSource.lastModified).toString(),new Date(lastModifiedBundle.lastModified).toString());
|
|
1325
|
-
debugInfo('# Checking package ' + packageName);
|
|
1326
|
-
if (lastModifiedSource.lastModifiedTime >
|
|
1327
|
-
lastModifiedBundle.lastModifiedTime) {
|
|
1328
|
-
//TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
|
|
1329
|
-
// log(packageName+' modified since last commit on '+now.toString());
|
|
1330
|
-
debugInfo(chalk_1.default.cyan('Last modified source: ' +
|
|
1331
|
-
lastModifiedSource.lastModifiedName +
|
|
1332
|
-
' on ' +
|
|
1333
|
-
lastModifiedSource.lastModified.toString()));
|
|
1334
|
-
debugInfo(chalk_1.default.cyan('Last build: ' +
|
|
1335
|
-
(lastModifiedBundle &&
|
|
1336
|
-
typeof lastModifiedBundle.lastModified !== 'undefined'
|
|
1337
|
-
? lastModifiedBundle.lastModified.toString()
|
|
1338
|
-
: 'never')));
|
|
1339
|
-
if (test) {
|
|
1340
|
-
debugInfo('need to build ' + packageName);
|
|
1341
|
-
}
|
|
1342
|
-
else {
|
|
1343
|
-
log('building ' + packageName);
|
|
1344
|
-
}
|
|
1345
|
-
if (!test) {
|
|
1346
|
-
return (0, utils_1.execPromise)('cd ' +
|
|
1347
|
-
pkg.path +
|
|
1348
|
-
' && yarn build' +
|
|
1349
|
-
(target ? ' ' + target : '') +
|
|
1350
|
-
(target2 ? ' ' + target2 : '')).then((res) => {
|
|
1351
|
-
if (res.indexOf('Aborted due to warnings') !== -1 ||
|
|
1352
|
-
res.indexOf('Fatal error') !== -1) {
|
|
1353
|
-
console.log(res);
|
|
1354
|
-
return (previousResult + ' ' + chalk_1.default.red(packageName + ' failed\n'));
|
|
1355
|
-
}
|
|
1356
|
-
console.log(chalk_1.default.green(packageName + ' successfully built'));
|
|
1357
|
-
return (previousResult + ' ' + chalk_1.default.green(packageName + ' built\n'));
|
|
1358
|
-
});
|
|
1359
|
-
}
|
|
1360
|
-
return (previousResult +
|
|
1361
|
-
' ' +
|
|
1362
|
-
chalk_1.default.blue(packageName + ' should be build\n'));
|
|
1363
|
-
}
|
|
1364
|
-
return previousResult;
|
|
1365
|
-
})
|
|
1366
|
-
.catch(({ error, stdout, stderr }) => {
|
|
1367
|
-
console.log(stdout);
|
|
1368
|
-
return previousResult + ' ' + chalk_1.default.red(packageName + ' failed\n');
|
|
1369
|
-
});
|
|
1370
|
-
});
|
|
1371
|
-
return p.then((messages) => {
|
|
1372
|
-
if (messages == '') {
|
|
1373
|
-
console.log(chalk_1.default.green('Nothing to rebuild.'));
|
|
1374
|
-
}
|
|
1375
|
-
else {
|
|
1376
|
-
console.log('Summary: \n' + messages);
|
|
1377
|
-
}
|
|
1378
|
-
});
|
|
1379
|
-
// });
|
|
1380
1322
|
});
|
|
1381
1323
|
};
|
|
1382
1324
|
exports.buildUpdated = buildUpdated;
|
|
@@ -1385,11 +1327,11 @@ const needsRebuilding = function (pkg, log = false) {
|
|
|
1385
1327
|
let lastModifiedBundle = getLastBuildTime(pkg.path);
|
|
1386
1328
|
let result = lastModifiedSource.lastModifiedTime > lastModifiedBundle.lastModifiedTime;
|
|
1387
1329
|
if (log) {
|
|
1388
|
-
|
|
1330
|
+
console.log(chalk_1.default.cyan('Last modified source: ' +
|
|
1389
1331
|
lastModifiedSource.lastModifiedName +
|
|
1390
1332
|
' on ' +
|
|
1391
1333
|
lastModifiedSource.lastModified.toString()));
|
|
1392
|
-
|
|
1334
|
+
console.log(chalk_1.default.cyan('Last build: ' +
|
|
1393
1335
|
(lastModifiedBundle &&
|
|
1394
1336
|
typeof lastModifiedBundle.lastModified !== 'undefined'
|
|
1395
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
|
@@ -87,7 +87,13 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
87
87
|
'prepare-build',
|
|
88
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);
|