@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,53 @@
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
+ }
@@ -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,36 @@
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
+ rollupOptions: {
14
+ output: {
15
+ exports: "named"
16
+ }
17
+ },
18
+ lib: {
19
+ entry: path.resolve(cwd, "src/index.ts"),
20
+ formats: ["system", "cjs"],
21
+ fileName(format) {
22
+ if (format === "system" || format === "systemjs") {
23
+ return `[name].system.min.js`;
24
+ }
25
+ if (format === "cjs" || format === "commonjs") {
26
+ return `[name].min.cjs`;
27
+ }
28
+ return `[name].${format}.min.js`;
29
+ }
30
+ }
31
+ }
32
+ })
33
+ ),
34
+ opts
35
+ );
36
+ }
@@ -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,19 @@
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
+ }
@@ -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,97 @@
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
+ }
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "@gct-paas/build",
3
+ "version": "0.0.1-dev.8",
4
+ "type": "module",
5
+ "description": "paas 平台核心包",
6
+ "main": "dist/index.cjs",
7
+ "module": "es/index.mjs",
8
+ "types": "es/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./es/index.d.ts",
12
+ "import": "./es/index.mjs",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "es",
19
+ "CHANGELOG.md",
20
+ "README.md"
21
+ ],
22
+ "keywords": [
23
+ "paas",
24
+ "gct"
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://git.gct-china.com/paas/frontend/paas-package.git"
29
+ },
30
+ "license": "MIT",
31
+ "author": "gct",
32
+ "scripts": {
33
+ "build": "npm run lint && unbuild",
34
+ "lint": "eslint src/",
35
+ "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
36
+ "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
37
+ "publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
38
+ "publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
39
+ "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
40
+ },
41
+ "dependencies": {
42
+ "@babel/core": "^7.26.8",
43
+ "@babel/preset-env": "^7.26.8",
44
+ "@commitlint/cli": "^19.7.1",
45
+ "@commitlint/config-conventional": "^19.7.1",
46
+ "@eslint/js": "^9.20.0",
47
+ "@gct-paas/scss": "*",
48
+ "@inquirer/prompts": "^7.3.1",
49
+ "@rollup/plugin-babel": "^6.0.4",
50
+ "@rollup/plugin-commonjs": "^28.0.2",
51
+ "@rollup/plugin-eslint": "^9.0.5",
52
+ "@rollup/plugin-json": "^6.1.0",
53
+ "@rollup/plugin-node-resolve": "^16.0.0",
54
+ "@rollup/plugin-typescript": "^12.1.2",
55
+ "@vitejs/plugin-vue": "^5.2.1",
56
+ "@vitejs/plugin-vue-jsx": "^4.1.1",
57
+ "@vue/compiler-sfc": "^3.5.13",
58
+ "chokidar": "^4.0.3",
59
+ "commander": "^13.1.0",
60
+ "consola": "^3.4.0",
61
+ "copy-file": "^11.0.0",
62
+ "core-js": "^3.40.0",
63
+ "cpy": "^11.1.0",
64
+ "crypto": "^1.0.1",
65
+ "esbuild": "^0.25.0",
66
+ "eslint": "^9.20.0",
67
+ "eslint-config-prettier": "^10.0.1",
68
+ "eslint-plugin-import": "^2.31.0",
69
+ "eslint-plugin-prettier": "^5.2.3",
70
+ "eslint-plugin-unused-imports": "^4.1.4",
71
+ "eslint-plugin-vue": "^9.32.0",
72
+ "fast-glob": "^3.3.3",
73
+ "fs-extra": "^11.3.0",
74
+ "globals": "^15.14.0",
75
+ "lodash-es": "^4.17.21",
76
+ "ora": "^8.2.0",
77
+ "picocolors": "^1.1.1",
78
+ "prettier": "^3.5.0",
79
+ "rimraf": "^6.0.1",
80
+ "rollup": "^4.34.6",
81
+ "rollup-plugin-esbuild": "^6.2.0",
82
+ "stylelint": "^16.14.1",
83
+ "stylelint-config-standard": "^37.0.0",
84
+ "stylelint-config-standard-scss": "^14.0.0",
85
+ "typescript-eslint": "^8.23.0",
86
+ "vite": "^6.1.0",
87
+ "vite-plugin-dts": "^4.5.0",
88
+ "vue-tsc": "^2.2.0"
89
+ },
90
+ "devDependencies": {
91
+ "@commitlint/types": "^19.5.0",
92
+ "@types/babel__core": "^7.20.5",
93
+ "@types/babel__preset-env": "^7.10.0",
94
+ "@types/fs-extra": "^11.0.4",
95
+ "@types/lodash-es": "^4.17.12",
96
+ "@types/node": "^22.13.1",
97
+ "typescript": "^5.7.3",
98
+ "unbuild": "^3.3.1"
99
+ }
100
+ }