@gct-paas/cli 0.0.1-dev.2 → 0.0.1-dev.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 冠骋信息技术有限公司
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -6,3 +6,7 @@ export declare const DEV_MODE = "development";
6
6
  * 生产编译模式标识,匹配环境变量中的 NODE_ENV
7
7
  */
8
8
  export declare const PROD_MODE = "production";
9
+ /**
10
+ * 默认需要忽略编译的外部依赖
11
+ */
12
+ export declare const DEFAULT_EXTERNAL: string[];
@@ -1,2 +1,23 @@
1
1
  export const DEV_MODE = "development";
2
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
+ ];
@@ -13,7 +13,7 @@ import * as rf from "rimraf";
13
13
  import cpy from "cpy";
14
14
  import fs from "fs-extra";
15
15
  import { copyFile, ignoreCompilerFile } from "../rollup-plugins/index.mjs";
16
- import { PROD_MODE } from "../../constants/index.mjs";
16
+ import { DEFAULT_EXTERNAL, PROD_MODE } from "../../constants/index.mjs";
17
17
  export function defineRollupConfig(opts = {}) {
18
18
  process.on("SIGINT", () => {
19
19
  process.exit();
@@ -70,7 +70,7 @@ export function defineRollupConfig(opts = {}) {
70
70
  defineConfig({
71
71
  input,
72
72
  treeshake: false,
73
- external: ["vue"],
73
+ external: DEFAULT_EXTERNAL,
74
74
  output,
75
75
  plugins: [
76
76
  ignoreCompilerFile(externalCompileFileReg),
@@ -1 +1,2 @@
1
1
  export { defineViteConfig } from './vite-config/vite-config';
2
+ export { defineDevViteConfig } from './vite-config/vite-dev-config';
@@ -1 +1,2 @@
1
1
  export { defineViteConfig } from "./vite-config/vite-config.mjs";
2
+ export { defineDevViteConfig } from "./vite-config/vite-dev-config.mjs";
@@ -2,22 +2,44 @@ import { defineConfig, mergeConfig } from "vite";
2
2
  import vue from "@vitejs/plugin-vue";
3
3
  import vueJsx from "@vitejs/plugin-vue-jsx";
4
4
  import { babel } from "@rollup/plugin-babel";
5
+ import json from "@rollup/plugin-json";
5
6
  import path from "path";
6
7
  import * as rf from "rimraf";
8
+ import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
7
9
  export function defineViteConfig(opts = {}) {
8
10
  const cwd = process.cwd();
9
11
  const outDir = path.resolve(cwd, "dist");
10
12
  rf.sync(outDir);
11
13
  return mergeConfig(
12
14
  defineConfig({
15
+ css: {
16
+ preprocessorOptions: {
17
+ scss: {
18
+ additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
19
+ }
20
+ }
21
+ },
13
22
  build: {
14
23
  outDir,
24
+ rollupOptions: {
25
+ external: DEFAULT_EXTERNAL
26
+ },
15
27
  lib: {
16
28
  entry: path.resolve(cwd, "src/index.ts"),
17
- formats: ["system", "cjs"]
29
+ formats: ["system", "cjs"],
30
+ fileName(format) {
31
+ if (format === "system" || format === "systemjs") {
32
+ return `[name].system.min.js`;
33
+ }
34
+ if (format === "cjs" || format === "commonjs") {
35
+ return `[name].min.cjs`;
36
+ }
37
+ return `[name].${format}.min.js`;
38
+ }
18
39
  }
19
40
  },
20
41
  plugins: [
42
+ json(),
21
43
  vue(),
22
44
  vueJsx(),
23
45
  babel({
@@ -29,12 +51,11 @@ export function defineViteConfig(opts = {}) {
29
51
  useBuiltIns: "usage",
30
52
  corejs: 3,
31
53
  bugfixes: true,
32
- babelHelpers: "bundled",
33
54
  targets: {
34
- chrome: ">=85",
35
- edge: ">=85",
36
- firefox: ">=79",
37
- safari: ">=14.1"
55
+ chrome: "85",
56
+ edge: "85",
57
+ firefox: "79",
58
+ safari: "14.1"
38
59
  }
39
60
  }
40
61
  ]
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/cli",
3
- "version": "0.0.1-dev.2",
3
+ "version": "0.0.1-dev.4",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "bin": {
@@ -38,6 +38,7 @@
38
38
  "@commitlint/cli": "^19.6.1",
39
39
  "@commitlint/config-conventional": "^19.6.0",
40
40
  "@eslint/js": "^9.17.0",
41
+ "@gct-paas/scss": "workspace:*",
41
42
  "@rollup/plugin-babel": "^6.0.4",
42
43
  "@rollup/plugin-commonjs": "^28.0.2",
43
44
  "@rollup/plugin-eslint": "^9.0.5",
@@ -50,8 +51,10 @@
50
51
  "commander": "^13.0.0",
51
52
  "consola": "^3.3.3",
52
53
  "copy-file": "^11.0.0",
54
+ "core-js": "^3.40.0",
53
55
  "cpy": "^11.1.0",
54
56
  "eslint": "^9.17.0",
57
+ "eslint-config-prettier": "^9.1.0",
55
58
  "eslint-plugin-import": "^2.31.0",
56
59
  "eslint-plugin-prettier": "^5.2.1",
57
60
  "eslint-plugin-unused-imports": "^4.1.4",
@@ -81,5 +84,6 @@
81
84
  "@types/node": "^22.10.5",
82
85
  "typescript": "^5.7.2",
83
86
  "unbuild": "^3.2.0"
84
- }
87
+ },
88
+ "gitHead": "517219a1f78c7ffb3ce4bc77d076be2dfbbc5180"
85
89
  }