lincd-cli 0.1.5 → 0.1.6
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/LICENSE +373 -373
- package/README.md +24 -24
- package/defaults/defaultModule/Index.js +30 -30
- package/defaults/defaultModule/Index.tsx +24 -24
- package/defaults/defaultModule/index.ts +11 -11
- package/defaults/defaultModule/ontology.js +21 -21
- package/defaults/defaultModule/ontology.ts +15 -15
- package/defaults/gitignorefile +3 -3
- package/defaults/index.ts +12 -12
- package/defaults/module/package.json +30 -30
- package/defaults/module/src/components/ExampleComponent.tsx +22 -22
- package/defaults/module/src/data/example-ontology.json +20 -20
- package/defaults/module/src/data/example-ontology.json.d.ts +1 -1
- package/defaults/module/src/index.ts +7 -7
- package/defaults/module/src/module.ts +9 -9
- package/defaults/module/src/ontologies/example-ontology.ts +33 -33
- package/defaults/module/src/shapes/ExampleShapeClass.ts +30 -30
- package/defaults/ontology.ts +15 -15
- package/defaults/package.json +28 -28
- package/defaults/site/package.json +40 -40
- package/defaults/site/storage/filestores/settings-production-template.jsonld +128 -128
- package/defaults/site/web/.htaccess +19 -19
- package/lib/cli.js +70 -116
- package/lib/config-grunt.js +4 -14
- package/lib/config-webpack.js +23 -23
- package/lib/plugins/declaration-plugin.js +26 -68
- package/lib/plugins/externalise-modules.js +4 -10
- package/package.json +75 -73
- package/src/cli.js +1209 -1209
- package/src/config-grunt.js +263 -263
- package/src/config-webpack.js +281 -281
- package/src/index.js +22 -22
- package/src/interfaces.js +2 -2
- package/src/plugins/declaration-plugin.js +248 -248
- package/src/plugins/externalise-modules.js +161 -161
- package/src/plugins/shapes-plugin.js +69 -69
- package/src/plugins/watch-run.js +47 -47
- package/src/utils.js +127 -127
- package/defaults/.npmignore +0 -11
- package/defaults/Gruntfile.js +0 -16
- package/defaults/module/Gruntfile.js +0 -16
- package/defaults/module/tsconfig-es5.json +0 -21
- package/defaults/module/tsconfig.json +0 -21
- package/defaults/site/.gitignore +0 -8
- package/defaults/site/.npmignore +0 -10
- package/defaults/site/lib/start-server.js +0 -22
- package/defaults/site/lib/test-server.js +0 -10
- package/defaults/site/storage/filestores/settings-development.jsonld +0 -117
- package/defaults/tsconfig-es5.json +0 -18
- package/defaults/tsconfig.json +0 -20
package/lib/cli.js
CHANGED
|
@@ -65,12 +65,36 @@ function warn() {
|
|
|
65
65
|
// console.log(chalk.red(message));
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function checkWorkspaces(rootPath, workspaces, res) {
|
|
69
|
+
// console.log('checking workspaces at '+rootPath+": "+workspaces.toString());
|
|
70
|
+
workspaces.forEach(function (workspace) {
|
|
71
|
+
var workspacePath = path.join(rootPath, workspace.replace('/*', ''));
|
|
72
|
+
if (workspace.indexOf('/*') !== -1) {
|
|
73
|
+
// console.log(workspacePath);
|
|
74
|
+
if (fs.existsSync(workspacePath)) {
|
|
75
|
+
var folders = fs.readdirSync(workspacePath);
|
|
76
|
+
folders.forEach(function (folder) {
|
|
77
|
+
if (folder !== './' && folder !== '../') {
|
|
78
|
+
checkModulePath(rootPath, path.join(workspacePath, folder), res);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
checkModulePath(rootPath, workspacePath, res);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function checkModulePath(rootPath, modulePath, res) {
|
|
69
89
|
var packagePath = path.join(modulePath, 'package.json');
|
|
90
|
+
// console.log('checking '+packagePath);
|
|
70
91
|
if (fs.existsSync(packagePath)) {
|
|
71
92
|
var pack = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
72
93
|
//some packages are not true lincd modules, but we still want them to be re-built automatically. This is what lincd_util is for
|
|
73
|
-
if (
|
|
94
|
+
if (pack && pack.workspaces) {
|
|
95
|
+
checkWorkspaces(modulePath, pack.workspaces, res);
|
|
96
|
+
}
|
|
97
|
+
else if ((pack && pack.lincd === true) || pack.lincd_util === true) {
|
|
74
98
|
res.push({
|
|
75
99
|
path: modulePath,
|
|
76
100
|
moduleName: pack.name,
|
|
@@ -87,8 +111,7 @@ function getLocalLincdModuleMap(rootPath) {
|
|
|
87
111
|
if (rootPath === void 0) { rootPath = './'; }
|
|
88
112
|
var map = new Map();
|
|
89
113
|
getLincdModules(rootPath).forEach(function (module) {
|
|
90
|
-
if (module.path.indexOf('../') === -1 &&
|
|
91
|
-
module.path.indexOf('..\\') === -1) {
|
|
114
|
+
if (module.path.indexOf('../') === -1 && module.path.indexOf('..\\') === -1) {
|
|
92
115
|
// console.log(module.path);
|
|
93
116
|
map.set(module.moduleName, module);
|
|
94
117
|
}
|
|
@@ -114,23 +137,7 @@ function getLincdModules(rootPath) {
|
|
|
114
137
|
process.exit();
|
|
115
138
|
}
|
|
116
139
|
//TODO: filter with package.lincd = true?
|
|
117
|
-
pack.workspaces
|
|
118
|
-
var workspacePath = path.join(rootPath, workspace.replace('/*', ''));
|
|
119
|
-
if (workspace.indexOf('/*') !== -1) {
|
|
120
|
-
// console.log(workspacePath);
|
|
121
|
-
if (fs.existsSync(workspacePath)) {
|
|
122
|
-
var folders = fs.readdirSync(workspacePath);
|
|
123
|
-
folders.forEach(function (folder) {
|
|
124
|
-
if (folder !== './' && folder !== '../') {
|
|
125
|
-
checkModulePath(path.join(workspacePath, folder), res);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
checkModulePath(workspacePath, res);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
140
|
+
checkWorkspaces(rootPath, pack.workspaces, res);
|
|
134
141
|
// console.log(res);
|
|
135
142
|
return res;
|
|
136
143
|
}
|
|
@@ -245,9 +252,7 @@ var replaceCurlyVariables = function (string) {
|
|
|
245
252
|
}
|
|
246
253
|
return string;
|
|
247
254
|
};
|
|
248
|
-
var capitalize = function (str) {
|
|
249
|
-
return str.charAt(0).toUpperCase() + str.toLowerCase().slice(1);
|
|
250
|
-
};
|
|
255
|
+
var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.toLowerCase().slice(1); };
|
|
251
256
|
var camelCase = function (str) {
|
|
252
257
|
var string = str
|
|
253
258
|
.toLowerCase()
|
|
@@ -315,8 +320,7 @@ var getNextMinorVersion = function (version) {
|
|
|
315
320
|
return parts[0] + '.' + (parseInt(parts[1]) + 1).toString() + '.0';
|
|
316
321
|
};
|
|
317
322
|
var buildFailed = function (output) {
|
|
318
|
-
return
|
|
319
|
-
output.indexOf('Command failed') !== -1);
|
|
323
|
+
return output.indexOf('Aborted due to warnings') !== -1 && output.indexOf('Command failed') !== -1;
|
|
320
324
|
};
|
|
321
325
|
/*program.command('shapes').action(async () => {
|
|
322
326
|
//we've imported require-extensions from npm so that we can use this
|
|
@@ -362,15 +366,9 @@ program.command('register [version]').action(function (newVersion) {
|
|
|
362
366
|
var moduleName = pack.name;
|
|
363
367
|
var author = pack.author;
|
|
364
368
|
// let displayName = pack.displayName;
|
|
365
|
-
console.log(chalk.cyan('registering ' +
|
|
366
|
-
author +
|
|
367
|
-
"'s module, " +
|
|
368
|
-
moduleName +
|
|
369
|
-
' ' +
|
|
370
|
-
version +
|
|
371
|
-
' in the LINCD registry'));
|
|
369
|
+
console.log(chalk.cyan('registering ' + author + "'s module, " + moduleName + ' ' + version + ' in the LINCD registry'));
|
|
372
370
|
//temporary test code
|
|
373
|
-
return fetch('http://localhost:
|
|
371
|
+
return fetch('http://localhost:4001/register', {
|
|
374
372
|
method: 'POST',
|
|
375
373
|
headers: {
|
|
376
374
|
Accept: 'application/json, text/plain, */*',
|
|
@@ -378,9 +376,14 @@ program.command('register [version]').action(function (newVersion) {
|
|
|
378
376
|
},
|
|
379
377
|
body: JSON.stringify({ package: moduleName, version: version })
|
|
380
378
|
})
|
|
381
|
-
.then(function (res) { return res.
|
|
382
|
-
.then(function (
|
|
383
|
-
|
|
379
|
+
.then(function (res) { return res.json(); })
|
|
380
|
+
.then(function (json) {
|
|
381
|
+
if (json.error) {
|
|
382
|
+
console.log(chalk.red('Response: ' + json.error));
|
|
383
|
+
}
|
|
384
|
+
else if (json.result) {
|
|
385
|
+
console.log(chalk.cyan('Response: ') + json.result);
|
|
386
|
+
}
|
|
384
387
|
})["catch"](function (err) {
|
|
385
388
|
console.warn('Could not connect to LINCD registry');
|
|
386
389
|
});
|
|
@@ -522,11 +525,7 @@ var buildModule = function (target, target2, modulePath, logResults) {
|
|
|
522
525
|
' --color');
|
|
523
526
|
var method = logResults ? execp : execPromise;
|
|
524
527
|
//execute the command to build the method, and provide the current work directory as option
|
|
525
|
-
return method(nodeEnv +
|
|
526
|
-
'grunt build' +
|
|
527
|
-
(target ? '-' + target : '') +
|
|
528
|
-
(target2 ? '-' + target2 : '') +
|
|
529
|
-
' --color', false, false, { cwd: modulePath })["catch"](function (err) {
|
|
528
|
+
return method(nodeEnv + 'grunt build' + (target ? '-' + target : '') + (target2 ? '-' + target2 : '') + ' --color', false, false, { cwd: modulePath })["catch"](function (err) {
|
|
530
529
|
process.exit(1);
|
|
531
530
|
});
|
|
532
531
|
}
|
|
@@ -623,9 +622,7 @@ var publishUpdated = function (test) {
|
|
|
623
622
|
catch (err) {
|
|
624
623
|
chalk.red(module.moduleName + ' failed: ' + err.message + '\n');
|
|
625
624
|
console.warn('Returned JSON from npm: ' + output);
|
|
626
|
-
return [2 /*return*/,
|
|
627
|
-
' ' +
|
|
628
|
-
chalk.red(module.moduleName + ' failed: ' + err.message + '\n'))];
|
|
625
|
+
return [2 /*return*/, previousResult + ' ' + chalk.red(module.moduleName + ' failed: ' + err.message + '\n')];
|
|
629
626
|
}
|
|
630
627
|
lastPublish = info.data.time[info.data.version];
|
|
631
628
|
lastPublishDate = new Date(lastPublish);
|
|
@@ -633,15 +630,8 @@ var publishUpdated = function (test) {
|
|
|
633
630
|
return [4 /*yield*/, getLastCommitTime(module.path)];
|
|
634
631
|
case 1:
|
|
635
632
|
lastCommit = _b.sent();
|
|
636
|
-
console.log(lastPublishDate.toDateString() +
|
|
637
|
-
|
|
638
|
-
lastPublishDate.toTimeString() +
|
|
639
|
-
' published ' +
|
|
640
|
-
info.data.version);
|
|
641
|
-
console.log(lastCommit.toDateString() +
|
|
642
|
-
' ' +
|
|
643
|
-
new Date(lastCommit).toTimeString() +
|
|
644
|
-
' source last committed');
|
|
633
|
+
console.log(lastPublishDate.toDateString() + ' ' + lastPublishDate.toTimeString() + ' published ' + info.data.version);
|
|
634
|
+
console.log(lastCommit.toDateString() + ' ' + new Date(lastCommit).toTimeString() + ' source last committed');
|
|
645
635
|
// console.log(lastModified.toDateString() + ' ' + new Date(lastModified).toTimeString() + ' source ' + lastModifiedName + ' last edited');
|
|
646
636
|
//NOTE: removed lastModified, because switching branches will say that the file was modified and cause everything to publish
|
|
647
637
|
//SO: now you NEED TO commit before it picks up that you should publish
|
|
@@ -666,7 +656,7 @@ var publishUpdated = function (test) {
|
|
|
666
656
|
});
|
|
667
657
|
}); })["catch"](function (err) {
|
|
668
658
|
console.log(err);
|
|
669
|
-
return
|
|
659
|
+
return previousResult + ' ' + chalk.red(module.moduleName + ' failed\n');
|
|
670
660
|
});
|
|
671
661
|
});
|
|
672
662
|
});
|
|
@@ -681,12 +671,7 @@ var publishUpdated = function (test) {
|
|
|
681
671
|
};
|
|
682
672
|
var executeSingleBuild = function (module, previousResult, test, info) {
|
|
683
673
|
var nextVersion = info ? getNextVersion(info.data.version) : '';
|
|
684
|
-
console.log(chalk.blue('--> ' +
|
|
685
|
-
(test ? 'should publish' : 'publishing') +
|
|
686
|
-
' ' +
|
|
687
|
-
module.moduleName +
|
|
688
|
-
' ' +
|
|
689
|
-
nextVersion));
|
|
674
|
+
console.log(chalk.blue('--> ' + (test ? 'should publish' : 'publishing') + ' ' + module.moduleName + ' ' + nextVersion));
|
|
690
675
|
if (!test) {
|
|
691
676
|
return execPromise('cd ' + module.path + ' && yarn lincd register', true)
|
|
692
677
|
.then(function (res) {
|
|
@@ -694,12 +679,10 @@ var executeSingleBuild = function (module, previousResult, test, info) {
|
|
|
694
679
|
res.indexOf('Could not publish') !== -1 ||
|
|
695
680
|
res.indexOf("Couldn't publish") !== -1) {
|
|
696
681
|
console.log(res);
|
|
697
|
-
return
|
|
682
|
+
return previousResult + ' ' + chalk.red(module.moduleName + ' failed\n');
|
|
698
683
|
}
|
|
699
684
|
console.log(chalk.green('Successfully published ' + nextVersion));
|
|
700
|
-
return
|
|
701
|
-
' ' +
|
|
702
|
-
chalk.green(module.moduleName + ' published ' + nextVersion + '\n'));
|
|
685
|
+
return previousResult + ' ' + chalk.green(module.moduleName + ' published ' + nextVersion + '\n');
|
|
703
686
|
})["catch"](function (err) {
|
|
704
687
|
console.log(chalk.red('Failed to publish: ' + err));
|
|
705
688
|
return chalk.red('Failed to publish: ' + err);
|
|
@@ -707,17 +690,13 @@ var executeSingleBuild = function (module, previousResult, test, info) {
|
|
|
707
690
|
}
|
|
708
691
|
else {
|
|
709
692
|
//when testing what needs to be published
|
|
710
|
-
return
|
|
693
|
+
return previousResult + ' ' + chalk.blue(module.moduleName + ' should publish\n');
|
|
711
694
|
}
|
|
712
695
|
};
|
|
713
|
-
program
|
|
714
|
-
.command('build-updated [target] [target2]')
|
|
715
|
-
.action(function (target, target2) {
|
|
696
|
+
program.command('build-updated [target] [target2]').action(function (target, target2) {
|
|
716
697
|
return buildUpdated(1, target, target2);
|
|
717
698
|
});
|
|
718
|
-
program
|
|
719
|
-
.command('build-updated-since [num-commits-back] [target] [target2]')
|
|
720
|
-
.action(function (back, target, target2) {
|
|
699
|
+
program.command('build-updated-since [num-commits-back] [target] [target2]').action(function (back, target, target2) {
|
|
721
700
|
return buildUpdated(back, target, target2);
|
|
722
701
|
});
|
|
723
702
|
var buildUpdated = function (back, target, target2, test) {
|
|
@@ -726,8 +705,7 @@ var buildUpdated = function (back, target, target2, test) {
|
|
|
726
705
|
// return execPromise(`git log -${back} --format=%ci`).then((result) => {
|
|
727
706
|
// let now = new Date();
|
|
728
707
|
var previousResult = '';
|
|
729
|
-
log((test ? 'Checking which modules' : 'Building all modules that') +
|
|
730
|
-
' have been changed since their last built ');
|
|
708
|
+
log((test ? 'Checking which modules' : 'Building all modules that') + ' have been changed since their last built ');
|
|
731
709
|
var modules = getLocalLincdModules();
|
|
732
710
|
//TODO: sort all these modules in the order of their dependencies.
|
|
733
711
|
// To do so, see build-all command and put some of the functionality (like getting modules that depend on a module) in reusable functions
|
|
@@ -741,8 +719,7 @@ var buildUpdated = function (back, target, target2, test) {
|
|
|
741
719
|
// console.log(module.path,lastModifiedSource.lastModifiedTime,lastModifiedBundle.lastModifiedTime);
|
|
742
720
|
// console.log(module.path,new Date(lastModifiedSource.lastModified).toString(),new Date(lastModifiedBundle.lastModified).toString());
|
|
743
721
|
console.log('# Checking module ' + moduleName);
|
|
744
|
-
if (lastModifiedSource.lastModifiedTime >
|
|
745
|
-
lastModifiedBundle.lastModifiedTime) {
|
|
722
|
+
if (lastModifiedSource.lastModifiedTime > lastModifiedBundle.lastModifiedTime) {
|
|
746
723
|
//TODO: when building a module, also rebuild all modules that depend on this module.. and iteratively build modules that depend on those modules..
|
|
747
724
|
// log(moduleName+' modified since last commit on '+now.toString());
|
|
748
725
|
console.log(chalk.cyan('Last modified source: ' +
|
|
@@ -750,27 +727,21 @@ var buildUpdated = function (back, target, target2, test) {
|
|
|
750
727
|
' on ' +
|
|
751
728
|
lastModifiedSource.lastModified.toString()));
|
|
752
729
|
console.log(chalk.cyan('Last build: ' +
|
|
753
|
-
(lastModifiedBundle &&
|
|
754
|
-
typeof lastModifiedBundle.lastModified !== 'undefined'
|
|
730
|
+
(lastModifiedBundle && typeof lastModifiedBundle.lastModified !== 'undefined'
|
|
755
731
|
? lastModifiedBundle.lastModified.toString()
|
|
756
732
|
: 'never')));
|
|
757
733
|
log('--> ' + (test ? 'need to build ' : 'building ') + moduleName);
|
|
758
734
|
if (!test) {
|
|
759
|
-
return execPromise('cd ' +
|
|
760
|
-
|
|
761
|
-
' && yarn build' +
|
|
762
|
-
(target ? ' ' + target : '') +
|
|
763
|
-
(target2 ? ' ' + target2 : '')).then(function (res) {
|
|
764
|
-
if (res.indexOf('Aborted due to warnings') !== -1 ||
|
|
765
|
-
res.indexOf('Fatal error') !== -1) {
|
|
735
|
+
return execPromise('cd ' + module.path + ' && yarn build' + (target ? ' ' + target : '') + (target2 ? ' ' + target2 : '')).then(function (res) {
|
|
736
|
+
if (res.indexOf('Aborted due to warnings') !== -1 || res.indexOf('Fatal error') !== -1) {
|
|
766
737
|
console.log(res);
|
|
767
|
-
return
|
|
738
|
+
return previousResult + ' ' + chalk.red(moduleName + ' failed\n');
|
|
768
739
|
}
|
|
769
740
|
console.log(chalk.green(moduleName + ' bundles successfully built'));
|
|
770
|
-
return
|
|
741
|
+
return previousResult + ' ' + chalk.green(moduleName + ' built\n');
|
|
771
742
|
});
|
|
772
743
|
}
|
|
773
|
-
return
|
|
744
|
+
return previousResult + ' ' + chalk.blue(moduleName + ' should be build\n');
|
|
774
745
|
}
|
|
775
746
|
return previousResult;
|
|
776
747
|
})["catch"](function (err) {
|
|
@@ -809,7 +780,7 @@ program.command('build-all [target] [target2]').action(function (target, target2
|
|
|
809
780
|
});
|
|
810
781
|
dependencies.forEach(function (moduleDependencies, module) {
|
|
811
782
|
if (!moduleDependencies.some(function (dependency) {
|
|
812
|
-
return
|
|
783
|
+
return typeof dependency !== 'string' && modules.has(dependency.moduleName);
|
|
813
784
|
})) {
|
|
814
785
|
leastDependentModule = module;
|
|
815
786
|
}
|
|
@@ -847,8 +818,7 @@ program.command('build-all [target] [target2]').action(function (target, target2
|
|
|
847
818
|
//if we're skipping builds until a certain module
|
|
848
819
|
if (!building) {
|
|
849
820
|
//if the module name matches the module we're supposed to start from then start building modules
|
|
850
|
-
if (module.moduleName == startFrom ||
|
|
851
|
-
module.packageName == startFrom) {
|
|
821
|
+
if (module.moduleName == startFrom || module.packageName == startFrom) {
|
|
852
822
|
building = true;
|
|
853
823
|
}
|
|
854
824
|
//else still waiting for the module
|
|
@@ -881,7 +851,7 @@ program.command('build-all [target] [target2]').action(function (target, target2
|
|
|
881
851
|
' other modules depend on.')); //"+dependentModules.map(d => d.moduleName).join(", ")));
|
|
882
852
|
console.log(chalk.cyanBright('tip ') +
|
|
883
853
|
'Run ' +
|
|
884
|
-
chalk.green("
|
|
854
|
+
chalk.green("lincd build-all from " + module.moduleName) +
|
|
885
855
|
' to build only the remaining modules'); //"+dependentModules.map(d => d.moduleName).join(", ")));
|
|
886
856
|
process.exit(1);
|
|
887
857
|
}
|
|
@@ -910,8 +880,7 @@ program.command('build-all [target] [target2]').action(function (target, target2
|
|
|
910
880
|
//but every dependency is now done OR was not something we can build (some @dacore dependencies may not be local)
|
|
911
881
|
if (!done.has(module) &&
|
|
912
882
|
deps.every(function (dependency) {
|
|
913
|
-
return
|
|
914
|
-
(done.has(dependency) || !modules.has(dependency.moduleName)));
|
|
883
|
+
return typeof dependency !== 'string' && (done.has(dependency) || !modules.has(dependency.moduleName));
|
|
915
884
|
})) {
|
|
916
885
|
stack.push(module);
|
|
917
886
|
}
|
|
@@ -968,14 +937,10 @@ program.command('build-all [target] [target2]').action(function (target, target2
|
|
|
968
937
|
//starts the process
|
|
969
938
|
runStack();
|
|
970
939
|
});
|
|
971
|
-
program
|
|
972
|
-
.command('modules [action] [includedSpaces]')
|
|
973
|
-
.action(function (command, includedSpaces) {
|
|
940
|
+
program.command('modules [action] [includedSpaces]').action(function (command, includedSpaces) {
|
|
974
941
|
executeCommandForEachModule(getLincdModules(), command, includedSpaces);
|
|
975
942
|
});
|
|
976
|
-
program
|
|
977
|
-
.command('modules-except [excludedSpaces] [action]')
|
|
978
|
-
.action(function (excludedSpaces, command) {
|
|
943
|
+
program.command('modules-except [excludedSpaces] [action]').action(function (excludedSpaces, command) {
|
|
979
944
|
executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);
|
|
980
945
|
});
|
|
981
946
|
program
|
|
@@ -1008,10 +973,7 @@ var executeCommandForEachModule = function (modules, command, includedSpaces, ex
|
|
|
1008
973
|
modules = modules.filter(function (module) { return excludedSpaces.indexOf(module.moduleName) === -1; });
|
|
1009
974
|
log('Filtering excluded spaces');
|
|
1010
975
|
}
|
|
1011
|
-
log("Executing '" +
|
|
1012
|
-
command +
|
|
1013
|
-
"' on modules " +
|
|
1014
|
-
modules.map(function (m) { return m.moduleName; }).join(', '));
|
|
976
|
+
log("Executing '" + command + "' on modules " + modules.map(function (m) { return m.moduleName; }).join(', '));
|
|
1015
977
|
var p = Promise.resolve(true);
|
|
1016
978
|
modules.forEach(function (module) {
|
|
1017
979
|
p = p.then(function () {
|
|
@@ -1023,8 +985,7 @@ var executeCommandForEachModule = function (modules, command, includedSpaces, ex
|
|
|
1023
985
|
};
|
|
1024
986
|
var executeCommandForModule = function (module, command) {
|
|
1025
987
|
var moduleDetails = getLincdModules().find(function (modDetails) {
|
|
1026
|
-
return modDetails.packageName.indexOf(module) !== -1 ||
|
|
1027
|
-
modDetails.moduleName.indexOf(module) !== -1;
|
|
988
|
+
return modDetails.packageName.indexOf(module) !== -1 || modDetails.moduleName.indexOf(module) !== -1;
|
|
1028
989
|
});
|
|
1029
990
|
if (moduleDetails) {
|
|
1030
991
|
log("Executing 'cd " + moduleDetails.path + ' && lincd ' + command + "'");
|
|
@@ -1041,14 +1002,8 @@ program.command('dev [target] [mode]').action(function (target, mode) {
|
|
|
1041
1002
|
if (target == 'es5' || target == 'es6') {
|
|
1042
1003
|
// log('> Starting continuous development build for '+target+' target')
|
|
1043
1004
|
log('starting continuous development build');
|
|
1044
|
-
log('grunt dev' +
|
|
1045
|
-
|
|
1046
|
-
(mode ? '-' + mode : '') +
|
|
1047
|
-
' --color');
|
|
1048
|
-
var command = exec('grunt dev' +
|
|
1049
|
-
(target ? '-' + target : '') +
|
|
1050
|
-
(mode ? '-' + mode : '') +
|
|
1051
|
-
' --color');
|
|
1005
|
+
log('grunt dev' + (target ? '-' + target : '') + (mode ? '-' + mode : '') + ' --color');
|
|
1006
|
+
var command = exec('grunt dev' + (target ? '-' + target : '') + (mode ? '-' + mode : '') + ' --color');
|
|
1052
1007
|
command.stdout.pipe(process.stdout);
|
|
1053
1008
|
command.stderr.pipe(process.stderr);
|
|
1054
1009
|
}
|
|
@@ -1109,8 +1064,7 @@ function logHelp() {
|
|
|
1109
1064
|
chalk.cyan('- see which modules need to be published or build'),
|
|
1110
1065
|
);*/
|
|
1111
1066
|
console.log(chalk.green('\nOther commands:'));
|
|
1112
|
-
console.log(chalk.blue('- info ') +
|
|
1113
|
-
chalk.cyan('- print the version of this tool and where it runs from'));
|
|
1067
|
+
console.log(chalk.blue('- info ') + chalk.cyan('- print the version of this tool and where it runs from'));
|
|
1114
1068
|
console.log(chalk.blue('- help ') + chalk.cyan('- print this message'));
|
|
1115
1069
|
}
|
|
1116
1070
|
program.parse(process.argv);
|
package/lib/config-grunt.js
CHANGED
|
@@ -21,8 +21,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
21
21
|
var buildServer = !config.environment || config.environment == 'server';
|
|
22
22
|
var buildFrontend = !config.environment || config.environment == 'frontend';
|
|
23
23
|
//when not specified and we ARe building frontend OR we are compiling the server for es5.. or if simply specified, then es5 is targeted
|
|
24
|
-
var targetES5 = (!config.target && (buildFrontend || config.es5Server)) ||
|
|
25
|
-
config.target == 'es5';
|
|
24
|
+
var targetES5 = (!config.target && (buildFrontend || config.es5Server)) || config.target == 'es5';
|
|
26
25
|
var targetES6 = !config.target || config.target == 'es6';
|
|
27
26
|
var targets = [];
|
|
28
27
|
if (targetES5)
|
|
@@ -53,9 +52,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
53
52
|
grunt.registerTask('dev', targetES6 ? ['prepare-build', 'dev-es6'] : ['prepare-build', 'dev-es5']);
|
|
54
53
|
grunt.registerTask('build', targets.map(function (target) { return 'build-' + target; }));
|
|
55
54
|
if (buildFrontend) {
|
|
56
|
-
grunt.registerTask('build-frontend', __spreadArray([
|
|
57
|
-
'prepare-build'
|
|
58
|
-
], targets.map(function (target) { return 'webpack:build-' + target; })));
|
|
55
|
+
grunt.registerTask('build-frontend', __spreadArray(['prepare-build'], targets.map(function (target) { return 'webpack:build-' + target; })));
|
|
59
56
|
}
|
|
60
57
|
grunt.registerTask('build-production', utils_1.flatten([
|
|
61
58
|
'clean:lib',
|
|
@@ -69,10 +66,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
69
66
|
}
|
|
70
67
|
//specific tasks
|
|
71
68
|
grunt.registerTask('prepare-build', prepareBuild);
|
|
72
|
-
grunt.registerTask('dev-es6-production', [
|
|
73
|
-
'prepare-build',
|
|
74
|
-
'concurrent:dev-prod',
|
|
75
|
-
]);
|
|
69
|
+
grunt.registerTask('dev-es6-production', ['prepare-build', 'concurrent:dev-prod']);
|
|
76
70
|
grunt.registerTask('dev-es6', ['prepare-build', 'concurrent:dev']);
|
|
77
71
|
grunt.registerTask('dev-es5', ['prepare-build', 'concurrent:dev-es5']);
|
|
78
72
|
//build-es5 is by default just the frontend because the server is es6
|
|
@@ -90,11 +84,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
90
84
|
buildServer ? ['clean:lib', 'exec:build-lib', 'copy:lib'] : null,
|
|
91
85
|
// 'exec:shapes',
|
|
92
86
|
]));
|
|
93
|
-
grunt.registerTask('build-lib', [
|
|
94
|
-
'prepare-build',
|
|
95
|
-
'exec:build-lib',
|
|
96
|
-
'copy:lib',
|
|
97
|
-
]);
|
|
87
|
+
grunt.registerTask('build-lib', ['prepare-build', 'exec:build-lib', 'copy:lib']);
|
|
98
88
|
grunt.registerTask('build-production-es5', [
|
|
99
89
|
'prepare-build',
|
|
100
90
|
'webpack:prod-es5',
|
package/lib/config-webpack.js
CHANGED
|
@@ -28,8 +28,7 @@ var path = require('path');
|
|
|
28
28
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
29
29
|
var WebpackLicencePlugin = require('webpack-license-plugin');
|
|
30
30
|
var TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
31
|
-
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
|
|
32
|
-
.BundleAnalyzerPlugin;
|
|
31
|
+
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
33
32
|
var TerserPlugin = require('terser-webpack-plugin');
|
|
34
33
|
var exec = require('child_process').exec;
|
|
35
34
|
var NODE_ENV = process.env.NODE_ENV;
|
|
@@ -66,9 +65,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
66
65
|
new ExtractTextPlugin(config.cssFileName ? config.cssFileName : cleanModuleName + '.css'),
|
|
67
66
|
new MiniCssExtractPlugin({
|
|
68
67
|
// linkType: false,
|
|
69
|
-
filename: config.cssFileName
|
|
70
|
-
? config.cssFileName
|
|
71
|
-
: cleanModuleName + '.css'
|
|
68
|
+
filename: config.cssFileName ? config.cssFileName : cleanModuleName + '.css'
|
|
72
69
|
}),
|
|
73
70
|
new WebpackLicencePlugin({
|
|
74
71
|
excludedPackageTest: function (packageName, version) {
|
|
@@ -136,19 +133,25 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
136
133
|
globalModulePaths: [/tailwind/]
|
|
137
134
|
},
|
|
138
135
|
tailwindcss: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
136
|
+
safelist: productionMode
|
|
137
|
+
? {}
|
|
138
|
+
: {
|
|
139
|
+
//in development mode we allow all classes here, so that you can easily develop
|
|
140
|
+
pattern: /./,
|
|
141
|
+
variants: ['sm', 'md', 'lg', 'xl', '2xl']
|
|
142
|
+
},
|
|
143
|
+
// purge: {
|
|
144
|
+
// enabled: productionMode,
|
|
145
|
+
content: [
|
|
146
|
+
'./src/**/*.tsx',
|
|
147
|
+
'./src/**/*.ts',
|
|
148
|
+
//also include @dacore modules which are internalized with the "internal" config option
|
|
149
|
+
//imports like ... from '@dacore/module/lib/views/SomeView' will
|
|
150
|
+
//these modules should live in the node_modules folder of the root of the site
|
|
151
|
+
//TODO: remake this with multiple lincd modules
|
|
152
|
+
// '../../node_modules/@dacore/*/lib/**/*.js',
|
|
153
|
+
// './node_modules/@dacore/*/lib/**/*.js',
|
|
154
|
+
]
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
}
|
|
@@ -197,8 +200,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
197
200
|
plugins.push(new webpack.NormalModuleReplacementPlugin(/\lincd\/lib\//, function (resource, match) {
|
|
198
201
|
var moduleName = resource.request.match(/lincd\/lib\//)[1];
|
|
199
202
|
if (config.internalsources.indexOf(moduleName) !== -1) {
|
|
200
|
-
console.log(colors.magenta('internal sources + ES5: Replacing /lib/ with /src/ for source-internalised module ' +
|
|
201
|
-
moduleName));
|
|
203
|
+
console.log(colors.magenta('internal sources + ES5: Replacing /lib/ with /src/ for source-internalised module ' + moduleName));
|
|
202
204
|
resource.request = resource.request.replace('/lib/', '/src/');
|
|
203
205
|
console.log(colors.magenta('internal sources + ES5: ' + resource.request));
|
|
204
206
|
console.log(colors.red("WARNING: Make sure you have the TYPESCRIPT SOURCE FILES of the modules listed as 'internal' AVAILABLE ON YOUR LOCAL MACHINE. So if you check in node_modules/your-internalised-module - that should be a symbolic link and you will find a 'src' folder with typescript files there."));
|
|
@@ -208,9 +210,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
208
210
|
return {
|
|
209
211
|
entry: config.entry ? config.entry : './src/index.ts',
|
|
210
212
|
output: {
|
|
211
|
-
filename: (config.filename ? config.filename : cleanModuleName) +
|
|
212
|
-
(es5 ? '.es5' : '') +
|
|
213
|
-
'.js',
|
|
213
|
+
filename: (config.filename ? config.filename : cleanModuleName) + (es5 ? '.es5' : '') + '.js',
|
|
214
214
|
path: path.resolve(process.cwd(), config.bundlePath || 'dist'),
|
|
215
215
|
devtoolModuleFilenameTemplate: moduleName + '/[resource-path]'
|
|
216
216
|
},
|