cc-core-cli 1.0.76 → 1.0.78
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/package.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start:dev": "cp .env.develop .env && NODE_OPTIONS='-r @newrelic/next' node index",
|
|
8
8
|
"build": "next build",
|
|
9
|
+
"postinstall": "node post-install.js",
|
|
9
10
|
"production": "NODE_OPTIONS='-r @newrelic/next' node index",
|
|
10
11
|
"analyze": "cross-env ANALYZE=true next build",
|
|
11
12
|
"analyze:server": "cross-env BUNDLE_ANALYZE=server next build",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require("fs-extra");
|
|
2
|
+
const ora = require("ora");
|
|
3
|
+
const { exec } = require("child_process");
|
|
4
|
+
|
|
5
|
+
const mainPath = "./modules";
|
|
6
|
+
const moduleDependencies = [];
|
|
7
|
+
const spinner = ora("Checking module dependencies").start();
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const modules = fs.readdirSync(mainPath);
|
|
11
|
+
for (const folder of modules || []) {
|
|
12
|
+
if (!fs.lstatSync(`${mainPath}/${folder}`).isDirectory()) continue;
|
|
13
|
+
if (!fs.existsSync(`${mainPath}/${folder}/module.json`)) continue;
|
|
14
|
+
|
|
15
|
+
const moduleConfig = require(`${mainPath}/${folder}/module.json`);
|
|
16
|
+
if (!moduleConfig.dependencies) continue;
|
|
17
|
+
|
|
18
|
+
for (const lib in moduleConfig.dependencies) {
|
|
19
|
+
moduleDependencies.push(`${lib}@${moduleConfig.dependencies[lib]}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
spinner.succeed("Checking module depencies done.");
|
|
24
|
+
|
|
25
|
+
if (!moduleDependencies.length) return true;
|
|
26
|
+
|
|
27
|
+
spinner.start(`Install module dependencies`);
|
|
28
|
+
|
|
29
|
+
exec(`npm install --no-save ${moduleDependencies.join(" ")}`, err => {
|
|
30
|
+
if (err) {
|
|
31
|
+
return spinner.fail(`Install module dependencies failed ${err.message}`);
|
|
32
|
+
}
|
|
33
|
+
spinner.succeed("Install module dependencies done.");
|
|
34
|
+
return true;
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
spinner.succeed('No modules folder')
|
|
38
|
+
}
|