@gct-paas/build 0.0.1-dev.8

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1 -0
  4. package/dist/commitlint/commitlint-config/commitlint-config.cjs +15 -0
  5. package/dist/commitlint/commitlint-config/commitlint-config.d.ts +9 -0
  6. package/dist/commitlint/index.cjs +12 -0
  7. package/dist/commitlint/index.d.ts +1 -0
  8. package/dist/constants/index.cjs +9 -0
  9. package/dist/constants/index.d.ts +12 -0
  10. package/dist/eslint/eslint-config/eslint-config.cjs +85 -0
  11. package/dist/eslint/eslint-config/eslint-config.d.ts +9 -0
  12. package/dist/eslint/index.cjs +12 -0
  13. package/dist/eslint/index.d.ts +1 -0
  14. package/dist/index.cjs +82 -0
  15. package/dist/index.d.ts +7 -0
  16. package/dist/prettier/index.cjs +12 -0
  17. package/dist/prettier/index.d.ts +1 -0
  18. package/dist/prettier/prettier-config/prettier-config.cjs +29 -0
  19. package/dist/prettier/prettier-config/prettier-config.d.ts +22 -0
  20. package/dist/rollup/index.cjs +27 -0
  21. package/dist/rollup/index.d.ts +2 -0
  22. package/dist/rollup/rollup-config/dev-config.cjs +93 -0
  23. package/dist/rollup/rollup-config/dev-config.d.ts +9 -0
  24. package/dist/rollup/rollup-plugins/copy-file.cjs +24 -0
  25. package/dist/rollup/rollup-plugins/copy-file.d.ts +37 -0
  26. package/dist/rollup/rollup-plugins/ignore-compiler-file.cjs +23 -0
  27. package/dist/rollup/rollup-plugins/ignore-compiler-file.d.ts +8 -0
  28. package/dist/rollup/rollup-plugins/index.cjs +19 -0
  29. package/dist/rollup/rollup-plugins/index.d.ts +2 -0
  30. package/dist/stylelint/index.cjs +12 -0
  31. package/dist/stylelint/index.d.ts +1 -0
  32. package/dist/stylelint/stylelint-config/stylelint-config.cjs +24 -0
  33. package/dist/stylelint/stylelint-config/stylelint-config.d.ts +9 -0
  34. package/dist/util/index.cjs +20 -0
  35. package/dist/util/index.d.ts +17 -0
  36. package/dist/util/watcher/watcher.cjs +99 -0
  37. package/dist/util/watcher/watcher.d.ts +48 -0
  38. package/dist/vite/index.cjs +45 -0
  39. package/dist/vite/index.d.ts +4 -0
  40. package/dist/vite/vite-config/vite-base-config.cjs +47 -0
  41. package/dist/vite/vite-config/vite-base-config.d.ts +9 -0
  42. package/dist/vite/vite-config/vite-config.cjs +40 -0
  43. package/dist/vite/vite-config/vite-config.d.ts +9 -0
  44. package/dist/vite/vite-config/vite-dev-config.cjs +23 -0
  45. package/dist/vite/vite-config/vite-dev-config.d.ts +9 -0
  46. package/dist/vite/vite-config/vite-plugin-config.cjs +97 -0
  47. package/dist/vite/vite-config/vite-plugin-config.d.ts +25 -0
  48. package/es/commitlint/commitlint-config/commitlint-config.d.ts +9 -0
  49. package/es/commitlint/commitlint-config/commitlint-config.mjs +28 -0
  50. package/es/commitlint/index.d.ts +1 -0
  51. package/es/commitlint/index.mjs +1 -0
  52. package/es/constants/index.d.ts +12 -0
  53. package/es/constants/index.mjs +24 -0
  54. package/es/eslint/eslint-config/eslint-config.d.ts +9 -0
  55. package/es/eslint/eslint-config/eslint-config.mjs +109 -0
  56. package/es/eslint/index.d.ts +1 -0
  57. package/es/eslint/index.mjs +1 -0
  58. package/es/index.d.ts +7 -0
  59. package/es/index.mjs +7 -0
  60. package/es/prettier/index.d.ts +1 -0
  61. package/es/prettier/index.mjs +1 -0
  62. package/es/prettier/prettier-config/prettier-config.d.ts +22 -0
  63. package/es/prettier/prettier-config/prettier-config.mjs +26 -0
  64. package/es/rollup/index.d.ts +2 -0
  65. package/es/rollup/index.mjs +2 -0
  66. package/es/rollup/rollup-config/dev-config.d.ts +9 -0
  67. package/es/rollup/rollup-config/dev-config.mjs +101 -0
  68. package/es/rollup/rollup-plugins/copy-file.d.ts +37 -0
  69. package/es/rollup/rollup-plugins/copy-file.mjs +18 -0
  70. package/es/rollup/rollup-plugins/ignore-compiler-file.d.ts +8 -0
  71. package/es/rollup/rollup-plugins/ignore-compiler-file.mjs +17 -0
  72. package/es/rollup/rollup-plugins/index.d.ts +2 -0
  73. package/es/rollup/rollup-plugins/index.mjs +2 -0
  74. package/es/stylelint/index.d.ts +1 -0
  75. package/es/stylelint/index.mjs +1 -0
  76. package/es/stylelint/stylelint-config/stylelint-config.d.ts +9 -0
  77. package/es/stylelint/stylelint-config/stylelint-config.mjs +21 -0
  78. package/es/util/index.d.ts +17 -0
  79. package/es/util/index.mjs +7 -0
  80. package/es/util/watcher/watcher.d.ts +48 -0
  81. package/es/util/watcher/watcher.mjs +95 -0
  82. package/es/vite/index.d.ts +4 -0
  83. package/es/vite/index.mjs +8 -0
  84. package/es/vite/vite-config/vite-base-config.d.ts +9 -0
  85. package/es/vite/vite-config/vite-base-config.mjs +53 -0
  86. package/es/vite/vite-config/vite-config.d.ts +9 -0
  87. package/es/vite/vite-config/vite-config.mjs +36 -0
  88. package/es/vite/vite-config/vite-dev-config.d.ts +9 -0
  89. package/es/vite/vite-config/vite-dev-config.mjs +19 -0
  90. package/es/vite/vite-config/vite-plugin-config.d.ts +25 -0
  91. package/es/vite/vite-config/vite-plugin-config.mjs +97 -0
  92. package/package.json +100 -0
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ import { Config } from 'stylelint';
2
+ /**
3
+ * 基于基础规则,定义 stylelint 配置
4
+ *
5
+ * @export
6
+ * @param {Config} config
7
+ * @returns {*} {Config}
8
+ */
9
+ export declare function defineStylelintConfig(config?: Config): Config;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CopyWatch", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _watcher.CopyWatch;
10
+ }
11
+ });
12
+ exports.unixToWinPath = unixToWinPath;
13
+ exports.winToUnixPath = winToUnixPath;
14
+ var _watcher = require("./watcher/watcher.cjs");
15
+ function winToUnixPath(pathStr) {
16
+ return pathStr.replace(/\\/g, "/");
17
+ }
18
+ function unixToWinPath(pathStr) {
19
+ return pathStr.replace(/\//g, "\\");
20
+ }
@@ -0,0 +1,17 @@
1
+ export { CopyWatch } from './watcher/watcher';
2
+ /**
3
+ * win 路径 \\ 转 linux 路径 /
4
+ *
5
+ * @export
6
+ * @param {string} pathStr
7
+ * @return {*} {string}
8
+ */
9
+ export declare function winToUnixPath(pathStr: string): string;
10
+ /**
11
+ * linux 路径 / 转 win 路径 \\
12
+ *
13
+ * @export
14
+ * @param {string} pathStr
15
+ * @return {*} {string}
16
+ */
17
+ export declare function unixToWinPath(pathStr: string): string;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CopyWatch = void 0;
7
+ var chokidar = _interopRequireWildcard(require("chokidar"));
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var rimraf = _interopRequireWildcard(require("rimraf"));
10
+ var _copyFile = require("copy-file");
11
+ var _consola = _interopRequireDefault(require("consola"));
12
+ var _picocolors = _interopRequireDefault(require("picocolors"));
13
+ var _lodashEs = require("lodash-es");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ 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); }
16
+ 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; }
17
+ class CopyWatch {
18
+ /**
19
+ * Creates an instance of CopyWatch.
20
+ *
21
+ * @param {string[]} dir 需要监控的目录
22
+ * @param {string} copyDir 需要拷贝到的目录
23
+ */
24
+ constructor(dir, copyDir, opts = {}) {
25
+ this.dir = dir;
26
+ this.copyDir = copyDir;
27
+ this.w = chokidar.watch(this.dir, (0, _lodashEs.merge)({
28
+ awaitWriteFinish: {
29
+ stabilityThreshold: 300
30
+ // 等待0.3秒防抖
31
+ }
32
+ }, opts));
33
+ _consola.default.debug(`\u62F7\u8D1D\u76D1\u63A7\u6587\u4EF6\u5939: ${this.dir}`);
34
+ this.init();
35
+ }
36
+ w;
37
+ /**
38
+ * 初始化
39
+ *
40
+ * @protected
41
+ */
42
+ init() {
43
+ this.watchAll = this.watchAll.bind(this);
44
+ this.watchErr = this.watchErr.bind(this);
45
+ this.w.on("all", this.watchAll);
46
+ this.w.on("error", this.watchErr);
47
+ }
48
+ /**
49
+ * 文件监控变更
50
+ *
51
+ * @protected
52
+ * @param {("add" | "addDir" | "change" | "unlink" | "unlinkDir")} eventName
53
+ * @param {string} pathStr
54
+ * @param {(fs.Stats)} [stats]
55
+ */
56
+ watchAll(eventName, pathStr, stats) {
57
+ if (stats && stats.size <= 0) {
58
+ return;
59
+ }
60
+ const cwd = process.cwd();
61
+ const source = _path.default.resolve(cwd, pathStr);
62
+ const target = _path.default.resolve(this.copyDir, _path.default.relative(this.dir, pathStr));
63
+ switch (eventName) {
64
+ case "add":
65
+ case "change":
66
+ _consola.default.info(`\u62F7\u8D1D\u6587\u4EF6: ${_picocolors.default.cyan(source)} => ${_picocolors.default.cyan(target)}`);
67
+ (0, _copyFile.copyFileSync)(source, target);
68
+ break;
69
+ case "addDir":
70
+ break;
71
+ case "unlink":
72
+ case "unlinkDir":
73
+ _consola.default.info(`\u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55: ${target}`);
74
+ rimraf.sync(target);
75
+ break;
76
+ default:
77
+ }
78
+ }
79
+ /**
80
+ * 文件监控异常
81
+ *
82
+ * @protected
83
+ * @param {string} path
84
+ * @param {(fs.Stats | undefined)} [stats]
85
+ */
86
+ watchErr(err) {
87
+ _consola.default.error(`\u76D1\u63A7\u6587\u4EF6\u53D1\u751F\u9519\u8BEF: ${err}`);
88
+ }
89
+ /**
90
+ * 停止监控
91
+ */
92
+ unwatch() {
93
+ this.w.off("all", this.watchAll);
94
+ this.w.off("error", this.watchErr);
95
+ this.w.unwatch(this.dir);
96
+ this.w.close();
97
+ }
98
+ }
99
+ exports.CopyWatch = CopyWatch;
@@ -0,0 +1,48 @@
1
+ import * as chokidar from 'chokidar';
2
+ import fs from 'fs-extra';
3
+ import { EventName } from 'chokidar/handler';
4
+ /**
5
+ * 文件监控类
6
+ *
7
+ * @export
8
+ * @class CopyWatch
9
+ */
10
+ export declare class CopyWatch {
11
+ dir: string;
12
+ copyDir: string;
13
+ protected w: chokidar.FSWatcher;
14
+ /**
15
+ * Creates an instance of CopyWatch.
16
+ *
17
+ * @param {string[]} dir 需要监控的目录
18
+ * @param {string} copyDir 需要拷贝到的目录
19
+ */
20
+ constructor(dir: string, copyDir: string, opts?: chokidar.ChokidarOptions);
21
+ /**
22
+ * 初始化
23
+ *
24
+ * @protected
25
+ */
26
+ protected init(): void;
27
+ /**
28
+ * 文件监控变更
29
+ *
30
+ * @protected
31
+ * @param {("add" | "addDir" | "change" | "unlink" | "unlinkDir")} eventName
32
+ * @param {string} pathStr
33
+ * @param {(fs.Stats)} [stats]
34
+ */
35
+ protected watchAll(eventName: EventName, pathStr: string, stats?: fs.Stats): void;
36
+ /**
37
+ * 文件监控异常
38
+ *
39
+ * @protected
40
+ * @param {string} path
41
+ * @param {(fs.Stats | undefined)} [stats]
42
+ */
43
+ protected watchErr(err: unknown): void;
44
+ /**
45
+ * 停止监控
46
+ */
47
+ unwatch(): void;
48
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "defineDesignPluginViteConfig", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _vitePluginConfig.defineDesignPluginViteConfig;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "defineDevViteConfig", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _viteDevConfig.defineDevViteConfig;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "defineMobilePluginViteConfig", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _vitePluginConfig.defineMobilePluginViteConfig;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "defineViteBaseConfig", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _viteBaseConfig.defineViteBaseConfig;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "defineViteConfig", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _viteConfig.defineViteConfig;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "defineWebPluginViteConfig", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _vitePluginConfig.defineWebPluginViteConfig;
40
+ }
41
+ });
42
+ var _viteBaseConfig = require("./vite-config/vite-base-config.cjs");
43
+ var _viteConfig = require("./vite-config/vite-config.cjs");
44
+ var _viteDevConfig = require("./vite-config/vite-dev-config.cjs");
45
+ var _vitePluginConfig = require("./vite-config/vite-plugin-config.cjs");
@@ -0,0 +1,4 @@
1
+ export { defineViteBaseConfig } from './vite-config/vite-base-config';
2
+ export { defineViteConfig } from './vite-config/vite-config';
3
+ export { defineDevViteConfig } from './vite-config/vite-dev-config';
4
+ export { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineViteBaseConfig = defineViteBaseConfig;
7
+ var _vite = require("vite");
8
+ var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
9
+ var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
10
+ var _pluginBabel = require("@rollup/plugin-babel");
11
+ var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
12
+ var _path = _interopRequireDefault(require("path"));
13
+ var _constants = require("../../constants/index.cjs");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function defineViteBaseConfig(opts = {}) {
16
+ const cwd = process.cwd();
17
+ const outDir = _path.default.resolve(cwd, "dist");
18
+ return (0, _vite.mergeConfig)((0, _vite.defineConfig)({
19
+ css: {
20
+ preprocessorOptions: {
21
+ scss: {
22
+ additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
23
+ }
24
+ }
25
+ },
26
+ build: {
27
+ outDir,
28
+ rollupOptions: {
29
+ external: _constants.DEFAULT_EXTERNAL
30
+ }
31
+ },
32
+ plugins: [(0, _pluginJson.default)(), (0, _pluginVue.default)(), (0, _pluginVueJsx.default)(), (0, _pluginBabel.babel)({
33
+ babelHelpers: "bundled",
34
+ presets: [["@babel/preset-env", {
35
+ useBuiltIns: "usage",
36
+ corejs: 3,
37
+ bugfixes: true,
38
+ targets: {
39
+ chrome: "85",
40
+ edge: "85",
41
+ firefox: "79",
42
+ safari: "14.1"
43
+ }
44
+ }]]
45
+ })]
46
+ }), opts);
47
+ }
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineViteBaseConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineViteConfig = defineViteConfig;
7
+ var _vite = require("vite");
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var rf = _interopRequireWildcard(require("rimraf"));
10
+ var _viteBaseConfig = require("./vite-base-config.cjs");
11
+ 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); }
12
+ 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; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function defineViteConfig(opts = {}) {
15
+ const cwd = process.cwd();
16
+ const outDir = _path.default.resolve(cwd, "dist");
17
+ rf.sync(outDir);
18
+ return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)((0, _vite.defineConfig)({
19
+ build: {
20
+ rollupOptions: {
21
+ output: {
22
+ exports: "named"
23
+ }
24
+ },
25
+ lib: {
26
+ entry: _path.default.resolve(cwd, "src/index.ts"),
27
+ formats: ["system", "cjs"],
28
+ fileName(format) {
29
+ if (format === "system" || format === "systemjs") {
30
+ return `[name].system.min.js`;
31
+ }
32
+ if (format === "cjs" || format === "commonjs") {
33
+ return `[name].min.cjs`;
34
+ }
35
+ return `[name].${format}.min.js`;
36
+ }
37
+ }
38
+ }
39
+ })), opts);
40
+ }
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineViteConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineDevViteConfig = defineDevViteConfig;
7
+ var _vite = require("vite");
8
+ var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
9
+ var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
10
+ var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function defineDevViteConfig(opts = {}) {
13
+ return (0, _vite.mergeConfig)((0, _vite.defineConfig)({
14
+ css: {
15
+ preprocessorOptions: {
16
+ scss: {
17
+ additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
18
+ }
19
+ }
20
+ },
21
+ plugins: [(0, _pluginJson.default)(), (0, _pluginVue.default)(), (0, _pluginVueJsx.default)()]
22
+ }), opts);
23
+ }
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建本地开发 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineDevViteConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineDesignPluginViteConfig = defineDesignPluginViteConfig;
7
+ exports.defineMobilePluginViteConfig = defineMobilePluginViteConfig;
8
+ exports.defineWebPluginViteConfig = defineWebPluginViteConfig;
9
+ var _vite = require("vite");
10
+ var _path = _interopRequireDefault(require("path"));
11
+ var _viteBaseConfig = require("./vite-base-config.cjs");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const formats = ["system", "cjs"];
14
+ function formatFileName(format) {
15
+ if (format === "system" || format === "systemjs") {
16
+ return `[name].system.min.js`;
17
+ }
18
+ if (format === "cjs" || format === "commonjs") {
19
+ return `[name].min.cjs`;
20
+ }
21
+ return `[name].${format}.min.js`;
22
+ }
23
+ function assetFileNames(assetInfo, name) {
24
+ if (assetInfo.names.length > 0 && assetInfo.names[0].endsWith(".css")) {
25
+ return name + ".min.css";
26
+ }
27
+ return assetInfo.names[0];
28
+ }
29
+ function defineDesignPluginViteConfig(opts = {}) {
30
+ const cwd = process.cwd();
31
+ const designEntry = _path.default.resolve(cwd, "src/index.ts");
32
+ return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)({
33
+ build: {
34
+ emptyOutDir: false,
35
+ rollupOptions: {
36
+ output: {
37
+ assetFileNames: assetInfo => {
38
+ return assetFileNames(assetInfo, "design");
39
+ }
40
+ }
41
+ },
42
+ lib: {
43
+ entry: {
44
+ design: designEntry
45
+ },
46
+ formats,
47
+ fileName: formatFileName
48
+ }
49
+ }
50
+ }), opts);
51
+ }
52
+ function defineMobilePluginViteConfig(opts = {}) {
53
+ const cwd = process.cwd();
54
+ const mobileEntry = _path.default.resolve(cwd, "src/index.ts");
55
+ return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)({
56
+ build: {
57
+ emptyOutDir: false,
58
+ rollupOptions: {
59
+ output: {
60
+ assetFileNames: assetInfo => {
61
+ return assetFileNames(assetInfo, "mobile");
62
+ }
63
+ }
64
+ },
65
+ lib: {
66
+ entry: {
67
+ mobile: mobileEntry
68
+ },
69
+ formats,
70
+ fileName: formatFileName
71
+ }
72
+ }
73
+ }), opts);
74
+ }
75
+ function defineWebPluginViteConfig(opts = {}) {
76
+ const cwd = process.cwd();
77
+ const webEntry = _path.default.resolve(cwd, "src/index.ts");
78
+ return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)({
79
+ build: {
80
+ emptyOutDir: false,
81
+ rollupOptions: {
82
+ output: {
83
+ assetFileNames: assetInfo => {
84
+ return assetFileNames(assetInfo, "web");
85
+ }
86
+ }
87
+ },
88
+ lib: {
89
+ entry: {
90
+ web: webEntry
91
+ },
92
+ formats,
93
+ fileName: formatFileName
94
+ }
95
+ }
96
+ }), opts);
97
+ }
@@ -0,0 +1,25 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 设计端构建配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineDesignPluginViteConfig(opts?: UserConfig): UserConfig;
10
+ /**
11
+ * 移动端插件构建配置
12
+ *
13
+ * @export
14
+ * @param {UserConfig} [opts={}]
15
+ * @returns {*} {UserConfig}
16
+ */
17
+ export declare function defineMobilePluginViteConfig(opts?: UserConfig): UserConfig;
18
+ /**
19
+ * 网页端插件构建配置
20
+ *
21
+ * @export
22
+ * @param {UserConfig} [opts={}]
23
+ * @returns {*} {UserConfig}
24
+ */
25
+ export declare function defineWebPluginViteConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,9 @@
1
+ import type { UserConfig } from '@commitlint/types';
2
+ /**
3
+ * 基于基础配置,定义 commitlint 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [config={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineCommitlintConfig(config?: UserConfig): UserConfig;
@@ -0,0 +1,28 @@
1
+ import { merge } from "lodash-es";
2
+ export function defineCommitlintConfig(config = {}) {
3
+ return merge(
4
+ {
5
+ extends: ["@commitlint/config-conventional"],
6
+ rules: {
7
+ "type-enum": [
8
+ 2,
9
+ "always",
10
+ [
11
+ "feat",
12
+ "fix",
13
+ "docs",
14
+ "style",
15
+ "refactor",
16
+ "test",
17
+ "perf",
18
+ "revert",
19
+ "build",
20
+ "chore",
21
+ "release"
22
+ ]
23
+ ]
24
+ }
25
+ },
26
+ config
27
+ );
28
+ }
@@ -0,0 +1 @@
1
+ export { defineCommitlintConfig } from './commitlint-config/commitlint-config';
@@ -0,0 +1 @@
1
+ export { defineCommitlintConfig } from "./commitlint-config/commitlint-config.mjs";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 开发模式标识,匹配环境变量中的 NODE_ENV
3
+ */
4
+ export declare const DEV_MODE = "development";
5
+ /**
6
+ * 生产编译模式标识,匹配环境变量中的 NODE_ENV
7
+ */
8
+ export declare const PROD_MODE = "production";
9
+ /**
10
+ * 默认需要忽略编译的外部依赖
11
+ */
12
+ export declare const DEFAULT_EXTERNAL: string[];
@@ -0,0 +1,24 @@
1
+ export const DEV_MODE = "development";
2
+ export const PROD_MODE = "production";
3
+ export const DEFAULT_EXTERNAL = [
4
+ "vue",
5
+ "vue-router",
6
+ "vue-i18n",
7
+ "axios",
8
+ "dayjs",
9
+ "lodash-es",
10
+ "qs",
11
+ "pinia",
12
+ "vuedraggable",
13
+ "sortablejs",
14
+ "vue-grid-layout",
15
+ "vant",
16
+ "ant-design-vue",
17
+ "@gct-paas/core",
18
+ "@gct-paas/design",
19
+ "@gct-paas/design-mobile",
20
+ "@gct-paas/design-web",
21
+ "@gct-paas/mobile",
22
+ "@gct-paas/web",
23
+ "systemjs"
24
+ ];
@@ -0,0 +1,9 @@
1
+ import { ConfigArray, InfiniteDepthConfigWithExtends } from 'typescript-eslint';
2
+ /**
3
+ * 基于基础规则,定义 eslint 配置
4
+ *
5
+ * @export
6
+ * @param {...InfiniteDepthConfigWithExtends[]} configs
7
+ * @returns {*} {ConfigArray}
8
+ */
9
+ export declare function defineEslintConfig(...configs: InfiniteDepthConfigWithExtends[]): ConfigArray;