@gct-paas/cli 0.0.1-dev.7 → 0.0.1-dev.7.2
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/dist/bin.cjs +5 -0
- package/dist/commands/create-template/create-template.cjs +37 -0
- package/dist/commands/index.cjs +27 -0
- package/dist/commands/update-template/update-template.cjs +25 -0
- package/dist/commands/zip/zip.cjs +16 -0
- package/dist/core/commitlint/commitlint-config/commitlint-config.cjs +15 -0
- package/dist/core/commitlint/index.cjs +12 -0
- package/dist/core/constants/index.cjs +9 -0
- package/dist/core/eslint/eslint-config/eslint-config.cjs +85 -0
- package/dist/core/eslint/index.cjs +12 -0
- package/dist/core/index.cjs +93 -0
- package/dist/core/prettier/index.cjs +12 -0
- package/dist/core/prettier/prettier-config/prettier-config.cjs +29 -0
- package/dist/core/rollup/index.cjs +27 -0
- package/dist/core/rollup/rollup-config/dev-config.cjs +93 -0
- package/dist/core/rollup/rollup-plugins/copy-file.cjs +24 -0
- package/dist/core/rollup/rollup-plugins/ignore-compiler-file.cjs +23 -0
- package/dist/core/rollup/rollup-plugins/index.cjs +19 -0
- package/dist/core/stylelint/index.cjs +12 -0
- package/dist/core/stylelint/stylelint-config/stylelint-config.cjs +24 -0
- package/dist/core/template/actions/create-template.cjs +53 -0
- package/dist/core/template/actions/update-template.cjs +71 -0
- package/dist/core/template/actions/zip.cjs +25 -0
- package/dist/core/template/constant/index.cjs +7 -0
- package/dist/core/template/index.cjs +26 -0
- package/dist/core/util/index.cjs +20 -0
- package/dist/core/util/watcher/watcher.cjs +99 -0
- package/dist/core/vite/index.cjs +45 -0
- package/dist/core/vite/vite-config/vite-base-config.cjs +47 -0
- package/dist/core/vite/vite-config/vite-config.cjs +35 -0
- package/dist/core/vite/vite-config/vite-dev-config.cjs +23 -0
- package/dist/core/vite/vite-config/vite-plugin-config.cjs +97 -0
- package/dist/index.cjs +47 -0
- package/dist/interface/i-command/i-command.cjs +1 -0
- package/dist/interface/index.cjs +16 -0
- package/dist/utils/index.cjs +18 -0
- package/dist/utils/local-binaries/local-binaries.cjs +19 -0
- package/es/bin.d.ts +2 -0
- package/es/commands/create-template/create-template.d.ts +6 -0
- package/es/commands/index.d.ts +5 -0
- package/es/commands/update-template/update-template.d.ts +6 -0
- package/es/commands/zip/zip.d.ts +21 -0
- package/es/core/commitlint/commitlint-config/commitlint-config.d.ts +9 -0
- package/es/core/commitlint/index.d.ts +1 -0
- package/es/core/constants/index.d.ts +12 -0
- package/es/core/eslint/eslint-config/eslint-config.d.ts +9 -0
- package/es/core/eslint/index.d.ts +1 -0
- package/es/core/index.d.ts +8 -0
- package/es/core/prettier/index.d.ts +1 -0
- package/es/core/prettier/prettier-config/prettier-config.d.ts +22 -0
- package/es/core/rollup/index.d.ts +2 -0
- package/es/core/rollup/rollup-config/dev-config.d.ts +9 -0
- package/es/core/rollup/rollup-plugins/copy-file.d.ts +37 -0
- package/es/core/rollup/rollup-plugins/ignore-compiler-file.d.ts +8 -0
- package/es/core/rollup/rollup-plugins/index.d.ts +2 -0
- package/es/core/stylelint/index.d.ts +1 -0
- package/es/core/stylelint/stylelint-config/stylelint-config.d.ts +9 -0
- package/es/core/template/actions/create-template.d.ts +16 -0
- package/es/core/template/actions/update-template.d.ts +18 -0
- package/es/core/template/actions/zip.d.ts +9 -0
- package/es/core/template/constant/index.d.ts +1 -0
- package/es/core/template/index.d.ts +3 -0
- package/es/core/util/index.d.ts +17 -0
- package/es/core/util/watcher/watcher.d.ts +48 -0
- package/es/core/vite/index.d.ts +4 -0
- package/es/core/vite/vite-config/vite-base-config.d.ts +9 -0
- package/es/core/vite/vite-config/vite-config.d.ts +9 -0
- package/es/core/vite/vite-config/vite-dev-config.d.ts +9 -0
- package/es/core/vite/vite-config/vite-plugin-config.d.ts +25 -0
- package/es/index.d.ts +2 -0
- package/es/interface/i-command/i-command.d.ts +22 -0
- package/es/interface/index.d.ts +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/local-binaries/local-binaries.d.ts +3 -0
- package/package.json +13 -5
- /package/{dist → es}/bin.mjs +0 -0
- /package/{dist → es}/commands/create-template/create-template.mjs +0 -0
- /package/{dist → es}/commands/index.mjs +0 -0
- /package/{dist → es}/commands/update-template/update-template.mjs +0 -0
- /package/{dist → es}/commands/zip/zip.mjs +0 -0
- /package/{dist → es}/core/commitlint/commitlint-config/commitlint-config.mjs +0 -0
- /package/{dist → es}/core/commitlint/index.mjs +0 -0
- /package/{dist → es}/core/constants/index.mjs +0 -0
- /package/{dist → es}/core/eslint/eslint-config/eslint-config.mjs +0 -0
- /package/{dist → es}/core/eslint/index.mjs +0 -0
- /package/{dist → es}/core/index.mjs +0 -0
- /package/{dist → es}/core/prettier/index.mjs +0 -0
- /package/{dist → es}/core/prettier/prettier-config/prettier-config.mjs +0 -0
- /package/{dist → es}/core/rollup/index.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-config/dev-config.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-plugins/copy-file.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-plugins/ignore-compiler-file.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-plugins/index.mjs +0 -0
- /package/{dist → es}/core/stylelint/index.mjs +0 -0
- /package/{dist → es}/core/stylelint/stylelint-config/stylelint-config.mjs +0 -0
- /package/{dist → es}/core/template/actions/create-template.mjs +0 -0
- /package/{dist → es}/core/template/actions/update-template.mjs +0 -0
- /package/{dist → es}/core/template/actions/zip.mjs +0 -0
- /package/{dist → es}/core/template/constant/index.mjs +0 -0
- /package/{dist → es}/core/template/index.mjs +0 -0
- /package/{dist → es}/core/util/index.mjs +0 -0
- /package/{dist → es}/core/util/watcher/watcher.mjs +0 -0
- /package/{dist → es}/core/vite/index.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-base-config.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-config.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-dev-config.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-plugin-config.mjs +0 -0
- /package/{dist → es}/index.mjs +0 -0
- /package/{dist → es}/interface/i-command/i-command.mjs +0 -0
- /package/{dist → es}/interface/index.mjs +0 -0
- /package/{dist → es}/utils/index.mjs +0 -0
- /package/{dist → es}/utils/local-binaries/local-binaries.mjs +0 -0
package/dist/bin.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CreateTemplateCommand = void 0;
|
|
7
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
8
|
+
var _ora = _interopRequireDefault(require("ora"));
|
|
9
|
+
var _prompts = require("@inquirer/prompts");
|
|
10
|
+
var _core = require("../../core/index.cjs");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
class CreateTemplateCommand {
|
|
13
|
+
load(program) {
|
|
14
|
+
program.command("create-template").description("\u57FA\u4E8E\u6A21\u677F\u521B\u5EFA paas \u5E73\u53F0\u63D2\u4EF6").action(this.action.bind(this));
|
|
15
|
+
}
|
|
16
|
+
async action() {
|
|
17
|
+
const cwd = process.cwd();
|
|
18
|
+
const child = _fsExtra.default.readdirSync(cwd);
|
|
19
|
+
if (child.length > 0) {
|
|
20
|
+
const bol = await (0, _prompts.confirm)({
|
|
21
|
+
message: "\u5F53\u524D\u76EE\u5F55\u4E0D\u4E3A\u7A7A\uFF0C\u7EE7\u7EED\u5C06\u53EF\u80FD\u8986\u76D6\u5DF2\u6709\u6587\u4EF6\uFF0C\u662F\u5426\u7EE7\u7EED\u521B\u5EFA\uFF1F",
|
|
22
|
+
default: false
|
|
23
|
+
});
|
|
24
|
+
if (bol === false) {
|
|
25
|
+
process.exit();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const name = await (0, _prompts.input)({
|
|
29
|
+
message: "\u8BF7\u8F93\u5165\u63D2\u4EF6\u540D\u79F0",
|
|
30
|
+
default: "gct-plugin"
|
|
31
|
+
});
|
|
32
|
+
const spinner = (0, _ora.default)("\u521D\u59CB\u5316\u63D2\u4EF6").start();
|
|
33
|
+
await new _core.CreateTemplateAction().run(process.cwd(), name);
|
|
34
|
+
spinner.succeed("\u521D\u59CB\u5316\u5B8C\u6210");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.CreateTemplateCommand = CreateTemplateCommand;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CommandLoader = void 0;
|
|
7
|
+
var _consola = require("consola");
|
|
8
|
+
var _createTemplate = require("./create-template/create-template.cjs");
|
|
9
|
+
var _updateTemplate = require("./update-template/update-template.cjs");
|
|
10
|
+
var _zip = require("./zip/zip.cjs");
|
|
11
|
+
class CommandLoader {
|
|
12
|
+
static load(program) {
|
|
13
|
+
new _createTemplate.CreateTemplateCommand().load(program);
|
|
14
|
+
new _updateTemplate.UpdateTemplateCommand().load(program);
|
|
15
|
+
new _zip.ZipCommand().load(program);
|
|
16
|
+
this.handleInvalidCommand(program);
|
|
17
|
+
}
|
|
18
|
+
static handleInvalidCommand(program) {
|
|
19
|
+
program.on("command:*", () => {
|
|
20
|
+
_consola.consola.error(`\u672A\u652F\u6301\u7684\u547D\u4EE4: `, program.args.join(" "));
|
|
21
|
+
_consola.consola.log(`\u8BF7\u4F7F\u7528 --help \u67E5\u770B\u5DF2\u652F\u6301\u7684\u547D\u4EE4.
|
|
22
|
+
`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.CommandLoader = CommandLoader;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UpdateTemplateCommand = void 0;
|
|
7
|
+
var _ora = _interopRequireDefault(require("ora"));
|
|
8
|
+
var _prompts = require("@inquirer/prompts");
|
|
9
|
+
var _core = require("../../core/index.cjs");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
class UpdateTemplateCommand {
|
|
12
|
+
load(program) {
|
|
13
|
+
program.command("update-template").description("paas \u5E73\u53F0\u63D2\u4EF6\u589E\u91CF\u66F4\u65B0").action(this.action.bind(this));
|
|
14
|
+
}
|
|
15
|
+
async action() {
|
|
16
|
+
const overwrite = await (0, _prompts.confirm)({
|
|
17
|
+
message: "\u66F4\u65B0\u65F6\u9009\u62E9\u4E0D\u8986\u76D6\uFF0C\u53EF\u4FDD\u7559\u5DF2\u4FEE\u6539\u7684\u6587\u4EF6\u800C\u4E0D\u88AB\u65B0\u7248\u672C\u66FF\u6362\u3002\u662F\u5426\u8986\u76D6\u66F4\u65B0\uFF1F",
|
|
18
|
+
default: false
|
|
19
|
+
});
|
|
20
|
+
const spinner = (0, _ora.default)("\u589E\u91CF\u66F4\u65B0\u63D2\u4EF6").start();
|
|
21
|
+
await new _core.UpdateTemplateAction().run(process.cwd(), overwrite);
|
|
22
|
+
spinner.succeed("\u66F4\u65B0\u5B8C\u6210");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.UpdateTemplateCommand = UpdateTemplateCommand;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ZipCommand = void 0;
|
|
7
|
+
var _core = require("../../core/index.cjs");
|
|
8
|
+
class ZipCommand {
|
|
9
|
+
load(program) {
|
|
10
|
+
program.command("zip").description("zip \u538B\u7F29\u76EE\u5F55").option("--folder <folder-path>", "\u5F85\u538B\u7F29\u76EE\u5F55").option("--output <output-file>", "\u8F93\u51FA\u6587\u4EF6\u540D").action(this.action.bind(this));
|
|
11
|
+
}
|
|
12
|
+
async action(args) {
|
|
13
|
+
new _core.ZipAction().run(process.cwd(), args.folder, args.output);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ZipCommand = ZipCommand;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defineCommitlintConfig = defineCommitlintConfig;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
function defineCommitlintConfig(config = {}) {
|
|
9
|
+
return (0, _lodashEs.merge)({
|
|
10
|
+
extends: ["@commitlint/config-conventional"],
|
|
11
|
+
rules: {
|
|
12
|
+
"type-enum": [2, "always", ["feat", "fix", "docs", "style", "refactor", "test", "perf", "revert", "build", "chore", "release"]]
|
|
13
|
+
}
|
|
14
|
+
}, config);
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "defineCommitlintConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _commitlintConfig.defineCommitlintConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _commitlintConfig = require("./commitlint-config/commitlint-config.cjs");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PROD_MODE = exports.DEV_MODE = exports.DEFAULT_EXTERNAL = void 0;
|
|
7
|
+
const DEV_MODE = exports.DEV_MODE = "development";
|
|
8
|
+
const PROD_MODE = exports.PROD_MODE = "production";
|
|
9
|
+
const DEFAULT_EXTERNAL = exports.DEFAULT_EXTERNAL = ["vue", "vue-router", "vue-i18n", "axios", "dayjs", "lodash-es", "qs", "pinia", "vuedraggable", "sortablejs", "vue-grid-layout", "vant", "ant-design-vue", "@gct-paas/core", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-web", "@gct-paas/mobile", "@gct-paas/web", "systemjs"];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defineEslintConfig = defineEslintConfig;
|
|
7
|
+
var _js = _interopRequireDefault(require("@eslint/js"));
|
|
8
|
+
var _typescriptEslint = _interopRequireDefault(require("typescript-eslint"));
|
|
9
|
+
var _eslintPluginVue = _interopRequireDefault(require("eslint-plugin-vue"));
|
|
10
|
+
var _recommended = _interopRequireDefault(require("eslint-plugin-prettier/recommended"));
|
|
11
|
+
var _eslintPluginUnusedImports = _interopRequireDefault(require("eslint-plugin-unused-imports"));
|
|
12
|
+
var _eslintPluginImport = _interopRequireDefault(require("eslint-plugin-import"));
|
|
13
|
+
var _globals = _interopRequireDefault(require("globals"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function defineEslintConfig(...configs) {
|
|
16
|
+
return _typescriptEslint.default.config(/** js推荐配置 */
|
|
17
|
+
_js.default.configs.recommended, /** ts推荐配置 */
|
|
18
|
+
_typescriptEslint.default.configs.strict, _typescriptEslint.default.configs.stylistic, /** vue推荐配置 */
|
|
19
|
+
_eslintPluginVue.default.configs["flat/recommended"], _recommended.default, _eslintPluginImport.default.flatConfigs.recommended, _eslintPluginImport.default.flatConfigs.warnings, _eslintPluginImport.default.flatConfigs.errors, _eslintPluginImport.default.flatConfigs.typescript, {
|
|
20
|
+
ignores: ["**/node_modules", "lerna.json", "package.json", "tsconfig.json", "pnpm-lock.yaml", "pnpm-workspace.yaml", "eslint.config.mjs", "**/dist", "**/out", "**/es", "**/lib"],
|
|
21
|
+
files: ["**/*.ts", "**.*.tsx", "**/*.vue"],
|
|
22
|
+
plugins: {
|
|
23
|
+
"unused-imports": _eslintPluginUnusedImports.default
|
|
24
|
+
},
|
|
25
|
+
languageOptions: {
|
|
26
|
+
globals: {
|
|
27
|
+
..._globals.default.browser
|
|
28
|
+
},
|
|
29
|
+
parserOptions: {
|
|
30
|
+
ecmaFeatures: {
|
|
31
|
+
// 全局严格模式
|
|
32
|
+
impliedStrict: true,
|
|
33
|
+
// 启用 jsx
|
|
34
|
+
jsx: true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
rules: {
|
|
39
|
+
// 基础配置覆盖
|
|
40
|
+
"no-console": "off",
|
|
41
|
+
"no-debugger": "off",
|
|
42
|
+
"no-undef": "off",
|
|
43
|
+
"no-plusplus": ["error", {
|
|
44
|
+
allowForLoopAfterthoughts: true
|
|
45
|
+
}],
|
|
46
|
+
"no-underscore-dangle": "off",
|
|
47
|
+
"no-restricted-syntax": "off",
|
|
48
|
+
"no-continue": "off",
|
|
49
|
+
"no-unused-vars": "off",
|
|
50
|
+
"no-extraneous-class": "off",
|
|
51
|
+
"no-param-reassign": "off",
|
|
52
|
+
"no-useless-constructor": "off",
|
|
53
|
+
"no-empty-function": "off",
|
|
54
|
+
// unused-imports 配置覆盖
|
|
55
|
+
"unused-imports/no-unused-imports": "error",
|
|
56
|
+
"consistent-return": "off",
|
|
57
|
+
"func-names": "off",
|
|
58
|
+
// import 配置覆盖
|
|
59
|
+
"import/no-unresolved": "off",
|
|
60
|
+
"import/extensions": "off",
|
|
61
|
+
"import/prefer-default-export": "off",
|
|
62
|
+
// vue 配置覆盖
|
|
63
|
+
"vue/no-setup-props-destructure": "off",
|
|
64
|
+
"vue/require-default-prop": "off",
|
|
65
|
+
// typescript 配置覆盖
|
|
66
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
67
|
+
argsIgnorePattern: "^_"
|
|
68
|
+
}],
|
|
69
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
70
|
+
"@typescript-eslint/no-explicit-any": ["error"],
|
|
71
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
72
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
73
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
74
|
+
// 其他配置覆盖
|
|
75
|
+
"class-methods-use-this": "off",
|
|
76
|
+
"prefer-destructuring": "off"
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
name: "ts-vue-override",
|
|
80
|
+
files: ["**/*.vue"],
|
|
81
|
+
rules: {
|
|
82
|
+
"@typescript-eslint/no-unused-vars": "off"
|
|
83
|
+
}
|
|
84
|
+
}, ...configs);
|
|
85
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "defineEslintConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _eslintConfig.defineEslintConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _eslintConfig = require("./eslint-config/eslint-config.cjs");
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _commitlint = require("./commitlint/index.cjs");
|
|
7
|
+
Object.keys(_commitlint).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _commitlint[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _commitlint[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _eslint = require("./eslint/index.cjs");
|
|
18
|
+
Object.keys(_eslint).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _eslint[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _eslint[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _prettier = require("./prettier/index.cjs");
|
|
29
|
+
Object.keys(_prettier).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _prettier[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _prettier[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _rollup = require("./rollup/index.cjs");
|
|
40
|
+
Object.keys(_rollup).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _rollup[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _rollup[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _stylelint = require("./stylelint/index.cjs");
|
|
51
|
+
Object.keys(_stylelint).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _stylelint[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _stylelint[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _template = require("./template/index.cjs");
|
|
62
|
+
Object.keys(_template).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _template[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _template[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _util = require("./util/index.cjs");
|
|
73
|
+
Object.keys(_util).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _util[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _util[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _vite = require("./vite/index.cjs");
|
|
84
|
+
Object.keys(_vite).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _vite[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _vite[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "definePrettierConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _prettierConfig.definePrettierConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _prettierConfig = require("./prettier-config/prettier-config.cjs");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.definePrettierConfig = definePrettierConfig;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
function definePrettierConfig(config = {}) {
|
|
9
|
+
return (0, _lodashEs.merge)({
|
|
10
|
+
// 起始格式化间隔
|
|
11
|
+
tabWidth: 2,
|
|
12
|
+
// 使用单引号
|
|
13
|
+
singleQuote: true,
|
|
14
|
+
// jsx 中使用单引号
|
|
15
|
+
jsxSingleQuote: true,
|
|
16
|
+
// 对象中的 key 是否需要引号。as-needed: 只有在必须时才要
|
|
17
|
+
quoteProps: "as-needed",
|
|
18
|
+
// 每行结尾是否需要分号
|
|
19
|
+
trailingComma: "all",
|
|
20
|
+
// 括号中参数前后补充空格
|
|
21
|
+
bracketSpacing: true,
|
|
22
|
+
// 箭头函数,参数是否添加括号
|
|
23
|
+
arrowParens: "avoid",
|
|
24
|
+
// jsx 元素最后末尾的 > ,换行放置
|
|
25
|
+
bracketSameLine: false,
|
|
26
|
+
// 设置换行符
|
|
27
|
+
endOfLine: "lf"
|
|
28
|
+
}, config);
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
defineRollupConfig: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "defineRollupConfig", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _devConfig.defineRollupConfig;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _devConfig = require("./rollup-config/dev-config.cjs");
|
|
16
|
+
var _rollupPlugins = require("./rollup-plugins/index.cjs");
|
|
17
|
+
Object.keys(_rollupPlugins).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _rollupPlugins[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _rollupPlugins[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defineRollupConfig = defineRollupConfig;
|
|
7
|
+
var _rollup = require("rollup");
|
|
8
|
+
var _lodashEs = require("lodash-es");
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
11
|
+
var _pluginNodeResolve = require("@rollup/plugin-node-resolve");
|
|
12
|
+
var _pluginCommonjs = _interopRequireDefault(require("@rollup/plugin-commonjs"));
|
|
13
|
+
var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
|
|
14
|
+
var _rollupPluginEsbuild = _interopRequireDefault(require("rollup-plugin-esbuild"));
|
|
15
|
+
var _vitePluginDts = _interopRequireDefault(require("vite-plugin-dts"));
|
|
16
|
+
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
17
|
+
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
18
|
+
var rf = _interopRequireWildcard(require("rimraf"));
|
|
19
|
+
var _cpy = _interopRequireDefault(require("cpy"));
|
|
20
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
21
|
+
var _rollupPlugins = require("../rollup-plugins/index.cjs");
|
|
22
|
+
var _constants = require("../../constants/index.cjs");
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
|
+
function defineRollupConfig(opts = {}) {
|
|
27
|
+
process.on("SIGINT", () => {
|
|
28
|
+
process.exit();
|
|
29
|
+
});
|
|
30
|
+
const cwd = process.cwd();
|
|
31
|
+
const isProd = process.env.NODE_ENV === _constants.PROD_MODE;
|
|
32
|
+
const rootDir = _path.default.resolve(cwd, "src");
|
|
33
|
+
const outDir = _path.default.resolve(cwd, "es");
|
|
34
|
+
const assetsDir = _path.default.resolve(cwd, "public");
|
|
35
|
+
const externalCompileFileReg = /\.(vue|scss|css|less|d\.ts)+$/;
|
|
36
|
+
rf.sync(outDir);
|
|
37
|
+
const input = _fastGlob.default.sync("src/**/*.{ts,tsx}", {
|
|
38
|
+
cwd,
|
|
39
|
+
absolute: true,
|
|
40
|
+
onlyFiles: true,
|
|
41
|
+
ignore: ["**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
|
|
42
|
+
});
|
|
43
|
+
if (isProd) {
|
|
44
|
+
if (_fsExtra.default.pathExistsSync(assetsDir)) {
|
|
45
|
+
(0, _cpy.default)(assetsDir, outDir);
|
|
46
|
+
}
|
|
47
|
+
(0, _cpy.default)(_path.default.resolve(cwd, "src/**/*.{vue,scss,css,less,d.ts}"), outDir);
|
|
48
|
+
} else {
|
|
49
|
+
(0, _rollupPlugins.copyFile)([{
|
|
50
|
+
from: assetsDir,
|
|
51
|
+
to: outDir
|
|
52
|
+
}, {
|
|
53
|
+
from: rootDir,
|
|
54
|
+
to: outDir,
|
|
55
|
+
opts: {
|
|
56
|
+
ignored: (file, stats) => {
|
|
57
|
+
if (stats && stats.isFile()) {
|
|
58
|
+
return !externalCompileFileReg.test(file);
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}]);
|
|
64
|
+
}
|
|
65
|
+
const output = [{
|
|
66
|
+
dir: outDir,
|
|
67
|
+
format: "es",
|
|
68
|
+
sourcemap: false,
|
|
69
|
+
preserveModules: true,
|
|
70
|
+
preserveModulesRoot: rootDir,
|
|
71
|
+
entryFileNames: "[name].mjs"
|
|
72
|
+
}];
|
|
73
|
+
return (0, _lodashEs.merge)((0, _rollup.defineConfig)({
|
|
74
|
+
input,
|
|
75
|
+
treeshake: false,
|
|
76
|
+
external: _constants.DEFAULT_EXTERNAL,
|
|
77
|
+
output,
|
|
78
|
+
plugins: [(0, _rollupPlugins.ignoreCompilerFile)(externalCompileFileReg), (0, _pluginJson.default)(), (0, _pluginVue.default)({
|
|
79
|
+
isProduction: false
|
|
80
|
+
}), (0, _pluginVueJsx.default)({}), (0, _pluginNodeResolve.nodeResolve)({
|
|
81
|
+
extensions: [".cjs", ".mjs", ".js", ".ts"]
|
|
82
|
+
}), (0, _pluginCommonjs.default)(), (0, _rollupPluginEsbuild.default)({
|
|
83
|
+
logLevel: "verbose",
|
|
84
|
+
sourceMap: false,
|
|
85
|
+
target: ["esnext"],
|
|
86
|
+
loaders: {
|
|
87
|
+
".vue": "ts"
|
|
88
|
+
}
|
|
89
|
+
}), (0, _vitePluginDts.default)({
|
|
90
|
+
outDir: [outDir]
|
|
91
|
+
})]
|
|
92
|
+
}), opts);
|
|
93
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.copyFile = copyFile;
|
|
7
|
+
var _util = require("../../util/index.cjs");
|
|
8
|
+
function copyFile(opts) {
|
|
9
|
+
if (opts.length === 0) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const arr = [];
|
|
13
|
+
opts.forEach(opt => {
|
|
14
|
+
arr.push(new _util.CopyWatch(opt.from, opt.to, opt.opts));
|
|
15
|
+
});
|
|
16
|
+
process.on("exit", () => {
|
|
17
|
+
if (!opts.length) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
arr.forEach(item => {
|
|
21
|
+
item.unwatch();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ignoreCompilerFile = ignoreCompilerFile;
|
|
7
|
+
function ignoreCompilerFile(extReg) {
|
|
8
|
+
return {
|
|
9
|
+
name: "gct:ignore-compiler-file",
|
|
10
|
+
resolveId(source) {
|
|
11
|
+
if (extReg.test(source)) {
|
|
12
|
+
return {
|
|
13
|
+
id: source,
|
|
14
|
+
external: true
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
},
|
|
19
|
+
load() {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "copyFile", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _copyFile.copyFile;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ignoreCompilerFile", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ignoreCompilerFile.ignoreCompilerFile;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _copyFile = require("./copy-file.cjs");
|
|
19
|
+
var _ignoreCompilerFile = require("./ignore-compiler-file.cjs");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "defineStylelintConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _stylelintConfig.defineStylelintConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _stylelintConfig = require("./stylelint-config/stylelint-config.cjs");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defineStylelintConfig = defineStylelintConfig;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
function defineStylelintConfig(config = {}) {
|
|
9
|
+
return (0, _lodashEs.merge)({
|
|
10
|
+
extends: ["stylelint-config-standard", "stylelint-config-standard-scss"],
|
|
11
|
+
rules: {
|
|
12
|
+
"annotation-no-unknown": null,
|
|
13
|
+
"color-no-invalid-hex": true,
|
|
14
|
+
"function-name-case": null,
|
|
15
|
+
// 强制样式方法名称小写或大写
|
|
16
|
+
"no-duplicate-selectors": null,
|
|
17
|
+
"selector-class-pattern": null,
|
|
18
|
+
"scss/dollar-variable-pattern": null,
|
|
19
|
+
"scss/at-function-pattern": null,
|
|
20
|
+
"scss/dollar-variable-empty-line-before": null
|
|
21
|
+
// 变量声明之间不可以有空白行
|
|
22
|
+
}
|
|
23
|
+
}, config);
|
|
24
|
+
}
|