@maxelms/create-plugin-cli 1.1.0
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.en.md +36 -0
- package/README.md +12 -0
- package/bin/build.js +29 -0
- package/bin/compress.js +35 -0
- package/bin/copy.js +39 -0
- package/bin/index.js +53 -0
- package/configuration-schema.json +829 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +242 -0
- package/lib/utils.d.ts +18 -0
- package/lib/utils.js +114 -0
- package/package.json +50 -0
- package/templates/jQuery-micro-app/package.json.tpl +19 -0
- package/templates/jQuery-micro-app/src/README.md +5 -0
- package/templates/jQuery-micro-app/src/configuration.json +30 -0
- package/templates/jQuery-micro-app/src/index.html +17 -0
- package/templates/jQuery-micro-app/src/main.js.tpl +31 -0
- package/templates/jQuery-micro-app/src/manifest.json.tpl +9 -0
- package/templates/jQuery-micro-app/src/style.css +11 -0
- package/templates/maxelms-navigation/.babelrc +7 -0
- package/templates/maxelms-navigation/.gitignore.tpl +23 -0
- package/templates/maxelms-navigation/README.md +15 -0
- package/templates/maxelms-navigation/global.d.ts +2 -0
- package/templates/maxelms-navigation/index.html +16 -0
- package/templates/maxelms-navigation/package.json +65 -0
- package/templates/maxelms-navigation/patches/live2d-widget@3.1.4.patch +4534 -0
- package/templates/maxelms-navigation/pnpm-lock.yaml +7993 -0
- package/templates/maxelms-navigation/src/App.tsx +47 -0
- package/templates/maxelms-navigation/src/components/Actions/ColorPicker.tsx +86 -0
- package/templates/maxelms-navigation/src/components/Actions/SwitchApps.tsx +83 -0
- package/templates/maxelms-navigation/src/components/Actions/index.tsx +95 -0
- package/templates/maxelms-navigation/src/components/Cutie.tsx +24 -0
- package/templates/maxelms-navigation/src/components/Enterprises.tsx +46 -0
- package/templates/maxelms-navigation/src/components/Logo.tsx +29 -0
- package/templates/maxelms-navigation/src/components/Menus/MenuPanel.tsx +55 -0
- package/templates/maxelms-navigation/src/components/Menus/index.tsx +50 -0
- package/templates/maxelms-navigation/src/components/Search.tsx +77 -0
- package/templates/maxelms-navigation/src/imgs/corp-admin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/saas-admin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/skin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/tenant-admin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/user-center.svg +1 -0
- package/templates/maxelms-navigation/src/index.tsx +14 -0
- package/templates/maxelms-navigation/src/interface.ts +27 -0
- package/templates/maxelms-navigation/src/style.less.tpl +278 -0
- package/templates/maxelms-navigation/src/utils.ts.tpl +40 -0
- package/templates/maxelms-navigation/tsconfig.json +111 -0
- package/templates/maxelms-navigation/webpack.config.js +119 -0
- package/templates/maxelms-script/.babelrc +5 -0
- package/templates/maxelms-script/.gitignore.tpl +23 -0
- package/templates/maxelms-script/README.md +0 -0
- package/templates/maxelms-script/global.d.ts +2 -0
- package/templates/maxelms-script/index.html +10 -0
- package/templates/maxelms-script/package.json.tpl +55 -0
- package/templates/maxelms-script/pnpm-lock.yaml +7699 -0
- package/templates/maxelms-script/src/App.tsx +15 -0
- package/templates/maxelms-script/src/index.tsx +15 -0
- package/templates/maxelms-script/src/style.less.tpl +8 -0
- package/templates/maxelms-script/src/utils.ts.tpl +2 -0
- package/templates/maxelms-script/tsconfig.json +111 -0
- package/templates/maxelms-script/webpack.config.js +92 -0
- package/templates/maxelms-style/.gitignore.tpl +38 -0
- package/templates/maxelms-style/README.md +0 -0
- package/templates/maxelms-style/index.css +3 -0
- package/templates/maxelms-style/index.less +4 -0
- package/templates/maxelms-style/package.json.tpl +17 -0
- package/templates/playground/dist/main.css +2 -0
- package/templates/playground/dist/main.js +2 -0
- package/templates/playground/dist/main.js.LICENSE.txt +52 -0
- package/templates/playground/dist/playground.html +1 -0
- package/templates/playground/dist/react-dom.production.min.js +2 -0
- package/templates/playground/dist/react-dom.production.min.js.LICENSE.txt +8 -0
- package/templates/playground/dist/react.production.min.js +2 -0
- package/templates/playground/dist/react.production.min.js.LICENSE.txt +8 -0
- package/templates/playground/dist/zone.umd.min.js +2 -0
- package/templates/playground/dist/zone.umd.min.js.LICENSE.txt +29 -0
- package/templates/project/package.json +17 -0
- package/templates/react-micro-app/.babelrc +6 -0
- package/templates/react-micro-app/.gitignore.tpl +23 -0
- package/templates/react-micro-app/README.md +5 -0
- package/templates/react-micro-app/manifest.json.tpl +21 -0
- package/templates/react-micro-app/package.json.tpl +53 -0
- package/templates/react-micro-app/public/configuration.json +30 -0
- package/templates/react-micro-app/public/index.html +10 -0
- package/templates/react-micro-app/src/components/NoMatch.tsx +15 -0
- package/templates/react-micro-app/src/context/masterContext.ts +11 -0
- package/templates/react-micro-app/src/index.tsx +52 -0
- package/templates/react-micro-app/src/layouts/BasicLayout.less +16 -0
- package/templates/react-micro-app/src/layouts/BasicLayout.tsx +21 -0
- package/templates/react-micro-app/src/pages/Home/index.less +15 -0
- package/templates/react-micro-app/src/pages/Home/index.tsx +33 -0
- package/templates/react-micro-app/src/pages/List/index.less +12 -0
- package/templates/react-micro-app/src/pages/List/index.tsx +12 -0
- package/templates/react-micro-app/src/pages/New/index.less +12 -0
- package/templates/react-micro-app/src/pages/New/index.tsx +12 -0
- package/templates/react-micro-app/src/pages/View/index.less +12 -0
- package/templates/react-micro-app/src/pages/View/index.tsx +12 -0
- package/templates/react-micro-app/src/public-path.js +4 -0
- package/templates/react-micro-app/src/router.tsx +44 -0
- package/templates/react-micro-app/tsconfig.json +102 -0
- package/templates/react-micro-app/typings.d.ts +11 -0
- package/templates/react-micro-app/webpack.config.js.tpl +178 -0
- package/templates/react-micro-app-umi/.editorconfig +16 -0
- package/templates/react-micro-app-umi/.env +1 -0
- package/templates/react-micro-app-umi/.gitignore.tpl +23 -0
- package/templates/react-micro-app-umi/.prettierignore +8 -0
- package/templates/react-micro-app-umi/.prettierrc +11 -0
- package/templates/react-micro-app-umi/.umirc.ts.tpl +31 -0
- package/templates/react-micro-app-umi/README.md +5 -0
- package/templates/react-micro-app-umi/manifest.json.tpl +21 -0
- package/templates/react-micro-app-umi/package.json.tpl +42 -0
- package/templates/react-micro-app-umi/public/basicConfiguration.json +30 -0
- package/templates/react-micro-app-umi/public/configuration.json +30 -0
- package/templates/react-micro-app-umi/src/layout/BasicLayout.tsx +16 -0
- package/templates/react-micro-app-umi/src/pages/about.tsx +11 -0
- package/templates/react-micro-app-umi/src/pages/home.tsx +19 -0
- package/templates/react-micro-app-umi/tsconfig.json +36 -0
- package/templates/react-micro-app-umi/typings.d.ts +8 -0
- package/templates/react-micro-button/.gitignore.tpl +23 -0
- package/templates/react-micro-button/README.md +5 -0
- package/templates/react-micro-button/configuration/Configuration.tsx +113 -0
- package/templates/react-micro-button/configuration/index.css +8 -0
- package/templates/react-micro-button/configuration/index.tsx +6 -0
- package/templates/react-micro-button/manifest.json.tpl +3 -0
- package/templates/react-micro-button/package.json.tpl +49 -0
- package/templates/react-micro-button/postcss.config.js +5 -0
- package/templates/react-micro-button/public/basicConfiguration.json +30 -0
- package/templates/react-micro-button/public/configuration.html +10 -0
- package/templates/react-micro-button/public/configuration.json +30 -0
- package/templates/react-micro-button/public/index.html +10 -0
- package/templates/react-micro-button/src/App.tsx +41 -0
- package/templates/react-micro-button/src/app.less +0 -0
- package/templates/react-micro-button/src/index.less +0 -0
- package/templates/react-micro-button/src/index.tsx +30 -0
- package/templates/react-micro-button/tsconfig.json +11 -0
- package/templates/react-micro-button/webpack.config.js.tpl +150 -0
- package/templates/react-micro-field/.babelrc +5 -0
- package/templates/react-micro-field/.gitignore.tpl +23 -0
- package/templates/react-micro-field/README.md +5 -0
- package/templates/react-micro-field/configuration/Configuration.tsx +113 -0
- package/templates/react-micro-field/configuration/index.css +8 -0
- package/templates/react-micro-field/configuration/index.tsx +6 -0
- package/templates/react-micro-field/manifest.json.tpl +7 -0
- package/templates/react-micro-field/package.json.tpl +50 -0
- package/templates/react-micro-field/postcss.config.js +5 -0
- package/templates/react-micro-field/public/basicConfiguration.json +30 -0
- package/templates/react-micro-field/public/configuration.html +10 -0
- package/templates/react-micro-field/public/configuration.json +30 -0
- package/templates/react-micro-field/public/index.html +10 -0
- package/templates/react-micro-field/src/App.tsx.tpl +51 -0
- package/templates/react-micro-field/src/index.tsx +29 -0
- package/templates/react-micro-field/src/style.less.tpl +12 -0
- package/templates/react-micro-field/tsconfig.json +11 -0
- package/templates/react-micro-field/webpack.config.js.tpl +157 -0
- package/templates/react-micro-field-umi/.editorconfig +16 -0
- package/templates/react-micro-field-umi/.gitignore.tpl +24 -0
- package/templates/react-micro-field-umi/.prettierignore +8 -0
- package/templates/react-micro-field-umi/.prettierrc +11 -0
- package/templates/react-micro-field-umi/README.md +5 -0
- package/templates/react-micro-field-umi/config/config.ts.tpl +41 -0
- package/templates/react-micro-field-umi/config/plugin.ts +18 -0
- package/templates/react-micro-field-umi/manifest.json.tpl +7 -0
- package/templates/react-micro-field-umi/package.json.tpl +48 -0
- package/templates/react-micro-field-umi/public/basicConfiguration.json +30 -0
- package/templates/react-micro-field-umi/public/configuration.json +30 -0
- package/templates/react-micro-field-umi/src/app.tsx +46 -0
- package/templates/react-micro-field-umi/src/global.tsx +0 -0
- package/templates/react-micro-field-umi/src/hooks/masterProps.ts +33 -0
- package/templates/react-micro-field-umi/src/layouts/BasicLayout.tsx +17 -0
- package/templates/react-micro-field-umi/src/pages/configuration/index.tsx +90 -0
- package/templates/react-micro-field-umi/src/pages/index.tsx.tpl +54 -0
- package/templates/react-micro-field-umi/src/pages/interface.ts +12 -0
- package/templates/react-micro-field-umi/src/pages/style.less.tpl +15 -0
- package/templates/react-micro-field-umi/src/public-path.js +5 -0
- package/templates/react-micro-field-umi/tsconfig.json +37 -0
- package/templates/react-micro-field-umi/typings.d.ts +10 -0
- package/templates/react-micro-plugin/.babelrc +5 -0
- package/templates/react-micro-plugin/.gitignore.tpl +23 -0
- package/templates/react-micro-plugin/README.md +5 -0
- package/templates/react-micro-plugin/configuration/Configuration.tsx +114 -0
- package/templates/react-micro-plugin/configuration/index.css +8 -0
- package/templates/react-micro-plugin/configuration/index.tsx +6 -0
- package/templates/react-micro-plugin/manifest.json.tpl +3 -0
- package/templates/react-micro-plugin/package.json.tpl +50 -0
- package/templates/react-micro-plugin/postcss.config.js +5 -0
- package/templates/react-micro-plugin/public/configuration.html +10 -0
- package/templates/react-micro-plugin/public/configuration.json +30 -0
- package/templates/react-micro-plugin/public/index.html +10 -0
- package/templates/react-micro-plugin/src/App.tsx.tpl +32 -0
- package/templates/react-micro-plugin/src/index.tsx +29 -0
- package/templates/react-micro-plugin/src/style.less.tpl +12 -0
- package/templates/react-micro-plugin/tsconfig.json +11 -0
- package/templates/react-micro-plugin/webpack.config.js.tpl +156 -0
- package/templates/react-micro-plugin-umi/.editorconfig +16 -0
- package/templates/react-micro-plugin-umi/.gitignore.tpl +24 -0
- package/templates/react-micro-plugin-umi/.prettierignore +8 -0
- package/templates/react-micro-plugin-umi/.prettierrc +11 -0
- package/templates/react-micro-plugin-umi/README.md +5 -0
- package/templates/react-micro-plugin-umi/config/config.ts +29 -0
- package/templates/react-micro-plugin-umi/config/plugin.ts +18 -0
- package/templates/react-micro-plugin-umi/manifest.json.tpl +3 -0
- package/templates/react-micro-plugin-umi/package.json.tpl +48 -0
- package/templates/react-micro-plugin-umi/public/configuration.json +30 -0
- package/templates/react-micro-plugin-umi/src/app.tsx +46 -0
- package/templates/react-micro-plugin-umi/src/global.tsx +0 -0
- package/templates/react-micro-plugin-umi/src/hooks/masterProps.ts +34 -0
- package/templates/react-micro-plugin-umi/src/layouts/BasicLayout.tsx +17 -0
- package/templates/react-micro-plugin-umi/src/pages/configuration/index.tsx +113 -0
- package/templates/react-micro-plugin-umi/src/pages/index.tsx +21 -0
- package/templates/react-micro-plugin-umi/src/public-path.js +5 -0
- package/templates/react-micro-plugin-umi/tsconfig.json +37 -0
- package/templates/react-micro-plugin-umi/typings.d.ts +10 -0
- package/templates/vue-micro-app/.gitignore.tpl +23 -0
- package/templates/vue-micro-app/README.md +5 -0
- package/templates/vue-micro-app/babel.config.js +15 -0
- package/templates/vue-micro-app/manifest.json.tpl +21 -0
- package/templates/vue-micro-app/package.json.tpl +54 -0
- package/templates/vue-micro-app/public/configuration.json +30 -0
- package/templates/vue-micro-app/public/favicon.ico +0 -0
- package/templates/vue-micro-app/public/index.html +10 -0
- package/templates/vue-micro-app/src/App.vue +35 -0
- package/templates/vue-micro-app/src/assets/logo.png +0 -0
- package/templates/vue-micro-app/src/components/HelloWorld.vue +32 -0
- package/templates/vue-micro-app/src/main.js +80 -0
- package/templates/vue-micro-app/src/public-path.js +5 -0
- package/templates/vue-micro-app/src/routes.js +19 -0
- package/templates/vue-micro-app/src/views/About.vue +13 -0
- package/templates/vue-micro-app/src/views/Home.vue +21 -0
- package/templates/vue-micro-app/vue.config.js.tpl +35 -0
- package/templates/vue-micro-button/.gitignore.tpl +23 -0
- package/templates/vue-micro-button/README.md +5 -0
- package/templates/vue-micro-button/babel.config.js +8 -0
- package/templates/vue-micro-button/configuration/App.vue +78 -0
- package/templates/vue-micro-button/configuration/main.js +11 -0
- package/templates/vue-micro-button/manifest.json.tpl +3 -0
- package/templates/vue-micro-button/package.json.tpl +51 -0
- package/templates/vue-micro-button/public/basicConfiguration.json +30 -0
- package/templates/vue-micro-button/public/configuration.html +10 -0
- package/templates/vue-micro-button/public/configuration.json +30 -0
- package/templates/vue-micro-button/public/index.html +12 -0
- package/templates/vue-micro-button/src/App.vue +46 -0
- package/templates/vue-micro-button/src/main.js +44 -0
- package/templates/vue-micro-button/vue.config.js.tpl +51 -0
- package/templates/vue-micro-field/.gitignore.tpl +23 -0
- package/templates/vue-micro-field/README.md +5 -0
- package/templates/vue-micro-field/babel.config.js +8 -0
- package/templates/vue-micro-field/configuration/App.vue +78 -0
- package/templates/vue-micro-field/configuration/main.js +11 -0
- package/templates/vue-micro-field/manifest.json.tpl +7 -0
- package/templates/vue-micro-field/package.json.tpl +53 -0
- package/templates/vue-micro-field/public/basicConfiguration.json +30 -0
- package/templates/vue-micro-field/public/configuration.html +10 -0
- package/templates/vue-micro-field/public/configuration.json +30 -0
- package/templates/vue-micro-field/public/index.html +10 -0
- package/templates/vue-micro-field/scripts/compress.js +32 -0
- package/templates/vue-micro-field/src/App.vue.tpl +55 -0
- package/templates/vue-micro-field/src/main.js +38 -0
- package/templates/vue-micro-field/src/style.less.tpl +16 -0
- package/templates/vue-micro-field/vue.config.js.tpl +51 -0
- package/templates/vue-micro-plugin/.gitignore.tpl +23 -0
- package/templates/vue-micro-plugin/README.md +24 -0
- package/templates/vue-micro-plugin/babel.config.js +8 -0
- package/templates/vue-micro-plugin/configuration/App.vue +100 -0
- package/templates/vue-micro-plugin/configuration/main.js +11 -0
- package/templates/vue-micro-plugin/manifest.json.tpl +3 -0
- package/templates/vue-micro-plugin/package.json.tpl +56 -0
- package/templates/vue-micro-plugin/public/configuration.html +10 -0
- package/templates/vue-micro-plugin/public/configuration.json +30 -0
- package/templates/vue-micro-plugin/public/index.html +10 -0
- package/templates/vue-micro-plugin/scripts/compress.js +32 -0
- package/templates/vue-micro-plugin/src/App.vue.tpl +42 -0
- package/templates/vue-micro-plugin/src/main.js +38 -0
- package/templates/vue-micro-plugin/src/style.less.tpl +16 -0
- package/templates/vue-micro-plugin/vue.config.js.tpl +53 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# create-plugin-cli
|
|
2
|
+
|
|
3
|
+
#### Description
|
|
4
|
+
描述
|
|
5
|
+
|
|
6
|
+
#### Software Architecture
|
|
7
|
+
Software architecture description
|
|
8
|
+
|
|
9
|
+
#### Installation
|
|
10
|
+
|
|
11
|
+
1. xxxx
|
|
12
|
+
2. xxxx
|
|
13
|
+
3. xxxx
|
|
14
|
+
|
|
15
|
+
#### Instructions
|
|
16
|
+
|
|
17
|
+
1. xxxx
|
|
18
|
+
2. xxxx
|
|
19
|
+
3. xxxx
|
|
20
|
+
|
|
21
|
+
#### Contribution
|
|
22
|
+
|
|
23
|
+
1. Fork the repository
|
|
24
|
+
2. Create Feat_xxx branch
|
|
25
|
+
3. Commit your code
|
|
26
|
+
4. Create Pull Request
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
#### Gitee Feature
|
|
30
|
+
|
|
31
|
+
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
|
32
|
+
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
|
33
|
+
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
|
34
|
+
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
|
35
|
+
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
|
36
|
+
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
package/README.md
ADDED
package/bin/build.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const program = require('commander')
|
|
4
|
+
|
|
5
|
+
program
|
|
6
|
+
.version(`maxelms-plugin-cli ${require('../package').version}`)
|
|
7
|
+
.usage('maxelms-plugin-cli -cp -c')
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.option('-cp, --copy [copy]')
|
|
12
|
+
.option('-c, --compress [compress]')
|
|
13
|
+
.description('maxelms-plugin-cli for maxelms system')
|
|
14
|
+
.action(() => {
|
|
15
|
+
const {
|
|
16
|
+
compress,
|
|
17
|
+
copy
|
|
18
|
+
} = program.opts()
|
|
19
|
+
|
|
20
|
+
if (copy) {
|
|
21
|
+
const copyDir = require('./copy.js')
|
|
22
|
+
copyDir(typeof copy === 'boolean' ? './src' : copy, './dist')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (compress) require('./compress.js')
|
|
26
|
+
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
program.parse(process.argv);
|
package/bin/compress.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const archiver = require('archiver');
|
|
5
|
+
|
|
6
|
+
const distDir = 'dist'
|
|
7
|
+
if (fs.existsSync(distDir)) {
|
|
8
|
+
if (fs.existsSync('dist.maxplugin')) {
|
|
9
|
+
fs.unlinkSync('dist.maxplugin')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const output = fs.createWriteStream('dist.maxplugin');
|
|
13
|
+
const archive = archiver('zip', {
|
|
14
|
+
zlib: { level: 9 }
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
output.on('close', function() {
|
|
18
|
+
console.log('Compress completed!');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
archive.on('error', function(err) {
|
|
22
|
+
console.log('Compress failed!');
|
|
23
|
+
throw err;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
archive.pipe(output);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
archive.directory('dist/', 'dist');
|
|
30
|
+
|
|
31
|
+
archive.finalize();
|
|
32
|
+
} else {
|
|
33
|
+
console.log('Dist directory not found!');
|
|
34
|
+
}
|
|
35
|
+
|
package/bin/copy.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const del = require('del')
|
|
5
|
+
const copyDir = (src, dest = './dist') => {
|
|
6
|
+
const copy = (copySrc, copyDest) => {
|
|
7
|
+
const list = fs.readdirSync(copySrc)
|
|
8
|
+
list.forEach((item) => {
|
|
9
|
+
const fullPath = path.resolve(copySrc, item);
|
|
10
|
+
const stat = fs.statSync(fullPath)
|
|
11
|
+
const curSrc = path.resolve(copySrc, item)
|
|
12
|
+
const curDest = path.resolve(copyDest, item)
|
|
13
|
+
|
|
14
|
+
if (stat.isFile()) {
|
|
15
|
+
// 文件,直接复制
|
|
16
|
+
fs.writeFileSync(curDest, fs.readFileSync(curSrc))
|
|
17
|
+
} else if (stat.isDirectory()) {
|
|
18
|
+
// 目录,进行递归
|
|
19
|
+
fs.mkdirSync(curDest, { recursive: true })
|
|
20
|
+
copy(curSrc, curDest)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!fs.existsSync(src)) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
if (fs.existsSync(dest)) {
|
|
29
|
+
del.sync(dest)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
33
|
+
copy(src, dest);
|
|
34
|
+
|
|
35
|
+
console.log('Copy files completed!')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
module.exports = copyDir
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const program = require('commander');
|
|
4
|
+
|
|
5
|
+
/** 默认生成的项目名称 */
|
|
6
|
+
const defaultName = 'maxelms-plugin'
|
|
7
|
+
|
|
8
|
+
program
|
|
9
|
+
.version(`create-cp-plugin ${require('../package').version}`)
|
|
10
|
+
.usage('yarn cp-plugin <plugin-name>');
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.option('-t, --PROJECT_TYPE <PROJECT_TYPE>', [
|
|
14
|
+
'请选择项目类型:',
|
|
15
|
+
'MICROAPP',
|
|
16
|
+
'MICROFIELD',
|
|
17
|
+
'MICROPLUGIN',
|
|
18
|
+
].join('\n'))
|
|
19
|
+
.option('-f, --PROJECT_FRAME <PROJECT_FRAME>', [
|
|
20
|
+
`请选择前端框架`,
|
|
21
|
+
'react',
|
|
22
|
+
'vue',
|
|
23
|
+
].join('\n'))
|
|
24
|
+
.option('-c, --PROJECT_CONFIG_TYPE <PROJECT_CONFIG_TYPE>', [
|
|
25
|
+
`请选择配置类型`,
|
|
26
|
+
'JSON',
|
|
27
|
+
'HTML',
|
|
28
|
+
].join('\n'))
|
|
29
|
+
.option('-template, --TEMPLATE <TEMPLATE>', [
|
|
30
|
+
`请选择模板类型`,
|
|
31
|
+
'umi',
|
|
32
|
+
].join('\n'))
|
|
33
|
+
.argument('[plugin-name]', 'plugin name')
|
|
34
|
+
.description('create a plugin for maxelms system')
|
|
35
|
+
.action((name = defaultName) => {
|
|
36
|
+
|
|
37
|
+
/** 参数整理 */
|
|
38
|
+
const {
|
|
39
|
+
PROJECT_TYPE,
|
|
40
|
+
PROJECT_FRAME,
|
|
41
|
+
PROJECT_CONFIG_TYPE,
|
|
42
|
+
TEMPLATE,
|
|
43
|
+
} = program.opts()
|
|
44
|
+
|
|
45
|
+
require('../lib/index').default(name, {
|
|
46
|
+
PROJECT_TYPE,
|
|
47
|
+
PROJECT_FRAME,
|
|
48
|
+
PROJECT_CONFIG_TYPE,
|
|
49
|
+
TEMPLATE
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
program.parse(process.argv);
|