lincd-cli 0.1.24 → 0.2.0
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/defaults/app/package.json +1 -1
- package/defaults/app-with-backend/.gitignore +4 -0
- package/defaults/app-with-backend/package.json +2 -3
- package/defaults/{module → package}/.npmignore +0 -0
- package/defaults/{module → package}/Gruntfile.js +1 -1
- package/defaults/{module → package}/package.json +2 -2
- package/defaults/{module → package}/src/components/ExampleComponent.tsx +0 -0
- package/defaults/{module → package}/src/data/example-ontology.json +0 -0
- package/defaults/{module → package}/src/data/example-ontology.json.d.ts +0 -0
- package/defaults/{module → package}/src/index.ts +0 -0
- package/defaults/{module → package}/src/ontologies/example-ontology.ts +0 -0
- package/defaults/{module → package}/src/package.ts +1 -1
- package/defaults/{module → package}/src/shapes/ExampleShapeClass.ts +0 -0
- package/defaults/{module → package}/tsconfig-es5.json +0 -0
- package/defaults/{module → package}/tsconfig.json +0 -0
- package/lib/cli.js +127 -128
- package/package.json +2 -2
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@babel/preset-react": "^7.18.6",
|
|
38
38
|
"@babel/preset-typescript": "^7.18.6",
|
|
39
39
|
"@babel/register": "^7.18.9",
|
|
40
|
-
"lincd": "^0.
|
|
40
|
+
"lincd": "^0.4",
|
|
41
41
|
"lincd-jsonld": "^0.1.5",
|
|
42
42
|
"lincd-server": "^0.1",
|
|
43
43
|
"react": "^18.2",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"@types/react-dom": "^18.0.6",
|
|
51
51
|
"env-cmd": "^10.1.0",
|
|
52
52
|
"lincd-cli": "^0.1",
|
|
53
|
-
"nodemon": "^2.0.6"
|
|
54
|
-
"ts-loader": "^9.4.1"
|
|
53
|
+
"nodemon": "^2.0.6"
|
|
55
54
|
}
|
|
56
55
|
}
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "${
|
|
2
|
+
"name": "${package_name}",
|
|
3
3
|
"description": "",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"web3"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"lincd": "^0.
|
|
32
|
+
"lincd": "^0.4",
|
|
33
33
|
"lincd-jsonld": "^0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import {linkedPackage} from 'lincd/lib/utils/Module';
|
|
2
2
|
|
|
3
3
|
export const {linkedComponent, linkedComponentClass, linkedShape, linkedUtil, linkedOntology, registerPackageModule, registerPackageExport, packageExports} =
|
|
4
|
-
linkedPackage('${
|
|
4
|
+
linkedPackage('${package_name}');
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/cli.js
CHANGED
|
@@ -81,9 +81,9 @@ program
|
|
|
81
81
|
.description('Creates a new folder with all the required files for a LINCD app')
|
|
82
82
|
.argument('<name>', 'the name of your LINCD app. To use spaces, wrap the name in double quotes.');
|
|
83
83
|
program
|
|
84
|
-
.command('create-
|
|
84
|
+
.command('create-package')
|
|
85
85
|
.action(function (name, uriBase) {
|
|
86
|
-
return
|
|
86
|
+
return createPackage(name, uriBase);
|
|
87
87
|
})
|
|
88
88
|
.description('Create a new folder with all the required files for a new LINCD package')
|
|
89
89
|
.argument('<name>', 'The name of the package. Will be used as package name in package.json')
|
|
@@ -131,7 +131,7 @@ program
|
|
|
131
131
|
})
|
|
132
132
|
.description("Log the version of this tool and the path that it's running from");
|
|
133
133
|
program.command('build [target] [target2]', { isDefault: true }).action(function (target, target2) {
|
|
134
|
-
|
|
134
|
+
buildPackage(target, target2);
|
|
135
135
|
});
|
|
136
136
|
program.command('publish-updated').action(function () {
|
|
137
137
|
return publishUpdated();
|
|
@@ -153,16 +153,16 @@ program.command('build-all [target] [target2]').action(function (target, target2
|
|
|
153
153
|
buildAll(target, target2);
|
|
154
154
|
});
|
|
155
155
|
program.command('all [action] [filter] [filter-value]').action(function (command, filter, filterValue) {
|
|
156
|
-
|
|
156
|
+
executeCommandForEachPackage(getLincdPackages(), command, filter, filterValue);
|
|
157
157
|
});
|
|
158
158
|
// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {
|
|
159
159
|
// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);
|
|
160
160
|
// });
|
|
161
161
|
program.command('dev [target] [mode]').action(function (target, mode) {
|
|
162
|
-
|
|
162
|
+
developPackage(target, mode);
|
|
163
163
|
});
|
|
164
164
|
program
|
|
165
|
-
.command('module|m|package|p')
|
|
165
|
+
.command('module|m|package|p|pkg')
|
|
166
166
|
.action(function (name, command, args) {
|
|
167
167
|
var fullCommand = command
|
|
168
168
|
? command +
|
|
@@ -173,7 +173,7 @@ program
|
|
|
173
173
|
.filter(function (a) { return a && true; })
|
|
174
174
|
.join(' ')
|
|
175
175
|
: null;
|
|
176
|
-
|
|
176
|
+
executeCommandForPackage(name, fullCommand);
|
|
177
177
|
})
|
|
178
178
|
.alias('m')
|
|
179
179
|
.description('Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)')
|
|
@@ -229,7 +229,7 @@ function warn() {
|
|
|
229
229
|
// console.log(chalk.red(message));
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function developPackage(target, mode) {
|
|
233
233
|
if (!target)
|
|
234
234
|
target = 'es6';
|
|
235
235
|
if (mode !== 'production')
|
|
@@ -261,29 +261,28 @@ function checkWorkspaces(rootPath, workspaces, res) {
|
|
|
261
261
|
var folders = fs.readdirSync(workspacePath);
|
|
262
262
|
folders.forEach(function (folder) {
|
|
263
263
|
if (folder !== './' && folder !== '../') {
|
|
264
|
-
|
|
264
|
+
checkPackagePath(rootPath, path.join(workspacePath, folder), res);
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
else {
|
|
270
|
-
|
|
270
|
+
checkPackagePath(rootPath, workspacePath, res);
|
|
271
271
|
}
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
var
|
|
274
|
+
function checkPackagePath(rootPath, packagePath, res) {
|
|
275
|
+
var packageJsonPath = path.join(packagePath, 'package.json');
|
|
276
276
|
// console.log('checking '+packagePath);
|
|
277
|
-
if (fs.existsSync(
|
|
278
|
-
var pack = JSON.parse(fs.readFileSync(
|
|
277
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
278
|
+
var pack = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
279
279
|
//some packages are not true lincd packages, but we still want them to be re-built automatically. This is what lincd_util is for
|
|
280
280
|
if (pack && pack.workspaces) {
|
|
281
|
-
checkWorkspaces(
|
|
281
|
+
checkWorkspaces(packagePath, pack.workspaces, res);
|
|
282
282
|
}
|
|
283
283
|
else if (pack && pack.lincd === true) {
|
|
284
284
|
res.push({
|
|
285
|
-
path:
|
|
286
|
-
moduleName: pack.name,
|
|
285
|
+
path: packagePath,
|
|
287
286
|
packageName: pack.name
|
|
288
287
|
});
|
|
289
288
|
}
|
|
@@ -293,28 +292,28 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
|
|
|
293
292
|
var _this = this;
|
|
294
293
|
var dependencies = new Map();
|
|
295
294
|
//get dependencies of each package
|
|
296
|
-
var
|
|
295
|
+
var leastDependentPackage;
|
|
297
296
|
lincdPackages.forEach(function (pkg) {
|
|
298
297
|
var pack = (0, utils_1.getPackageJSON)(pkg.path);
|
|
299
298
|
if (pack) {
|
|
300
299
|
//get lincd related dependencies and get the actual package details from the package map by removing '@dacore/' from the package name
|
|
301
|
-
var
|
|
300
|
+
var packageDependencies = Object.keys(pack.dependencies)
|
|
302
301
|
.filter(function (dependency) { return lincdPackages.has(dependency); })
|
|
303
302
|
.map(function (dependency) {
|
|
304
303
|
return lincdPackages.has(dependency) ? lincdPackages.get(dependency) : dependency;
|
|
305
304
|
});
|
|
306
|
-
// console.log(package.
|
|
307
|
-
dependencies.set(pkg,
|
|
305
|
+
// console.log(package.packageName,packageDependencies.map())
|
|
306
|
+
dependencies.set(pkg, packageDependencies);
|
|
308
307
|
}
|
|
309
308
|
});
|
|
310
|
-
dependencies.forEach(function (
|
|
311
|
-
if (!
|
|
312
|
-
return typeof dependency !== 'string' && lincdPackages.has(dependency.
|
|
309
|
+
dependencies.forEach(function (PackageDependencies, pkg) {
|
|
310
|
+
if (!PackageDependencies.some(function (dependency) {
|
|
311
|
+
return typeof dependency !== 'string' && lincdPackages.has(dependency.packageName);
|
|
313
312
|
})) {
|
|
314
|
-
|
|
313
|
+
leastDependentPackage = pkg;
|
|
315
314
|
}
|
|
316
315
|
});
|
|
317
|
-
var startStack = [
|
|
316
|
+
var startStack = [leastDependentPackage];
|
|
318
317
|
var done = new Set();
|
|
319
318
|
var results = [];
|
|
320
319
|
var runStack = function (stack) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -327,8 +326,8 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
|
|
|
327
326
|
// p = p.then(() => {
|
|
328
327
|
return runFunction(pck)["catch"](function (_a) {
|
|
329
328
|
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
330
|
-
warn('Uncaught exception whilst running parallel function on ' + pck.
|
|
331
|
-
// warn(chalk.red(pck.
|
|
329
|
+
warn('Uncaught exception whilst running parallel function on ' + pck.packageName, error.message);
|
|
330
|
+
// warn(chalk.red(pck.packageName+' failed:'));
|
|
332
331
|
// console.log(stdout);
|
|
333
332
|
})
|
|
334
333
|
.then(function (res) {
|
|
@@ -349,7 +348,7 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
|
|
|
349
348
|
//but every dependency is now done OR was not something we can build (some @dacore dependencies may not be local)
|
|
350
349
|
if (!done.has(pkg) &&
|
|
351
350
|
deps.every(function (dependency) {
|
|
352
|
-
return typeof dependency !== 'string' && (done.has(dependency) || !lincdPackages.has(dependency.
|
|
351
|
+
return typeof dependency !== 'string' && (done.has(dependency) || !lincdPackages.has(dependency.packageName));
|
|
353
352
|
})) {
|
|
354
353
|
stack.push(pkg);
|
|
355
354
|
}
|
|
@@ -376,7 +375,7 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
|
|
|
376
375
|
function buildAll(target, target2) {
|
|
377
376
|
var _this = this;
|
|
378
377
|
console.log('Building all LINCD packages of this repository in order of dependencies');
|
|
379
|
-
var lincdPackages =
|
|
378
|
+
var lincdPackages = getLocalLincdPackageMap();
|
|
380
379
|
var startFrom;
|
|
381
380
|
//by default start building
|
|
382
381
|
var building = true;
|
|
@@ -396,61 +395,61 @@ function buildAll(target, target2) {
|
|
|
396
395
|
var done = new Set();
|
|
397
396
|
var failedModules = [];
|
|
398
397
|
progressUpdate(lincdPackages.size + ' packages left');
|
|
399
|
-
var
|
|
400
|
-
// let
|
|
398
|
+
var packagesLeft = lincdPackages.size;
|
|
399
|
+
// let packagesLeft = lincdPackages.size - done.size;
|
|
401
400
|
runOnPackagesGroupedByDependencies(lincdPackages, function (packageGroup, dependencies) {
|
|
402
401
|
if (done.size > 0) {
|
|
403
402
|
debugInfo(chalk.magenta('\n-------\nThese packages are next, since all their dependencies have now been build:'));
|
|
404
403
|
// log(stack);
|
|
405
404
|
}
|
|
406
|
-
debugInfo('Now building: ' + chalk.blue(packageGroup.map(function (i) { return i.
|
|
405
|
+
debugInfo('Now building: ' + chalk.blue(packageGroup.map(function (i) { return i.packageName; })));
|
|
407
406
|
return function (pkg) { return __awaiter(_this, void 0, void 0, function () {
|
|
408
407
|
var command;
|
|
409
408
|
return __generator(this, function (_a) {
|
|
410
409
|
//if we're skipping builds until a certain package
|
|
411
410
|
if (!building) {
|
|
412
411
|
//if the package name matches the package we're supposed to start from then start building packages
|
|
413
|
-
if (pkg.
|
|
412
|
+
if (pkg.packageName == startFrom || pkg.packageName == startFrom) {
|
|
414
413
|
building = true;
|
|
415
414
|
}
|
|
416
415
|
//else still waiting for the package
|
|
417
416
|
else {
|
|
418
|
-
log(chalk.blue('skipping ' + pkg.
|
|
417
|
+
log(chalk.blue('skipping ' + pkg.packageName));
|
|
419
418
|
command = Promise.resolve(true);
|
|
420
419
|
}
|
|
421
420
|
}
|
|
422
421
|
//unless told otherwise, build the package
|
|
423
422
|
if (!command) {
|
|
424
423
|
command = execPromise('cd ' + pkg.path + ' && yarn lincd build' + (target ? ' ' + target : '') + (target2 ? ' ' + target2 : ''), false, false, {}, false);
|
|
425
|
-
debugInfo(chalk.cyan('Building ' + pkg.
|
|
424
|
+
debugInfo(chalk.cyan('Building ' + pkg.packageName));
|
|
426
425
|
}
|
|
427
426
|
return [2 /*return*/, command["catch"](function (_a) {
|
|
428
427
|
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
429
428
|
//this prints out the webpack output, including the build errors
|
|
430
|
-
warn('Failed to build ' + pkg.
|
|
429
|
+
warn('Failed to build ' + pkg.packageName);
|
|
431
430
|
console.log(stdout);
|
|
432
|
-
failedModules.push(pkg.
|
|
431
|
+
failedModules.push(pkg.packageName);
|
|
433
432
|
var dependentModules = getDependentPackages(dependencies, pkg);
|
|
434
433
|
if (dependentModules.length > 0) {
|
|
435
434
|
printBuildResults(failedModules, done);
|
|
436
435
|
console.log(chalk.magenta('Stopping build process because an error occurred whilst building ' +
|
|
437
|
-
pkg.
|
|
436
|
+
pkg.packageName +
|
|
438
437
|
', which ' +
|
|
439
438
|
dependentModules.length +
|
|
440
|
-
' other packages depend on.')); //"+dependentModules.map(d => d.
|
|
439
|
+
' other packages depend on.')); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
441
440
|
console.log(chalk.cyanBright('tip ') +
|
|
442
441
|
'Run ' +
|
|
443
|
-
chalk.green("lincd build-all from ".concat(pkg.
|
|
444
|
-
' to build only the remaining packages'); //"+dependentModules.map(d => d.
|
|
442
|
+
chalk.green("lincd build-all from ".concat(pkg.packageName)) +
|
|
443
|
+
' to build only the remaining packages'); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
445
444
|
process.exit(1);
|
|
446
445
|
}
|
|
447
446
|
})
|
|
448
447
|
.then(function (res) {
|
|
449
448
|
done.add(pkg);
|
|
450
|
-
|
|
451
|
-
// log(chalk.magenta(
|
|
452
|
-
process.stdout.write(
|
|
453
|
-
if (
|
|
449
|
+
packagesLeft--;
|
|
450
|
+
// log(chalk.magenta(packagesLeft + ' packages left'));
|
|
451
|
+
process.stdout.write(packagesLeft + ' packages left\r');
|
|
452
|
+
if (packagesLeft == 0) {
|
|
454
453
|
printBuildResults(failedModules, done);
|
|
455
454
|
}
|
|
456
455
|
return res;
|
|
@@ -473,14 +472,14 @@ function buildAll(target, target2) {
|
|
|
473
472
|
first_1 = false;
|
|
474
473
|
}
|
|
475
474
|
//print the cyclical dependencies
|
|
476
|
-
console.log(chalk.red(pkg.
|
|
475
|
+
console.log(chalk.red(pkg.packageName) +
|
|
477
476
|
' depends on ' +
|
|
478
477
|
deps
|
|
479
478
|
.filter(function (dependency) {
|
|
480
479
|
return typeof dependency !== 'string';
|
|
481
480
|
})
|
|
482
481
|
.map(function (d) {
|
|
483
|
-
return done.has(d) ? d.
|
|
482
|
+
return done.has(d) ? d.packageName : chalk.red(d.packageName);
|
|
484
483
|
})
|
|
485
484
|
.join(', '));
|
|
486
485
|
//also print some information why these packages have not been moved into the stack
|
|
@@ -508,24 +507,24 @@ function getDependentPackages(dependencies, pkg) {
|
|
|
508
507
|
* Returns a map of the packages that this repository manages (so no packages found through the workspaces who's path contains ../ )
|
|
509
508
|
* @param rootPath
|
|
510
509
|
*/
|
|
511
|
-
function
|
|
510
|
+
function getLocalLincdPackageMap(rootPath) {
|
|
512
511
|
if (rootPath === void 0) { rootPath = './'; }
|
|
513
512
|
var map = new Map();
|
|
514
|
-
|
|
513
|
+
getLincdPackages(rootPath).forEach(function (pkg) {
|
|
515
514
|
if (pkg.path.indexOf('../') === -1 && pkg.path.indexOf('..\\') === -1) {
|
|
516
515
|
// console.log(package.path);
|
|
517
|
-
map.set(pkg.
|
|
516
|
+
map.set(pkg.packageName, pkg);
|
|
518
517
|
}
|
|
519
518
|
});
|
|
520
519
|
return map;
|
|
521
520
|
}
|
|
522
521
|
function getLocalLincdModules(rootPath) {
|
|
523
522
|
if (rootPath === void 0) { rootPath = './'; }
|
|
524
|
-
return
|
|
523
|
+
return getLincdPackages(rootPath).filter(function (pkg) {
|
|
525
524
|
return pkg.path.indexOf('..\\') === -1;
|
|
526
525
|
});
|
|
527
526
|
}
|
|
528
|
-
function
|
|
527
|
+
function getLincdPackages(rootPath) {
|
|
529
528
|
if (rootPath === void 0) { rootPath = process.cwd(); }
|
|
530
529
|
var pack = (0, utils_1.getPackageJSON)();
|
|
531
530
|
if (!pack || !pack.workspaces) {
|
|
@@ -686,11 +685,11 @@ var createOntology = function (prefix, uriBase, basePath) {
|
|
|
686
685
|
//copy ontology accessor file
|
|
687
686
|
log("Creating files for ontology '" + prefix + "'");
|
|
688
687
|
targetFile = path.join(targetFolder, hyphenName + '.ts');
|
|
689
|
-
fs.copySync(path.join(__dirname, '..', 'defaults', '
|
|
688
|
+
fs.copySync(path.join(__dirname, '..', 'defaults', 'package', 'src', 'ontologies', 'example-ontology.ts'), targetFile);
|
|
690
689
|
targetDataFile = path.join(targetFolder, '..', 'data', hyphenName + '.json');
|
|
691
690
|
targetDataFile2 = path.join(targetFolder, '..', 'data', hyphenName + '.json.d.ts');
|
|
692
|
-
fs.copySync(path.join(__dirname, '..', 'defaults', '
|
|
693
|
-
fs.copySync(path.join(__dirname, '..', 'defaults', '
|
|
691
|
+
fs.copySync(path.join(__dirname, '..', 'defaults', 'package', 'src', 'data', 'example-ontology.json'), targetDataFile);
|
|
692
|
+
fs.copySync(path.join(__dirname, '..', 'defaults', 'package', 'src', 'data', 'example-ontology.json.d.ts'), targetDataFile2);
|
|
694
693
|
return [4 /*yield*/, replaceVariablesInFiles(targetFile, targetDataFile, targetDataFile2)];
|
|
695
694
|
case 1:
|
|
696
695
|
_b.sent();
|
|
@@ -781,7 +780,7 @@ var ensureFolderExists = function () {
|
|
|
781
780
|
fs.mkdirSync(targetFolder);
|
|
782
781
|
} else {
|
|
783
782
|
warn(
|
|
784
|
-
`Please run this command from the root of your
|
|
783
|
+
`Please run this command from the root of your package. This command expects ${parentDirectory.toString()} to exists from that folder`,
|
|
785
784
|
);
|
|
786
785
|
}
|
|
787
786
|
}
|
|
@@ -789,7 +788,7 @@ var ensureFolderExists = function () {
|
|
|
789
788
|
};
|
|
790
789
|
var setNameVariables = function (name) {
|
|
791
790
|
var hyphenName = name.replace(/[-_\s]+/g, '-');
|
|
792
|
-
var camelCaseName = camelCase(name); //some-
|
|
791
|
+
var camelCaseName = camelCase(name); //some-package --> someModule
|
|
793
792
|
var underscoreName = name.replace(/[-\s]+/g, '_');
|
|
794
793
|
//longer similar variables names should come before the shorter ones
|
|
795
794
|
setVariable('underscore_name', underscoreName);
|
|
@@ -850,7 +849,7 @@ var createComponent = function (name, basePath) {
|
|
|
850
849
|
});
|
|
851
850
|
});
|
|
852
851
|
};
|
|
853
|
-
var
|
|
852
|
+
var createPackage = function (name, uriBase, basePath) {
|
|
854
853
|
if (basePath === void 0) { basePath = process.cwd(); }
|
|
855
854
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
856
855
|
var _a, packageName, scope, cleanPackageName, targetFolder, _b, hyphenName, camelCaseName, underscoreName, version, installCommand;
|
|
@@ -859,8 +858,8 @@ var createModule = function (name, uriBase, basePath) {
|
|
|
859
858
|
case 0:
|
|
860
859
|
//if ran with npx, basePath will be the root directory of the repository, even if we're executing from a sub folder (the root directory is where node_modules lives and package.json with workspaces)
|
|
861
860
|
//so we manually find a packages folder, if it exists we go into that.
|
|
862
|
-
if (fs.existsSync(path.join(basePath, '
|
|
863
|
-
basePath = path.join(basePath, '
|
|
861
|
+
if (fs.existsSync(path.join(basePath, 'packages'))) {
|
|
862
|
+
basePath = path.join(basePath, 'packages');
|
|
864
863
|
}
|
|
865
864
|
if (!name) {
|
|
866
865
|
console.warn('Please provide a name as the first argument');
|
|
@@ -877,13 +876,13 @@ var createModule = function (name, uriBase, basePath) {
|
|
|
877
876
|
// --> match[0] = @dacore/some-mod
|
|
878
877
|
// --> match[1] = @dacore
|
|
879
878
|
// --> match[2] = some-mod
|
|
880
|
-
//but save full scoped package name under ${
|
|
881
|
-
setVariable('
|
|
879
|
+
//but save full scoped package name under ${package_name}
|
|
880
|
+
setVariable('package_name', name);
|
|
882
881
|
//extra variable for clarity (will be same as 'name')
|
|
883
882
|
setVariable('output_file_name', name);
|
|
884
883
|
_b = setNameVariables(cleanPackageName), hyphenName = _b.hyphenName, camelCaseName = _b.camelCaseName, underscoreName = _b.underscoreName;
|
|
885
884
|
log("Creating new LINCD package '" + name + "'");
|
|
886
|
-
fs.copySync(path.join(__dirname, '..', 'defaults', '
|
|
885
|
+
fs.copySync(path.join(__dirname, '..', 'defaults', 'package'), targetFolder);
|
|
887
886
|
//replace variables in some of the copied files
|
|
888
887
|
return [4 /*yield*/, Promise.all([
|
|
889
888
|
'src/index.ts',
|
|
@@ -997,7 +996,7 @@ var buildFailed = function (output) {
|
|
|
997
996
|
var pack = JSON.parse(
|
|
998
997
|
fs.readFileSync(process.cwd() + '/package.json', 'utf8'),
|
|
999
998
|
);
|
|
1000
|
-
let
|
|
999
|
+
let packageName = pack.name;
|
|
1001
1000
|
|
|
1002
1001
|
//just making sure the library is loaded in correct order because circular references are currently happening when importing BlankNode before NamedNode for example
|
|
1003
1002
|
// require('lincd');
|
|
@@ -1008,7 +1007,7 @@ var buildFailed = function (output) {
|
|
|
1008
1007
|
let shapeJSONLD = await getShapesJSONLD(indexExports.packageExports);
|
|
1009
1008
|
console.log(indexExports.packageExports);
|
|
1010
1009
|
console.log(shapeJSONLD);
|
|
1011
|
-
console.log(chalk.bold(chalk.green(
|
|
1010
|
+
console.log(chalk.bold(chalk.green(packageName+'/dist/shapes.json')));
|
|
1012
1011
|
return fs.writeFile(path.join('dist', 'shapes.json'), shapeJSONLD);
|
|
1013
1012
|
}
|
|
1014
1013
|
else
|
|
@@ -1024,7 +1023,7 @@ var register = function (registryURL) {
|
|
|
1024
1023
|
if (fs.existsSync(process.cwd() + '/package.json')) {
|
|
1025
1024
|
var pack = JSON.parse(fs.readFileSync(process.cwd() + '/package.json', 'utf8'));
|
|
1026
1025
|
var version = pack.version;
|
|
1027
|
-
var
|
|
1026
|
+
var packageName = pack.name;
|
|
1028
1027
|
// let author = pack.author;
|
|
1029
1028
|
// let description = pack.description;
|
|
1030
1029
|
//
|
|
@@ -1032,14 +1031,14 @@ var register = function (registryURL) {
|
|
|
1032
1031
|
// if (pack.author.name) {
|
|
1033
1032
|
// authorName = pack.author.name;
|
|
1034
1033
|
// }
|
|
1035
|
-
console.log(chalk.cyan('registering package ' +
|
|
1034
|
+
console.log(chalk.cyan('registering package ' + packageName + ' ' + version + ' in the LINCD registry'));
|
|
1036
1035
|
return fetch(registryURL + '/register', {
|
|
1037
1036
|
method: 'POST',
|
|
1038
1037
|
headers: {
|
|
1039
1038
|
Accept: 'application/json, text/plain, */*',
|
|
1040
1039
|
'Content-Type': 'application/json'
|
|
1041
1040
|
},
|
|
1042
|
-
body: JSON.stringify({ package:
|
|
1041
|
+
body: JSON.stringify({ package: packageName, version: version })
|
|
1043
1042
|
})
|
|
1044
1043
|
.then(function (res) { return res.json(); })
|
|
1045
1044
|
.then(function (json) {
|
|
@@ -1060,12 +1059,12 @@ var register = function (registryURL) {
|
|
|
1060
1059
|
console.warn(chalk.red('Warning:') + ' not found: ' + process.cwd() + '/package.json');
|
|
1061
1060
|
}
|
|
1062
1061
|
};
|
|
1063
|
-
var
|
|
1064
|
-
if (
|
|
1062
|
+
var buildPackage = function (target, target2, packagePath, logResults) {
|
|
1063
|
+
if (packagePath === void 0) { packagePath = process.cwd(); }
|
|
1065
1064
|
if (logResults === void 0) { logResults = true; }
|
|
1066
1065
|
if (target == 'production' || target == 'es5' || target == 'es6' || !target) {
|
|
1067
|
-
if (!fs.existsSync(path.join(
|
|
1068
|
-
console.warn("No Gruntfile found at ".concat(
|
|
1066
|
+
if (!fs.existsSync(path.join(packagePath, 'Gruntfile.js'))) {
|
|
1067
|
+
console.warn("No Gruntfile found at ".concat(packagePath, "\\Gruntfile.js. Cannot build."));
|
|
1069
1068
|
return;
|
|
1070
1069
|
}
|
|
1071
1070
|
var nodeEnv = '';
|
|
@@ -1093,7 +1092,7 @@ var buildModule = function (target, target2, modulePath, logResults) {
|
|
|
1093
1092
|
' --color');
|
|
1094
1093
|
var method = logResults ? execp : execPromise;
|
|
1095
1094
|
//execute the command to build the method, and provide the current work directory as option
|
|
1096
|
-
return method(nodeEnv + 'grunt build' + (target ? '-' + target : '') + (target2 ? '-' + target2 : '') + ' --color', false, false, { cwd:
|
|
1095
|
+
return method(nodeEnv + 'grunt build' + (target ? '-' + target : '') + (target2 ? '-' + target2 : '') + ' --color', false, false, { cwd: packagePath })["catch"](function (err) {
|
|
1097
1096
|
process.exit(1);
|
|
1098
1097
|
});
|
|
1099
1098
|
}
|
|
@@ -1101,21 +1100,21 @@ var buildModule = function (target, target2, modulePath, logResults) {
|
|
|
1101
1100
|
console.warn('unknown build target. Use es5, es6 or production.');
|
|
1102
1101
|
}
|
|
1103
1102
|
};
|
|
1104
|
-
var getLastBuildTime = function (
|
|
1105
|
-
return getLastModifiedFile(
|
|
1103
|
+
var getLastBuildTime = function (packagePath) {
|
|
1104
|
+
return getLastModifiedFile(packagePath + '/@(builds|lib|dist)/**/*.js');
|
|
1106
1105
|
};
|
|
1107
|
-
var getLastModifiedSourceTime = function (
|
|
1108
|
-
return getLastModifiedFile(
|
|
1109
|
-
ignore: [
|
|
1106
|
+
var getLastModifiedSourceTime = function (packagePath) {
|
|
1107
|
+
return getLastModifiedFile(packagePath + '/@(src|data|scss)/**/*', {
|
|
1108
|
+
ignore: [packagePath + '/**/*.scss.json', packagePath + '/**/*.d.ts']
|
|
1110
1109
|
});
|
|
1111
1110
|
};
|
|
1112
|
-
var getLastCommitTime = function (
|
|
1113
|
-
// console.log(`git log -1 --format=%ci -- ${
|
|
1111
|
+
var getLastCommitTime = function (packagePath) {
|
|
1112
|
+
// console.log(`git log -1 --format=%ci -- ${packagePath}`);
|
|
1114
1113
|
// process.exit();
|
|
1115
|
-
return execPromise("git log -1 --format=%ci -- ".concat(
|
|
1114
|
+
return execPromise("git log -1 --format=%ci -- ".concat(packagePath))
|
|
1116
1115
|
.then(function (result) {
|
|
1117
1116
|
var lastCommit = new Date(result);
|
|
1118
|
-
// console.log(
|
|
1117
|
+
// console.log(packagePath,result,lastCommit);
|
|
1119
1118
|
return lastCommit;
|
|
1120
1119
|
})["catch"](function (_a) {
|
|
1121
1120
|
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
@@ -1156,8 +1155,8 @@ var publishUpdated = function (test) {
|
|
|
1156
1155
|
console.log('Checking which packages need to be published by comparing last published date with last git commit');
|
|
1157
1156
|
packages.forEach(function (pckg) {
|
|
1158
1157
|
p = p.then(function (previousResult) {
|
|
1159
|
-
progressUpdate(packagesLeft-- + ' packages left. Now checking ' + pckg.
|
|
1160
|
-
debugInfo('# Checking package ' + pckg.
|
|
1158
|
+
progressUpdate(packagesLeft-- + ' packages left. Now checking ' + pckg.packageName);
|
|
1159
|
+
debugInfo('# Checking package ' + pckg.packageName);
|
|
1161
1160
|
// log('# Requesting ' + 'yarn info '+pkg.packageName+' --json');
|
|
1162
1161
|
// return execPromise('yarn info '+pkg.packageName+' --json').then((output:string) => {
|
|
1163
1162
|
// console.log("Will be requesting npm view from this current working directory:\n"+process.cwd());
|
|
@@ -1168,7 +1167,7 @@ var publishUpdated = function (test) {
|
|
|
1168
1167
|
if (pack.private) {
|
|
1169
1168
|
shouldPublish = false;
|
|
1170
1169
|
debugInfo(chalk.blue('--> is private, skipping'));
|
|
1171
|
-
return previousResult + ' ' + chalk.gray(pckg.
|
|
1170
|
+
return previousResult + ' ' + chalk.gray(pckg.packageName + ' is private\n');
|
|
1172
1171
|
}
|
|
1173
1172
|
return execPromise('yarn info ' + pckg.packageName + ' --json')
|
|
1174
1173
|
.then(function (output) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -1188,13 +1187,13 @@ var publishUpdated = function (test) {
|
|
|
1188
1187
|
else {
|
|
1189
1188
|
info = JSON.parse(output);
|
|
1190
1189
|
}
|
|
1191
|
-
// var stats = fs.statSync(path.join(
|
|
1192
|
-
// var files = fs.readdirSync(path.join(
|
|
1190
|
+
// var stats = fs.statSync(path.join(packageDirectory));
|
|
1191
|
+
// var files = fs.readdirSync(path.join(packageDirectory,'src'));
|
|
1193
1192
|
}
|
|
1194
1193
|
catch (err) {
|
|
1195
|
-
chalk.red(pckg.
|
|
1194
|
+
chalk.red(pckg.packageName + ' failed: ' + err.message + '\n');
|
|
1196
1195
|
console.warn('Returned JSON from npm: ' + output);
|
|
1197
|
-
return [2 /*return*/, previousResult + ' ' + chalk.red(pckg.
|
|
1196
|
+
return [2 /*return*/, previousResult + ' ' + chalk.red(pckg.packageName + ' failed: ' + err.message + '\n')];
|
|
1198
1197
|
}
|
|
1199
1198
|
if (!info) return [3 /*break*/, 2];
|
|
1200
1199
|
lastPublish = info.data.time[info.data.version];
|
|
@@ -1205,7 +1204,7 @@ var publishUpdated = function (test) {
|
|
|
1205
1204
|
if (!lastCommit) {
|
|
1206
1205
|
shouldPublish = false;
|
|
1207
1206
|
debugInfo('Could not determine last git commit');
|
|
1208
|
-
return [2 /*return*/, previousResult + ' ' + chalk.red(pckg.
|
|
1207
|
+
return [2 /*return*/, previousResult + ' ' + chalk.red(pckg.packageName + ' - could not determine last commit\n')];
|
|
1209
1208
|
}
|
|
1210
1209
|
else {
|
|
1211
1210
|
//NOTE: removed lastModified, because switching branches will say that the file was modified and cause everything to publish
|
|
@@ -1224,12 +1223,12 @@ var publishUpdated = function (test) {
|
|
|
1224
1223
|
case 2:
|
|
1225
1224
|
if (shouldPublish) {
|
|
1226
1225
|
res = publishPackage(pckg, previousResult, test, info, version);
|
|
1227
|
-
if (pckg.
|
|
1226
|
+
if (pckg.packageName == 'browser-core') {
|
|
1228
1227
|
browserCoreBuilt = true;
|
|
1229
1228
|
}
|
|
1230
1229
|
//when publishing core, also make sure to publish browser-core
|
|
1231
|
-
if (pckg.
|
|
1232
|
-
browserModule = packages.find(function (m) { return m.
|
|
1230
|
+
if (pckg.packageName == 'core' && !browserCoreBuilt) {
|
|
1231
|
+
browserModule = packages.find(function (m) { return m.packageName == 'browser-core'; });
|
|
1233
1232
|
return [2 /*return*/, Promise.resolve(res).then(function (previousResult) {
|
|
1234
1233
|
log('# Automatically also publishing package browser-core');
|
|
1235
1234
|
return publishPackage(browserModule, previousResult, test);
|
|
@@ -1243,7 +1242,7 @@ var publishUpdated = function (test) {
|
|
|
1243
1242
|
}); })["catch"](function (_a) {
|
|
1244
1243
|
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
1245
1244
|
console.log(error.message);
|
|
1246
|
-
return previousResult + ' ' + chalk.red(pckg.
|
|
1245
|
+
return previousResult + ' ' + chalk.red(pckg.packageName + ' failed\n');
|
|
1247
1246
|
});
|
|
1248
1247
|
});
|
|
1249
1248
|
});
|
|
@@ -1261,10 +1260,10 @@ var publishPackage = function (pkg, previousResult, test, info, publishVersion)
|
|
|
1261
1260
|
publishVersion = info ? getNextVersion(info.data.version) : '';
|
|
1262
1261
|
}
|
|
1263
1262
|
if (test) {
|
|
1264
|
-
debugInfo('should publish ' + pkg.
|
|
1263
|
+
debugInfo('should publish ' + pkg.packageName + ' ' + publishVersion);
|
|
1265
1264
|
}
|
|
1266
1265
|
else {
|
|
1267
|
-
console.log(chalk.blue('publishing ' + pkg.
|
|
1266
|
+
console.log(chalk.blue('publishing ' + pkg.packageName + ' ' + publishVersion));
|
|
1268
1267
|
}
|
|
1269
1268
|
if (!test) {
|
|
1270
1269
|
return execPromise("cd ".concat(pkg.path, " && yarn publish").concat(publishVersion ? ' --new-version ' + publishVersion : ''), true, false, {}, true)
|
|
@@ -1273,19 +1272,19 @@ var publishPackage = function (pkg, previousResult, test, info, publishVersion)
|
|
|
1273
1272
|
res.indexOf('Could not publish') !== -1 ||
|
|
1274
1273
|
res.indexOf("Couldn't publish") !== -1) {
|
|
1275
1274
|
console.log(res);
|
|
1276
|
-
return previousResult + ' ' + chalk.red(pkg.
|
|
1275
|
+
return previousResult + ' ' + chalk.red(pkg.packageName + ' failed\n');
|
|
1277
1276
|
}
|
|
1278
1277
|
console.log(chalk.green('Successfully published ' + pkg.path + ' ' + publishVersion));
|
|
1279
|
-
return previousResult + ' ' + chalk.green(pkg.
|
|
1278
|
+
return previousResult + ' ' + chalk.green(pkg.packageName + ' published ' + publishVersion + '\n');
|
|
1280
1279
|
})["catch"](function (_a) {
|
|
1281
1280
|
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
1282
1281
|
console.log(chalk.red('Failed to publish: ' + error.message));
|
|
1283
|
-
return previousResult + ' ' + chalk.red(pkg.
|
|
1282
|
+
return previousResult + ' ' + chalk.red(pkg.packageName + ' failed to publish\n');
|
|
1284
1283
|
});
|
|
1285
1284
|
}
|
|
1286
1285
|
else {
|
|
1287
1286
|
//when testing what needs to be published
|
|
1288
|
-
return previousResult + ' ' + chalk.blue(pkg.
|
|
1287
|
+
return previousResult + ' ' + chalk.blue(pkg.packageName + ' should publish\n');
|
|
1289
1288
|
}
|
|
1290
1289
|
};
|
|
1291
1290
|
var buildUpdated = function (back, target, target2, test) {
|
|
@@ -1298,7 +1297,7 @@ var buildUpdated = function (back, target, target2, test) {
|
|
|
1298
1297
|
case 0:
|
|
1299
1298
|
previousResult = '';
|
|
1300
1299
|
log(test ? 'Checking which packages need to be rebuild' : 'Building updated packages');
|
|
1301
|
-
packages =
|
|
1300
|
+
packages = getLocalLincdPackageMap();
|
|
1302
1301
|
jsonldPkgUpdated = needsRebuilding(packages.get('lincd-jsonld'));
|
|
1303
1302
|
cliPkgUpdated = needsRebuilding(packages.get('lincd-cli'));
|
|
1304
1303
|
if (!(jsonldPkgUpdated || cliPkgUpdated)) return [3 /*break*/, 2];
|
|
@@ -1310,46 +1309,46 @@ var buildUpdated = function (back, target, target2, test) {
|
|
|
1310
1309
|
rebuildAllModules = false;
|
|
1311
1310
|
if (cliPkgUpdated) {
|
|
1312
1311
|
rebuildAllModules = true;
|
|
1313
|
-
log(chalk.magenta('Rebuilding all
|
|
1312
|
+
log(chalk.magenta('Rebuilding all packages because the build tools (lincd-cli) got updated'));
|
|
1314
1313
|
}
|
|
1315
1314
|
packagesLeft = packages.size;
|
|
1316
1315
|
runOnPackagesGroupedByDependencies(packages, function (packageGroup, dependencies) {
|
|
1317
|
-
// console.log('Now checking: ' + chalk.blue(packageGroup.map((i) => i.
|
|
1316
|
+
// console.log('Now checking: ' + chalk.blue(packageGroup.map((i) => i.packageName)));
|
|
1318
1317
|
// console.log((packagesLeft) + " packages left.");
|
|
1319
1318
|
packagesLeft = packagesLeft - packageGroup.length;
|
|
1320
1319
|
return function (pkg) { return __awaiter(_this, void 0, void 0, function () {
|
|
1321
1320
|
var needRebuild;
|
|
1322
1321
|
return __generator(this, function (_a) {
|
|
1323
|
-
debugInfo('# Checking package ' + pkg.
|
|
1322
|
+
debugInfo('# Checking package ' + pkg.packageName);
|
|
1324
1323
|
needRebuild = needsRebuilding(pkg, true);
|
|
1325
|
-
if (pkg.
|
|
1324
|
+
if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated) {
|
|
1326
1325
|
needRebuild = true;
|
|
1327
1326
|
}
|
|
1328
1327
|
// console.log(pkg.path,lastModifiedSource.lastModifiedTime,lastModifiedBundle.lastModifiedTime);
|
|
1329
1328
|
// console.log(pkg.path,new Date(lastModifiedSource.lastModified).toString(),new Date(lastModifiedBundle.lastModified).toString());
|
|
1330
1329
|
if (needRebuild || rebuildAllModules) {
|
|
1331
1330
|
//TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
|
|
1332
|
-
// log(
|
|
1331
|
+
// log(packageName+' modified since last commit on '+now.toString());
|
|
1333
1332
|
if (test) {
|
|
1334
|
-
debugInfo('Need to build ' + pkg.
|
|
1335
|
-
return [2 /*return*/, chalk.blue(pkg.
|
|
1333
|
+
debugInfo('Need to build ' + pkg.packageName);
|
|
1334
|
+
return [2 /*return*/, chalk.blue(pkg.packageName + ' should be build')];
|
|
1336
1335
|
}
|
|
1337
|
-
log('Building ' + pkg.
|
|
1336
|
+
log('Building ' + pkg.packageName);
|
|
1338
1337
|
return [2 /*return*/, execPromise('cd ' + pkg.path + ' && yarn build' + (target ? ' ' + target : '') + (target2 ? ' ' + target2 : ''))
|
|
1339
1338
|
.then(function (res) {
|
|
1340
|
-
debugInfo(chalk.green(pkg.
|
|
1341
|
-
return chalk.green(pkg.
|
|
1339
|
+
debugInfo(chalk.green(pkg.packageName + ' successfully built'));
|
|
1340
|
+
return chalk.green(pkg.packageName + ' built');
|
|
1342
1341
|
})["catch"](function (_a) {
|
|
1343
1342
|
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
1344
|
-
warn('Failed to build ' + pkg.
|
|
1343
|
+
warn('Failed to build ' + pkg.packageName);
|
|
1345
1344
|
console.log(stdout);
|
|
1346
1345
|
var dependentModules = getDependentPackages(dependencies, pkg);
|
|
1347
1346
|
if (dependentModules.length > 0) {
|
|
1348
1347
|
// printBuildResults(failedModules, done);
|
|
1349
|
-
warn(chalk.red(pkg.
|
|
1348
|
+
warn(chalk.red(pkg.packageName + ' build failed'));
|
|
1350
1349
|
warn('Stopping build-updated process because ' +
|
|
1351
1350
|
dependentModules.length +
|
|
1352
|
-
' other packages depend on this
|
|
1351
|
+
' other packages depend on this package.\n'); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
1353
1352
|
process.exit(1);
|
|
1354
1353
|
}
|
|
1355
1354
|
})];
|
|
@@ -1389,18 +1388,18 @@ var needsRebuilding = function (pkg, logDetailsIfTrue) {
|
|
|
1389
1388
|
return result;
|
|
1390
1389
|
};
|
|
1391
1390
|
var printBuildResults = function (failed, done) {
|
|
1392
|
-
log('Successfully built: ' + chalk.green(__spreadArray([], __read(done), false).map(function (m) { return m.
|
|
1391
|
+
log('Successfully built: ' + chalk.green(__spreadArray([], __read(done), false).map(function (m) { return m.packageName; }).join(', ')) + '\n');
|
|
1393
1392
|
if (failed.length > 0) {
|
|
1394
1393
|
warn('Failed to build: ' + chalk.red(failed.join(', ')) + '\n');
|
|
1395
1394
|
}
|
|
1396
1395
|
};
|
|
1397
|
-
var
|
|
1396
|
+
var executeCommandForEachPackage = function (packages, command, filterMethod, filterValue) {
|
|
1398
1397
|
//if a specific set of packages is given
|
|
1399
1398
|
if (filterMethod == 'exclude') {
|
|
1400
1399
|
//filter packages, so that we only execute on the packages as provided in the command
|
|
1401
1400
|
log('Excluding ' + filterValue);
|
|
1402
1401
|
filterValue = filterValue.split(',');
|
|
1403
|
-
packages = packages.filter(function (pkg) { return filterValue.indexOf(pkg.
|
|
1402
|
+
packages = packages.filter(function (pkg) { return filterValue.indexOf(pkg.packageName) === -1; });
|
|
1404
1403
|
}
|
|
1405
1404
|
var startFrom;
|
|
1406
1405
|
//by default start executing, unless 'from' is given
|
|
@@ -1413,7 +1412,7 @@ var executeCommandForEachModule = function (packages, command, filterMethod, fil
|
|
|
1413
1412
|
}
|
|
1414
1413
|
var seen_1 = false;
|
|
1415
1414
|
packages = packages.filter(function (pkg) {
|
|
1416
|
-
if (!seen_1 && (pkg.
|
|
1415
|
+
if (!seen_1 && (pkg.packageName == startFrom || pkg.packageName == startFrom)) {
|
|
1417
1416
|
seen_1 = true;
|
|
1418
1417
|
}
|
|
1419
1418
|
return seen_1;
|
|
@@ -1422,26 +1421,26 @@ var executeCommandForEachModule = function (packages, command, filterMethod, fil
|
|
|
1422
1421
|
log("Executing '" +
|
|
1423
1422
|
chalk.blueBright(command) +
|
|
1424
1423
|
"' on packages " +
|
|
1425
|
-
chalk.magenta(packages.map(function (m) { return m.
|
|
1424
|
+
chalk.magenta(packages.map(function (m) { return m.packageName; }).join(', ')));
|
|
1426
1425
|
var p = Promise.resolve(true);
|
|
1427
1426
|
packages.forEach(function (pkg) {
|
|
1428
1427
|
p = p.then(function () {
|
|
1429
|
-
log('# Package ' + chalk.magenta(pkg.
|
|
1428
|
+
log('# Package ' + chalk.magenta(pkg.packageName));
|
|
1430
1429
|
return execp('cd ' + pkg.path + ' && ' + command);
|
|
1431
1430
|
});
|
|
1432
1431
|
});
|
|
1433
1432
|
return p;
|
|
1434
1433
|
};
|
|
1435
|
-
var
|
|
1436
|
-
var
|
|
1437
|
-
return modDetails.packageName.indexOf(
|
|
1434
|
+
var executeCommandForPackage = function (packageName, command) {
|
|
1435
|
+
var packageDetails = getLincdPackages().find(function (modDetails) {
|
|
1436
|
+
return modDetails.packageName.indexOf(packageName) !== -1 || modDetails.packageName.indexOf(packageName) !== -1;
|
|
1438
1437
|
});
|
|
1439
|
-
if (
|
|
1440
|
-
log("Executing 'cd " +
|
|
1441
|
-
return execp('cd ' +
|
|
1438
|
+
if (packageDetails) {
|
|
1439
|
+
log("Executing 'cd " + packageDetails.path + ' && yarn lincd' + (command ? ' ' + command : '') + "'");
|
|
1440
|
+
return execp('cd ' + packageDetails.path + ' && yarn lincd' + (command ? ' ' + command : ''));
|
|
1442
1441
|
}
|
|
1443
1442
|
else {
|
|
1444
|
-
warn("Could not find a pkg who's name (partially) matched " + chalk.cyan(
|
|
1443
|
+
warn("Could not find a pkg who's name (partially) matched " + chalk.cyan(packageName));
|
|
1445
1444
|
}
|
|
1446
1445
|
};
|
|
1447
1446
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lincd-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Command line tools for the lincd.js library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"grunt-ts": "^6.0.0-beta.22",
|
|
55
55
|
"grunt-webpack": "^5.0.0",
|
|
56
56
|
"license-info-webpack-plugin": "^3.0.0",
|
|
57
|
-
"lincd": "^0.
|
|
57
|
+
"lincd": "^0.4",
|
|
58
58
|
"lincd-jsonld": "^0.1.8",
|
|
59
59
|
"load-grunt-tasks": "^5.1.0",
|
|
60
60
|
"mini-css-extract-plugin": "^2.6.1",
|