@gct-paas/build 0.1.6-dev.7 → 0.1.6-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.
@@ -18,4 +18,4 @@ const DEFAULT_EXTERNAL = exports.DEFAULT_EXTERNAL = [
18
18
  // @gct-paas 底包相关依赖
19
19
  "@gct-paas/api", "@gct-paas/core", "@gct-paas/core-mobile", "@gct-paas/core-web", "@gct-paas/core-pad", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-web", "@gct-paas/design-pad", "@gct-paas/render", "@gct-paas/render-mobile", "@gct-paas/render-pad", "@gct-paas/render-web", "@gct-paas/schema", "@gct-paas/scss",
20
20
  // @gct-paas 独立组件库
21
- "@gct-paas/platform-icons", "@gct-paas/vue-pdf", "@gct-paas/vue-video-player"];
21
+ "@gct-paas/platform-icons", "@gct-paas/vue-pdf", "@gct-paas/vue-video-player", "@gct-paas/flow"];
@@ -80,7 +80,19 @@ function defineEslintConfig(...configs) {
80
80
  "@typescript-eslint/no-dynamic-delete": "off",
81
81
  // 其他规则覆盖
82
82
  "class-methods-use-this": "off",
83
- "prefer-destructuring": "off"
83
+ "prefer-destructuring": "off",
84
+ "no-restricted-imports": ["error", {
85
+ paths: [{
86
+ name: "@/index",
87
+ message: "\u7981\u6B62\u4ECE index \u5BFC\u5165\u5185\u5BB9"
88
+ }, {
89
+ name: "@/loader",
90
+ message: "\u7981\u6B62\u4ECE loader \u5BFC\u5165\u5185\u5BB9"
91
+ }, {
92
+ name: "..",
93
+ message: "\u7981\u6B62\u4ECE\u5185\u90E8\u5BFC\u5165\u5185\u5BB9\u81EA\u8EAB\u5185\u5BB9"
94
+ }]
95
+ }]
84
96
  }
