cc-core-cli 1.0.55 → 1.0.56

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-core-cli",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "Command Line Interface tool for generating project templates for the (Your Platform's Name) platform.",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -7,6 +7,7 @@
7
7
  "license": "UNLICENSED",
8
8
  "scripts": {
9
9
  "prebuild": "rimraf dist",
10
+ "postinstall": "node post-install.js",
10
11
  "build": "source ./newrelic.sh && nest build",
11
12
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
12
13
  "start": "nest start",
@@ -21,7 +22,7 @@
21
22
  "test:e2e": "jest --config ./test/jest-e2e.json"
22
23
  },
23
24
  "dependencies": {
24
- "@shopstack/cc-core-lib": "^2.5.33"
25
+ "@shopstack/cc-core-lib": "^2.5.41"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/bull": "^3.14.4",
@@ -0,0 +1,34 @@
1
+ const fs = require("fs-extra");
2
+ const ora = require("ora");
3
+ const { exec } = require("child_process");
4
+
5
+ const mainPath = "./src/modules";
6
+ const moduleDependencies = [];
7
+ const spinner = ora("Checking module dependencies").start();
8
+
9
+ const modules = fs.readdirSync(mainPath);
10
+ for (const folder of modules) {
11
+ if (!fs.lstatSync(`${mainPath}/${folder}`).isDirectory()) continue;
12
+ if (!fs.existsSync(`${mainPath}/${folder}/module.json`)) continue;
13
+
14
+ const moduleConfig = require(`${mainPath}/${folder}/module.json`);
15
+ if (!moduleConfig.dependencies) continue;
16
+
17
+ for (const lib in moduleConfig.dependencies) {
18
+ moduleDependencies.push(`${lib}@${moduleConfig.dependencies[lib]}`);
19
+ }
20
+ }
21
+
22
+ spinner.succeed("Checking module depencies done.");
23
+
24
+ if (!moduleDependencies.length) return true;
25
+
26
+ spinner.start(`Install module dependencies`);
27
+
28
+ exec(`npm install --no-save ${moduleDependencies.join(" ")}`, err => {
29
+ if (err) {
30
+ return spinner.fail(`Install module dependencies failed ${err.message}`);
31
+ }
32
+ spinner.succeed("Install module dependencies done.");
33
+ return true;
34
+ });