@weig_3078/cli-demo 0.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/.eslintignore +1 -0
- package/.eslintrc +73 -0
- package/README.md +1 -0
- package/bin/mvc.js +14 -0
- package/dist/mvc.js +135771 -0
- package/ejs-demo.js +29 -0
- package/lib/ConfigTransform.js +40 -0
- package/lib/Creator.js +29 -0
- package/lib/Generator.js +307 -0
- package/lib/PromptModuleAPI.js +13 -0
- package/lib/create.js +328 -0
- package/lib/generator/babel/index.js +15 -0
- package/lib/generator/linter/index.js +55 -0
- package/lib/generator/linter/template/.eslintrc.js +30 -0
- package/lib/generator/router/index.js +17 -0
- package/lib/generator/router/template/src/App.vue +33 -0
- package/lib/generator/router/template/src/router/index.js +30 -0
- package/lib/generator/router/template/src/views/About.vue +5 -0
- package/lib/generator/router/template/src/views/Home.vue +18 -0
- package/lib/generator/vue/index.js +20 -0
- package/lib/generator/vue/template/public/favicon.ico +0 -0
- package/lib/generator/vue/template/public/index.html +19 -0
- package/lib/generator/vue/template/src/App.vue +29 -0
- package/lib/generator/vue/template/src/assets/logo.png +0 -0
- package/lib/generator/vue/template/src/components/HelloWorld.vue +110 -0
- package/lib/generator/vue/template/src/main.js +8 -0
- package/lib/generator/vuex/index.js +13 -0
- package/lib/generator/vuex/template/src/store/index.js +15 -0
- package/lib/generator/webpack/index.js +27 -0
- package/lib/generator/webpack/template/build/base.config.js +68 -0
- package/lib/generator/webpack/template/build/dev.config.js +19 -0
- package/lib/generator/webpack/template/build/pro.config.js +16 -0
- package/lib/promptModules/babel.js +10 -0
- package/lib/promptModules/linter.js +48 -0
- package/lib/promptModules/router.js +19 -0
- package/lib/promptModules/vuex.js +8 -0
- package/lib/utils/clearConsole.js +13 -0
- package/lib/utils/codemods/injectImports.js +31 -0
- package/lib/utils/codemods/injectOptions.js +27 -0
- package/lib/utils/configTransforms.js +49 -0
- package/lib/utils/executeCommand.js +33 -0
- package/lib/utils/normalizeFilePaths.js +11 -0
- package/lib/utils/sortObject.js +32 -0
- package/lib/utils/stringifyJS.js +12 -0
- package/lib/utils/writeFileTree.js +12 -0
- package/package.json +53 -0
- package/rollup.config.cjs +43 -0
- package/scripts/verify-commit.js +24 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const resolve = require('@rollup/plugin-node-resolve').default
|
|
3
|
+
const commonjs = require('@rollup/plugin-commonjs')
|
|
4
|
+
const json = require('@rollup/plugin-json')
|
|
5
|
+
|
|
6
|
+
function stripShebang() {
|
|
7
|
+
return {
|
|
8
|
+
name: 'strip-shebang',
|
|
9
|
+
transform(code, id) {
|
|
10
|
+
if (!id.endsWith(path.join('bin', 'mvc.js'))) return null
|
|
11
|
+
return code.replace(/^#!.*\n/, '')
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
input: path.resolve(__dirname, 'bin/mvc.js'),
|
|
18
|
+
output: {
|
|
19
|
+
file: path.resolve(__dirname, 'dist/mvc.js'),
|
|
20
|
+
format: 'cjs',
|
|
21
|
+
banner: '#!/usr/bin/env node',
|
|
22
|
+
},
|
|
23
|
+
plugins: [
|
|
24
|
+
stripShebang(),
|
|
25
|
+
resolve({ preferBuiltins: true }),
|
|
26
|
+
commonjs(),
|
|
27
|
+
json(),
|
|
28
|
+
],
|
|
29
|
+
external: [
|
|
30
|
+
'fs',
|
|
31
|
+
'path',
|
|
32
|
+
'os',
|
|
33
|
+
'child_process',
|
|
34
|
+
'crypto',
|
|
35
|
+
'stream',
|
|
36
|
+
'util',
|
|
37
|
+
'url',
|
|
38
|
+
'http',
|
|
39
|
+
'https',
|
|
40
|
+
'zlib',
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
// 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
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const chalk = require('chalk')
|
|
2
|
+
const msgPath = process.env.HUSKY_GIT_PARAMS
|
|
3
|
+
const msg = require('fs')
|
|
4
|
+
.readFileSync(msgPath, 'utf-8')
|
|
5
|
+
.trim()
|
|
6
|
+
|
|
7
|
+
const commitRE = /^(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|release|workflow)(\(.+\))?: .{1,50}/
|
|
8
|
+
|
|
9
|
+
if (!commitRE.test(msg)) {
|
|
10
|
+
console.log()
|
|
11
|
+
console.error(
|
|
12
|
+
` ${chalk.bgRed.white(' ERROR ')} ${chalk.red(
|
|
13
|
+
`不合法的 commit 消息格式`,
|
|
14
|
+
)}\n\n`
|
|
15
|
+
+ chalk.red(
|
|
16
|
+
` 请使用正确的提交格式:\n\n`,
|
|
17
|
+
)
|
|
18
|
+
+ ` ${chalk.green(`feat: add 'comments' option`)}\n`
|
|
19
|
+
+ ` ${chalk.green(`fix: handle events on blur (close #28)`)}\n\n`
|
|
20
|
+
+ chalk.red(` 请查看 git commit 提交规范:https://github.com/woai3c/Front-end-articles/blob/master/git%20commit%20style.md。\n`),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|