85
97
  }, {
86
98
  name: "ts-vue-override",
@@ -16,12 +16,18 @@ function defineViteConfig(opts = {}) {
16
16
  build: {
17
17
  minify: "terser",
18
18
  terserOptions: {
19
+ // 压缩选项,控制代码压缩行为
19
20
  compress: {
21
+ // 是否移除 console.* 调用;false 表示保留,避免生产环境丢失重要日志
20
22
  drop_console: false,
23
+ // 是否移除永远不会执行的死代码(如 if(false){...})
21
24
  dead_code: true,
25
+ // 是否移除未被引用的变量和函数,减小产物体积
22
26
  unused: true,
27
+ // 压缩算法的执行轮数;多轮压缩可以发现单轮无法消除的冗余代码,但会增加构建耗时
23
28
  passes: 2
24
29
  },
30
+ // 是否混淆变量名、函数名等标识符,使产物更难以阅读反编译,同时进一步缩小体积
25
31
  mangle: true
26
32
  },
27
33
  lib: {
@@ -24,6 +24,22 @@ function definePluginViteConfig(opts = {}) {
24
24
  exclude: _constants.DEFAULT_EXTERNAL
25
25
  },
26
26
  build: {
27
+ minify: isProd ? "terser" : false,
28
+ terserOptions: {
29
+ // 压缩选项,控制代码压缩行为
30
+ compress: {
31
+ // 是否移除 console.* 调用;false 表示保留,避免生产环境丢失重要日志
32
+ drop_console: false,
33
+ // 是否移除永远不会执行的死代码(如 if(false){...})
34
+ dead_code: true,
35
+ // 是否移除未被引用的变量和函数,减小产物体积
36
+ unused: true,
37
+ // 压缩算法的执行轮数;多轮压缩可以发现单轮无法消除的冗余代码,但会增加构建耗时
38
+ passes: 2
39
+ },
40
+ // 是否混淆变量名、函数名等标识符,使产物更难以阅读反编译,同时进一步缩小体积
41
+ mangle: true
42
+ },
27
43
  lib: {
28
44
  entry: isProd ? loaderEntry : entry,
29
45
  formats: ["es"],
@@ -23,11 +23,19 @@ function injectImportMapPlugin(options = {}) {
23
23
  const cwd = process.cwd();
24
24
  let targetBranch = options.branch;
25
25
  if (!targetBranch) {
26
- const cwdGit = (0, _simpleGit.simpleGit)(cwd);
27
- try {
28
- targetBranch = await cwdGit.revparse(["--abbrev-ref", "HEAD"]);
29
- } catch (err) {
30
- this.error(`\u65E0\u6CD5\u81EA\u52A8\u83B7\u53D6\u5F53\u524D git \u5206\u652F\uFF0C\u8BF7\u786E\u8BA4\u5F53\u524D\u5904\u4E8E git \u4ED3\u5E93\u4E2D\uFF0C\u6216\u901A\u8FC7 options.branch \u660E\u786E\u6307\u5B9A\u5206\u652F\u3002\u9519\u8BEF\u4FE1\u606F: ${err}`);
26
+ targetBranch = process.env.CI_COMMIT_BRANCH || process.env.CI_BUILD_REF_NAME;
27
+ if (!targetBranch) {
28
+ const cwdGit = (0, _simpleGit.simpleGit)(cwd);
29
+ try {
30
+ const raw = await cwdGit.revparse(["--abbrev-ref", "HEAD"]);
31
+ const resolved = raw.trim();
32
+ if (resolved && resolved !== "HEAD") {
33
+ targetBranch = resolved;
34
+ }
35
+ } catch {}
36
+ }
37
+ if (!targetBranch) {
38
+ this.error("\u65E0\u6CD5\u81EA\u52A8\u83B7\u53D6\u5F53\u524D git \u5206\u652F\uFF1A\u5F53\u524D\u53EF\u80FD\u5904\u4E8E\u6E38\u79BB HEAD\uFF08detached HEAD\uFF09\u72B6\u6001\uFF08CI \u73AF\u5883\u5E38\u89C1\uFF09\u3002\u8BF7\u901A\u8FC7 options.branch \u660E\u786E\u6307\u5B9A\u5206\u652F\u540D\uFF0C\u6216\u786E\u4FDD\u73AF\u5883\u53D8\u91CF CI_COMMIT_BRANCH / CI_BUILD_REF_NAME \u5DF2\u8BBE\u7F6E\u3002");
31
39
  }
32
40
  }
33
41
  const cacheDir = _nodePath.default.resolve(cwd, "node_modules/.gct/cache/importmap-repo-cache");
@@ -51,5 +51,6 @@ export const DEFAULT_EXTERNAL = [
51
51
  // @gct-paas 独立组件库
52
52
  "@gct-paas/platform-icons",
53
53
  "@gct-paas/vue-pdf",
54
- "@gct-paas/vue-video-player"
54
+ "@gct-paas/vue-video-player",
55
+ "@gct-paas/flow"
55
56
  ];
@@ -98,7 +98,26 @@ export function defineEslintConfig(...configs) {
98
98
  "@typescript-eslint/no-dynamic-delete": "off",
99
99
  // 其他规则覆盖
100
100
  "class-methods-use-this": "off",
101
- "prefer-destructuring": "off"
101
+ "prefer-destructuring": "off",
102
+ "no-restricted-imports": [
103
+ "error",
104
+ {
105
+ paths: [
106
+ {
107
+ name: "@/index",
108
+ message: "\u7981\u6B62\u4ECE index \u5BFC\u5165\u5185\u5BB9"
109
+ },
110
+ {
111
+ name: "@/loader",
112
+ message: "\u7981\u6B62\u4ECE loader \u5BFC\u5165\u5185\u5BB9"
113
+ },
114
+ {
115
+ name: "..",
116
+ message: "\u7981\u6B62\u4ECE\u5185\u90E8\u5BFC\u5165\u5185\u5BB9\u81EA\u8EAB\u5185\u5BB9"
117
+ }
118
+ ]
119
+ }
120
+ ]
102
121
  }
103
122
  },
104
123
  {
@@ -10,12 +10,18 @@ export function defineViteConfig(opts = {}) {
10
10
  build: {
11
11
  minify: "terser",
12
12
  terserOptions: {
13
+ // 压缩选项,控制代码压缩行为
13
14
  compress: {
15
+ // 是否移除 console.* 调用;false 表示保留,避免生产环境丢失重要日志
14
16
  drop_console: false,
17
+ // 是否移除永远不会执行的死代码(如 if(false){...})
15
18
  dead_code: true,
19
+ // 是否移除未被引用的变量和函数,减小产物体积
16
20
  unused: true,
21
+ // 压缩算法的执行轮数;多轮压缩可以发现单轮无法消除的冗余代码,但会增加构建耗时
17
22
  passes: 2
18
23
  },
24
+ // 是否混淆变量名、函数名等标识符,使产物更难以阅读反编译,同时进一步缩小体积
19
25
  mangle: true
20
26
  },
21
27
  lib: {
@@ -14,6 +14,22 @@ export function definePluginViteConfig(opts = {}) {
14
14
  exclude: DEFAULT_EXTERNAL
15
15
  },
16
16
  build: {
17
+ minify: isProd ? "terser" : false,
18
+ terserOptions: {
19
+ // 压缩选项,控制代码压缩行为
20
+ compress: {
21
+ // 是否移除 console.* 调用;false 表示保留,避免生产环境丢失重要日志
22
+ drop_console: false,
23
+ // 是否移除永远不会执行的死代码(如 if(false){...})
24
+ dead_code: true,
25
+ // 是否移除未被引用的变量和函数,减小产物体积
26
+ unused: true,
27
+ // 压缩算法的执行轮数;多轮压缩可以发现单轮无法消除的冗余代码,但会增加构建耗时
28
+ passes: 2
29
+ },
30
+ // 是否混淆变量名、函数名等标识符,使产物更难以阅读反编译,同时进一步缩小体积
31
+ mangle: true
32
+ },
17
33
  lib: {
18
34
  entry: isProd ? loaderEntry : entry,
19
35
  formats: ["es"],
@@ -16,11 +16,22 @@ export function injectImportMapPlugin(options = {}) {
16
16
  const cwd = process.cwd();
17
17
  let targetBranch = options.branch;
18
18
  if (!targetBranch) {
19
- const cwdGit = simpleGit(cwd);
20
- try {
21
- targetBranch = await cwdGit.revparse(["--abbrev-ref", "HEAD"]);
22
- } catch (err) {
23
- this.error(`\u65E0\u6CD5\u81EA\u52A8\u83B7\u53D6\u5F53\u524D git \u5206\u652F\uFF0C\u8BF7\u786E\u8BA4\u5F53\u524D\u5904\u4E8E git \u4ED3\u5E93\u4E2D\uFF0C\u6216\u901A\u8FC7 options.branch \u660E\u786E\u6307\u5B9A\u5206\u652F\u3002\u9519\u8BEF\u4FE1\u606F: ${err}`);
19
+ targetBranch = process.env.CI_COMMIT_BRANCH || process.env.CI_BUILD_REF_NAME;
20
+ if (!targetBranch) {
21
+ const cwdGit = simpleGit(cwd);
22
+ try {
23
+ const raw = await cwdGit.revparse(["--abbrev-ref", "HEAD"]);
24
+ const resolved = raw.trim();
25
+ if (resolved && resolved !== "HEAD") {
26
+ targetBranch = resolved;
27
+ }
28
+ } catch {
29
+ }
30
+ }
31
+ if (!targetBranch) {
32
+ this.error(
33
+ "\u65E0\u6CD5\u81EA\u52A8\u83B7\u53D6\u5F53\u524D git \u5206\u652F\uFF1A\u5F53\u524D\u53EF\u80FD\u5904\u4E8E\u6E38\u79BB HEAD\uFF08detached HEAD\uFF09\u72B6\u6001\uFF08CI \u73AF\u5883\u5E38\u89C1\uFF09\u3002\u8BF7\u901A\u8FC7 options.branch \u660E\u786E\u6307\u5B9A\u5206\u652F\u540D\uFF0C\u6216\u786E\u4FDD\u73AF\u5883\u53D8\u91CF CI_COMMIT_BRANCH / CI_BUILD_REF_NAME \u5DF2\u8BBE\u7F6E\u3002"
34
+ );
24
35
  }
25
36
  }
26
37
  const cacheDir = path.resolve(cwd, "node_modules/.gct/cache/importmap-repo-cache");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/build",
3
- "version": "0.1.6-dev.7",
3
+ "version": "0.1.6-dev.9",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "main": "dist/index.cjs",
@@ -99,6 +99,5 @@
99
99
  },
100
100
  "peerDependencies": {
101
101
  "@gct-paas/scss": "*"
102
- },
103
- "gitHead": "ea800dfadead2fc20cf424513bc776a340e50ee8"
102
+ }
104
103
  }