@gct-paas/cli 0.0.1-dev.7.2 → 0.0.1-dev.9

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 (125) hide show
  1. package/dist/commands/index.cjs +0 -6
  2. package/dist/index.cjs +1 -1
  3. package/es/commands/index.mjs +0 -6
  4. package/es/index.mjs +1 -1
  5. package/package.json +11 -53
  6. package/dist/commands/create-template/create-template.cjs +0 -37
  7. package/dist/commands/create-template/create-template.d.ts +0 -6
  8. package/dist/commands/update-template/update-template.cjs +0 -25
  9. package/dist/commands/update-template/update-template.d.ts +0 -6
  10. package/dist/commands/zip/zip.cjs +0 -16
  11. package/dist/commands/zip/zip.d.ts +0 -21
  12. package/dist/core/commitlint/commitlint-config/commitlint-config.cjs +0 -15
  13. package/dist/core/commitlint/commitlint-config/commitlint-config.d.ts +0 -9
  14. package/dist/core/commitlint/index.cjs +0 -12
  15. package/dist/core/commitlint/index.d.ts +0 -1
  16. package/dist/core/constants/index.cjs +0 -9
  17. package/dist/core/constants/index.d.ts +0 -12
  18. package/dist/core/eslint/eslint-config/eslint-config.cjs +0 -85
  19. package/dist/core/eslint/eslint-config/eslint-config.d.ts +0 -9
  20. package/dist/core/eslint/index.cjs +0 -12
  21. package/dist/core/eslint/index.d.ts +0 -1
  22. package/dist/core/index.cjs +0 -93
  23. package/dist/core/index.d.ts +0 -8
  24. package/dist/core/prettier/index.cjs +0 -12
  25. package/dist/core/prettier/index.d.ts +0 -1
  26. package/dist/core/prettier/prettier-config/prettier-config.cjs +0 -29
  27. package/dist/core/prettier/prettier-config/prettier-config.d.ts +0 -22
  28. package/dist/core/rollup/index.cjs +0 -27
  29. package/dist/core/rollup/index.d.ts +0 -2
  30. package/dist/core/rollup/rollup-config/dev-config.cjs +0 -93
  31. package/dist/core/rollup/rollup-config/dev-config.d.ts +0 -9
  32. package/dist/core/rollup/rollup-plugins/copy-file.cjs +0 -24
  33. package/dist/core/rollup/rollup-plugins/copy-file.d.ts +0 -37
  34. package/dist/core/rollup/rollup-plugins/ignore-compiler-file.cjs +0 -23
  35. package/dist/core/rollup/rollup-plugins/ignore-compiler-file.d.ts +0 -8
  36. package/dist/core/rollup/rollup-plugins/index.cjs +0 -19
  37. package/dist/core/rollup/rollup-plugins/index.d.ts +0 -2
  38. package/dist/core/stylelint/index.cjs +0 -12
  39. package/dist/core/stylelint/index.d.ts +0 -1
  40. package/dist/core/stylelint/stylelint-config/stylelint-config.cjs +0 -24
  41. package/dist/core/stylelint/stylelint-config/stylelint-config.d.ts +0 -9
  42. package/dist/core/template/actions/create-template.cjs +0 -53
  43. package/dist/core/template/actions/create-template.d.ts +0 -16
  44. package/dist/core/template/actions/update-template.cjs +0 -71
  45. package/dist/core/template/actions/update-template.d.ts +0 -18
  46. package/dist/core/template/actions/zip.cjs +0 -25
  47. package/dist/core/template/actions/zip.d.ts +0 -9
  48. package/dist/core/template/constant/index.cjs +0 -7
  49. package/dist/core/template/constant/index.d.ts +0 -1
  50. package/dist/core/template/index.cjs +0 -26
  51. package/dist/core/template/index.d.ts +0 -3
  52. package/dist/core/util/index.cjs +0 -20
  53. package/dist/core/util/index.d.ts +0 -17
  54. package/dist/core/util/watcher/watcher.cjs +0 -99
  55. package/dist/core/util/watcher/watcher.d.ts +0 -48
  56. package/dist/core/vite/index.cjs +0 -45
  57. package/dist/core/vite/index.d.ts +0 -4
  58. package/dist/core/vite/vite-config/vite-base-config.cjs +0 -47
  59. package/dist/core/vite/vite-config/vite-base-config.d.ts +0 -9
  60. package/dist/core/vite/vite-config/vite-config.cjs +0 -35
  61. package/dist/core/vite/vite-config/vite-config.d.ts +0 -9
  62. package/dist/core/vite/vite-config/vite-dev-config.cjs +0 -23
  63. package/dist/core/vite/vite-config/vite-dev-config.d.ts +0 -9
  64. package/dist/core/vite/vite-config/vite-plugin-config.cjs +0 -97
  65. package/dist/core/vite/vite-config/vite-plugin-config.d.ts +0 -25
  66. package/es/commands/create-template/create-template.d.ts +0 -6
  67. package/es/commands/create-template/create-template.mjs +0 -29
  68. package/es/commands/update-template/update-template.d.ts +0 -6
  69. package/es/commands/update-template/update-template.mjs +0 -17
  70. package/es/commands/zip/zip.d.ts +0 -21
  71. package/es/commands/zip/zip.mjs +0 -9
  72. package/es/core/commitlint/commitlint-config/commitlint-config.d.ts +0 -9
  73. package/es/core/commitlint/commitlint-config/commitlint-config.mjs +0 -28
  74. package/es/core/commitlint/index.d.ts +0 -1
  75. package/es/core/commitlint/index.mjs +0 -1
  76. package/es/core/constants/index.d.ts +0 -12
  77. package/es/core/constants/index.mjs +0 -24
  78. package/es/core/eslint/eslint-config/eslint-config.d.ts +0 -9
  79. package/es/core/eslint/eslint-config/eslint-config.mjs +0 -109
  80. package/es/core/eslint/index.d.ts +0 -1
  81. package/es/core/eslint/index.mjs +0 -1
  82. package/es/core/index.d.ts +0 -8
  83. package/es/core/index.mjs +0 -8
  84. package/es/core/prettier/index.d.ts +0 -1
  85. package/es/core/prettier/index.mjs +0 -1
  86. package/es/core/prettier/prettier-config/prettier-config.d.ts +0 -22
  87. package/es/core/prettier/prettier-config/prettier-config.mjs +0 -26
  88. package/es/core/rollup/index.d.ts +0 -2
  89. package/es/core/rollup/index.mjs +0 -2
  90. package/es/core/rollup/rollup-config/dev-config.d.ts +0 -9
  91. package/es/core/rollup/rollup-config/dev-config.mjs +0 -101
  92. package/es/core/rollup/rollup-plugins/copy-file.d.ts +0 -37
  93. package/es/core/rollup/rollup-plugins/copy-file.mjs +0 -18
  94. package/es/core/rollup/rollup-plugins/ignore-compiler-file.d.ts +0 -8
  95. package/es/core/rollup/rollup-plugins/ignore-compiler-file.mjs +0 -17
  96. package/es/core/rollup/rollup-plugins/index.d.ts +0 -2
  97. package/es/core/rollup/rollup-plugins/index.mjs +0 -2
  98. package/es/core/stylelint/index.d.ts +0 -1
  99. package/es/core/stylelint/index.mjs +0 -1
  100. package/es/core/stylelint/stylelint-config/stylelint-config.d.ts +0 -9
  101. package/es/core/stylelint/stylelint-config/stylelint-config.mjs +0 -21
  102. package/es/core/template/actions/create-template.d.ts +0 -16
  103. package/es/core/template/actions/create-template.mjs +0 -43
  104. package/es/core/template/actions/update-template.d.ts +0 -18
  105. package/es/core/template/actions/update-template.mjs +0 -61
  106. package/es/core/template/actions/zip.d.ts +0 -9
  107. package/es/core/template/actions/zip.mjs +0 -13
  108. package/es/core/template/constant/index.d.ts +0 -1
  109. package/es/core/template/constant/index.mjs +0 -1
  110. package/es/core/template/index.d.ts +0 -3
  111. package/es/core/template/index.mjs +0 -3
  112. package/es/core/util/index.d.ts +0 -17
  113. package/es/core/util/index.mjs +0 -7
  114. package/es/core/util/watcher/watcher.d.ts +0 -48
  115. package/es/core/util/watcher/watcher.mjs +0 -97
  116. package/es/core/vite/index.d.ts +0 -4
  117. package/es/core/vite/index.mjs +0 -8
  118. package/es/core/vite/vite-config/vite-base-config.d.ts +0 -9
  119. package/es/core/vite/vite-config/vite-base-config.mjs +0 -53
  120. package/es/core/vite/vite-config/vite-config.d.ts +0 -9
  121. package/es/core/vite/vite-config/vite-config.mjs +0 -31
  122. package/es/core/vite/vite-config/vite-dev-config.d.ts +0 -9
  123. package/es/core/vite/vite-config/vite-dev-config.mjs +0 -19
  124. package/es/core/vite/vite-config/vite-plugin-config.d.ts +0 -25
  125. package/es/core/vite/vite-config/vite-plugin-config.mjs +0 -97
