lincd-cli 0.2.73 → 0.2.75
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 +32 -5
- package/lib/cli.js +3 -0
- package/lib/config-grunt.js +18 -2
- package/package.json +2 -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.checkImports = 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.depCheckStaged = 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 chalk_1 = __importDefault(require("chalk"));
|
|
17
17
|
const child_process_1 = require("child_process");
|
|
18
18
|
const depcheck_1 = __importDefault(require("depcheck"));
|
|
@@ -24,6 +24,8 @@ const fs_1 = require("fs");
|
|
|
24
24
|
var glob = require('glob');
|
|
25
25
|
var variables = {};
|
|
26
26
|
var open = require('open');
|
|
27
|
+
var stagedGitFiles = require('staged-git-files');
|
|
28
|
+
const find_nearest_package_json_1 = require("find-nearest-package-json");
|
|
27
29
|
const createApp = (name, basePath = process.cwd()) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
30
|
if (!name) {
|
|
29
31
|
console.warn('Please provide a name as the first argument');
|
|
@@ -776,8 +778,32 @@ invalidImports = new Map()) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
776
778
|
}
|
|
777
779
|
});
|
|
778
780
|
exports.checkImports = checkImports;
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
+
const depCheckStaged = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
782
|
+
console.log('Checking dependencies of staged files');
|
|
783
|
+
stagedGitFiles(function (err, results) {
|
|
784
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
785
|
+
const packages = new Set();
|
|
786
|
+
yield Promise.all(results.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
787
|
+
// console.log('STAGED: ', file.filename);
|
|
788
|
+
let root = yield (0, find_nearest_package_json_1.findNearestPackageJson)(file.filename);
|
|
789
|
+
packages.add(root.path);
|
|
790
|
+
})));
|
|
791
|
+
[...packages].forEach((packageRoot) => {
|
|
792
|
+
const pack = JSON.parse(fs_extra_1.default.readFileSync(packageRoot, 'utf8'));
|
|
793
|
+
const srcPath = packageRoot.replace('package.json', '');
|
|
794
|
+
console.log('Checking dependencies of ' + chalk_1.default.blue(pack.name) + ':');
|
|
795
|
+
return (0, exports.depCheck)(process.cwd() + '/' + srcPath);
|
|
796
|
+
// console.log('check dependencies of ' + pack.name);
|
|
797
|
+
//
|
|
798
|
+
// console.log('ROOT of ' + file.filename + ': ' + root.path);
|
|
799
|
+
// console.log('ROOT of ' + file.filename + ': ' + root.data);
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
});
|
|
803
|
+
});
|
|
804
|
+
exports.depCheckStaged = depCheckStaged;
|
|
805
|
+
const depCheck = (path = process.cwd()) => __awaiter(void 0, void 0, void 0, function* () {
|
|
806
|
+
(0, depcheck_1.default)(path, {}, (results) => {
|
|
781
807
|
if (results.missing) {
|
|
782
808
|
let lincdPackages = getLocalLincdModules();
|
|
783
809
|
let missing = Object.keys(results.missing);
|
|
@@ -793,12 +819,13 @@ const depCheck = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
793
819
|
});
|
|
794
820
|
//currently just missing LINCD packages cause a hard failure exit code
|
|
795
821
|
if (missingLincdPackages.length > 0) {
|
|
796
|
-
console.warn(chalk_1.default.red('
|
|
822
|
+
console.warn(chalk_1.default.red('[ERROR] These LINCD packages are imported but they are not listed in package.json:\n- ' +
|
|
797
823
|
missingLincdPackages.join(',\n- ')));
|
|
798
824
|
process.exit(1);
|
|
799
825
|
}
|
|
800
826
|
else if (missing.length > 0) {
|
|
801
|
-
console.warn(chalk_1.default.
|
|
827
|
+
console.warn(chalk_1.default.magenta('Missing dependencies (for now a warning, soon an error):\n\t' +
|
|
828
|
+
missing.join(',\n\t')));
|
|
802
829
|
}
|
|
803
830
|
}
|
|
804
831
|
// if(Object.keys(results.invalidFiles).length > 0) {
|
package/lib/cli.js
CHANGED
|
@@ -128,6 +128,9 @@ program.command('dev [target] [mode]').action((target, mode) => {
|
|
|
128
128
|
program.command('depcheck').action((target, mode) => {
|
|
129
129
|
(0, cli_methods_1.depCheck)();
|
|
130
130
|
});
|
|
131
|
+
program.command('depcheck-staged').action((target, mode) => {
|
|
132
|
+
(0, cli_methods_1.depCheckStaged)();
|
|
133
|
+
});
|
|
131
134
|
program.command('check-imports').action((target, mode) => {
|
|
132
135
|
(0, cli_methods_1.checkImports)();
|
|
133
136
|
});
|
package/lib/config-grunt.js
CHANGED
|
@@ -89,9 +89,9 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
89
89
|
buildServer
|
|
90
90
|
? [
|
|
91
91
|
// 'clean:lib',
|
|
92
|
+
'exec:depcheck',
|
|
92
93
|
'exec:build-lib',
|
|
93
94
|
'copy:lib',
|
|
94
|
-
'exec:depcheck',
|
|
95
95
|
'exec:check-imports',
|
|
96
96
|
]
|
|
97
97
|
: null,
|
|
@@ -119,7 +119,23 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
119
119
|
'build-lib-es5': 'yarn exec tsc --pretty -p tsconfig-es5.json',
|
|
120
120
|
beforeBuildCommand: config.beforeBuildCommand,
|
|
121
121
|
'server-dev': 'tsc -w',
|
|
122
|
-
depcheck:
|
|
122
|
+
depcheck: {
|
|
123
|
+
command: 'yarn lincd depcheck',
|
|
124
|
+
// stdout: false,
|
|
125
|
+
// stderr: true,
|
|
126
|
+
// callback: function (error, stdout, stderr) {
|
|
127
|
+
// if (error) {
|
|
128
|
+
// // console.log(chalk.red('XX Error: ') + error.message);
|
|
129
|
+
// process.exit(1);
|
|
130
|
+
// return;
|
|
131
|
+
// }
|
|
132
|
+
// if (stderr) {
|
|
133
|
+
// process.exit(1);
|
|
134
|
+
// return;
|
|
135
|
+
// }
|
|
136
|
+
// // console.log(stdout);
|
|
137
|
+
// },
|
|
138
|
+
},
|
|
123
139
|
'check-imports': 'yarn lincd check-imports',
|
|
124
140
|
test: 'tsc -w',
|
|
125
141
|
// shapes: 'lincd shapes',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lincd-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.75",
|
|
4
4
|
"description": "Command line tools for the lincd.js library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"sass": "^1.55.0",
|
|
91
91
|
"sass-loader": "^13.0.2",
|
|
92
92
|
"source-map-loader": "^4.0.0",
|
|
93
|
+
"staged-git-files": "^1.3.0",
|
|
93
94
|
"tailwindcss": "^3.2.7",
|
|
94
95
|
"terser-webpack-plugin": "^5.3.6",
|
|
95
96
|
"ts-loader": "^9.4.1",
|