cc-core-cli 1.0.75 → 1.0.77
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/README.md
CHANGED
package/bin/index.js
CHANGED
|
@@ -23,8 +23,8 @@ if (action === 'init') {
|
|
|
23
23
|
const project = options['_'][1] || '.'
|
|
24
24
|
const path = options['_'][2] || '.'
|
|
25
25
|
|
|
26
|
-
if (!['core', 'admin', 'module'].includes(project)) {
|
|
27
|
-
console.log('Project should be one of [core|admin|module]!')
|
|
26
|
+
if (!['core', 'admin', 'module', 'admin_module'].includes(project)) {
|
|
27
|
+
console.log('Project should be one of [core|admin|module|admin_module]!')
|
|
28
28
|
return false
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -65,7 +65,7 @@ if (action === 'upgrade') {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const spinner = ora('(1/2) Copying files!').start();
|
|
68
|
-
const IGNORE_FILES = ['src/modules','docker-compose.yml','Dockerfile','package.json','version.json','README.md','custom.less', '.env.develop','_env','_gitignore','_npmrc'];
|
|
68
|
+
const IGNORE_FILES = ['src/modules', 'docker-compose.yml', 'Dockerfile', 'package.json', 'version.json', 'README.md', 'custom.less', '.env.develop', '_env', '_gitignore', '_npmrc'];
|
|
69
69
|
fs.copySync(`${__dirname}/../template/${project}`, '.', {
|
|
70
70
|
recursive: true,
|
|
71
71
|
filter: (name) => {
|
package/package.json
CHANGED
|
@@ -6,5 +6,8 @@ import "slick-carousel/slick/slick.css";
|
|
|
6
6
|
import "slick-carousel/slick/slick-theme.css";
|
|
7
7
|
|
|
8
8
|
import { CustomApp } from '@shopstack/cc-admin-lib'
|
|
9
|
+
import { importCustomModules } from '@shopstack/cc-admin-lib';
|
|
10
|
+
|
|
11
|
+
importCustomModules()
|
|
9
12
|
|
|
10
13
|
export default CustomApp
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
const DemoComponent = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div>
|
|
6
|
+
{'Demo Component'}
|
|
7
|
+
</div>
|
|
8
|
+
)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const SettingDemoComponent = () => {
|
|
12
|
+
return (
|
|
13
|
+
<div>Setting</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const name = "demo"
|
|
18
|
+
|
|
19
|
+
export const label = 'Demo'
|
|
20
|
+
|
|
21
|
+
export const settings = SettingDemoComponent
|
|
22
|
+
|
|
23
|
+
export const options = {
|
|
24
|
+
field_type: 'string',
|
|
25
|
+
allow_trigger: true,
|
|
26
|
+
allow_filter: true,
|
|
27
|
+
allow_display_permission: true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
DemoComponent.propsType = {
|
|
31
|
+
data: PropTypes.object,
|
|
32
|
+
disabled: PropTypes.bool,
|
|
33
|
+
schema: PropTypes.object,
|
|
34
|
+
relatedSchema: PropTypes.array
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
SettingDemoComponent.propsType = {}
|
|
38
|
+
|
|
39
|
+
export default DemoComponent
|