@@ -1,97 +0,0 @@
1
- import * as chokidar from "chokidar";
2
- import path from "path";
3
- import * as rimraf from "rimraf";
4
- import { copyFileSync } from "copy-file";
5
- import consola from "consola";
6
- import colors from "picocolors";
7
- import { merge } from "lodash-es";
8
- export class CopyWatch {
9
- /**
10
- * Creates an instance of CopyWatch.
11
- *
12
- * @param {string[]} dir 需要监控的目录
13
- * @param {string} copyDir 需要拷贝到的目录
14
- */
15
- constructor(dir, copyDir, opts = {}) {
16
- this.dir = dir;
17
- this.copyDir = copyDir;
18
- this.w = chokidar.watch(
19
- this.dir,
20
- merge(
21
- {
22
- awaitWriteFinish: {
23
- stabilityThreshold: 300
24
- // 等待0.3秒防抖
25
- }
26
- },
27
- opts
28
- )
29
- );
30
- consola.debug(`\u62F7\u8D1D\u76D1\u63A7\u6587\u4EF6\u5939: ${this.dir}`);
31
- this.init();
32
- }
33
- w;
34
- /**
35
- * 初始化
36
- *
37
- * @protected
38
- */
39
- init() {
40
- this.watchAll = this.watchAll.bind(this);
41
- this.watchErr = this.watchErr.bind(this);
42
- this.w.on("all", this.watchAll);
43
- this.w.on("error", this.watchErr);
44
- }
45
- /**
46
- * 文件监控变更
47
- *
48
- * @protected
49
- * @param {("add" | "addDir" | "change" | "unlink" | "unlinkDir")} eventName
50
- * @param {string} pathStr
51
- * @param {(fs.Stats)} [stats]
52
- */
53
- watchAll(eventName, pathStr, stats) {
54
- if (stats && stats.size <= 0) {
55
- return;
56
- }
57
- const cwd = process.cwd();
58
- const source = path.resolve(cwd, pathStr);
59
- const target = path.resolve(this.copyDir, path.relative(this.dir, pathStr));
60
- switch (eventName) {
61
- case "add":
62
- case "change":
63
- consola.info(
64
- `\u62F7\u8D1D\u6587\u4EF6: ${colors.cyan(source)} => ${colors.cyan(target)}`
65
- );
66
- copyFileSync(source, target);
67
- break;
68
- case "addDir":
69
- break;
70
- case "unlink":
71
- case "unlinkDir":
72
- consola.info(`\u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55: ${target}`);
73
- rimraf.sync(target);
74
- break;
75
- default:
76
- }
77
- }
78
- /**
79
- * 文件监控异常
80
- *
81
- * @protected
82
- * @param {string} path
83
- * @param {(fs.Stats | undefined)} [stats]
84
- */
85
- watchErr(err) {
86
- consola.error(`\u76D1\u63A7\u6587\u4EF6\u53D1\u751F\u9519\u8BEF: ${err}`);
87
- }
88
- /**
89
- * 停止监控
90
- */
91
- unwatch() {
92
- this.w.off("all", this.watchAll);
93
- this.w.off("error", this.watchErr);
94
- this.w.unwatch(this.dir);
95
- this.w.close();
96
- }
97
- }
@@ -1,4 +0,0 @@
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';
@@ -1,8 +0,0 @@
1
- export { defineViteBaseConfig } from "./vite-config/vite-base-config.mjs";
2
- export { defineViteConfig } from "./vite-config/vite-config.mjs";
3
- export { defineDevViteConfig } from "./vite-config/vite-dev-config.mjs";
4
- export {
5
- defineDesignPluginViteConfig,
6
- defineMobilePluginViteConfig,
7
- defineWebPluginViteConfig
8
- } from "./vite-config/vite-plugin-config.mjs";
@@ -1,9 +0,0 @@
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;
@@ -1,53 +0,0 @@
1
- import { defineConfig, mergeConfig } from "vite";
2
- import vue from "@vitejs/plugin-vue";
3
- import vueJsx from "@vitejs/plugin-vue-jsx";
4
- import { babel } from "@rollup/plugin-babel";
5
- import json from "@rollup/plugin-json";
6
- import path from "path";
7
- import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
8
- export function defineViteBaseConfig(opts = {}) {
9
- const cwd = process.cwd();
10
- const outDir = path.resolve(cwd, "dist");
11
- return mergeConfig(
12
- defineConfig({
13
- css: {
14
- preprocessorOptions: {
15
- scss: {
16
- additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
17
- }
18
- }
19
- },
20
- build: {
21
- outDir,
22
- rollupOptions: {
23
- external: DEFAULT_EXTERNAL
24
- }
25
- },
26
- plugins: [
27
- json(),
28
- vue(),
29
- vueJsx(),
30
- babel({
31
- babelHelpers: "bundled",
32
- presets: [
33
- [
34
- "@babel/preset-env",
35
- {
36
- useBuiltIns: "usage",
37
- corejs: 3,
38
- bugfixes: true,
39
- targets: {
40
- chrome: "85",
41
- edge: "85",
42
- firefox: "79",
43
- safari: "14.1"
44
- }
45
- }
46
- ]
47
- ]
48
- })
49
- ]
50
- }),
51
- opts
52
- );
53
- }
@@ -1,9 +0,0 @@
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;
@@ -1,31 +0,0 @@
1
- import { defineConfig, mergeConfig } from "vite";
2
- import path from "path";
3
- import * as rf from "rimraf";
4
- import { defineViteBaseConfig } from "./vite-base-config.mjs";
5
- export function defineViteConfig(opts = {}) {
6
- const cwd = process.cwd();
7
- const outDir = path.resolve(cwd, "dist");
8
- rf.sync(outDir);
9
- return mergeConfig(
10
- defineViteBaseConfig(
11
- defineConfig({
12
- build: {
13
- lib: {
14
- entry: path.resolve(cwd, "src/index.ts"),
15
- formats: ["system", "cjs"],
16
- fileName(format) {
17
- if (format === "system" || format === "systemjs") {
18
- return `[name].system.min.js`;
19
- }
20
- if (format === "cjs" || format === "commonjs") {
21
- return `[name].min.cjs`;
22
- }
23
- return `[name].${format}.min.js`;
24
- }
25
- }
26
- }
27
- })
28
- ),
29
- opts
30
- );
31
- }
@@ -1,9 +0,0 @@
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;
@@ -1,19 +0,0 @@
1
- import { defineConfig, mergeConfig } from "vite";
2
- import vue from "@vitejs/plugin-vue";
3
- import vueJsx from "@vitejs/plugin-vue-jsx";
4
- import json from "@rollup/plugin-json";
5
- export function defineDevViteConfig(opts = {}) {
6
- return mergeConfig(
7
- defineConfig({
8
- css: {
9
- preprocessorOptions: {
10
- scss: {
11
- additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
12
- }
13
- }
14
- },
15
- plugins: [json(), vue(), vueJsx()]
16
- }),
17
- opts
18
- );
19
- }
@@ -1,25 +0,0 @@
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;
@@ -1,97 +0,0 @@
1
- import { mergeConfig } from "vite";
2
- import path from "path";
3
- import { defineViteBaseConfig } from "./vite-base-config.mjs";
4
- const formats = ["system", "cjs"];
5
- function formatFileName(format) {
6
- if (format === "system" || format === "systemjs") {
7
- return `[name].system.min.js`;
8
- }
9
- if (format === "cjs" || format === "commonjs") {
10
- return `[name].min.cjs`;
11
- }
12
- return `[name].${format}.min.js`;
13
- }
14
- function assetFileNames(assetInfo, name) {
15
- if (assetInfo.names.length > 0 && assetInfo.names[0].endsWith(".css")) {
16
- return name + ".min.css";
17
- }
18
- return assetInfo.names[0];
19
- }
20
- export function defineDesignPluginViteConfig(opts = {}) {
21
- const cwd = process.cwd();
22
- const designEntry = path.resolve(cwd, "src/index.ts");
23
- return mergeConfig(
24
- defineViteBaseConfig({
25
- build: {
26
- emptyOutDir: false,
27
- rollupOptions: {
28
- output: {
29
- assetFileNames: (assetInfo) => {
30
- return assetFileNames(assetInfo, "design");
31
- }
32
- }
33
- },
34
- lib: {
35
- entry: {
36
- design: designEntry
37
- },
38
- formats,
39
- fileName: formatFileName
40
- }
41
- }
42
- }),
43
- opts
44
- );
45
- }
46
- export function defineMobilePluginViteConfig(opts = {}) {
47
- const cwd = process.cwd();
48
- const mobileEntry = path.resolve(cwd, "src/index.ts");
49
- return mergeConfig(
50
- defineViteBaseConfig({
51
- build: {
52
- emptyOutDir: false,
53
- rollupOptions: {
54
- output: {
55
- assetFileNames: (assetInfo) => {
56
- return assetFileNames(assetInfo, "mobile");
57
- }
58
- }
59
- },
60
- lib: {
61
- entry: {
62
- mobile: mobileEntry
63
- },
64
- formats,
65
- fileName: formatFileName
66
- }
67
- }
68
- }),
69
- opts
70
- );
71
- }
72
- export function defineWebPluginViteConfig(opts = {}) {
73
- const cwd = process.cwd();
74
- const webEntry = path.resolve(cwd, "src/index.ts");
75
- return mergeConfig(
76
- defineViteBaseConfig({
77
- build: {
78
- emptyOutDir: false,
79
- rollupOptions: {
80
- output: {
81
- assetFileNames: (assetInfo) => {
82
- return assetFileNames(assetInfo, "web");
83
- }
84
- }
85
- },
86
- lib: {
87
- entry: {
88
- web: webEntry
89
- },
90
- formats,
91
- fileName: formatFileName
92
- }
93
- }
94
- }),
95
- opts
96
- );
97
- }