ylyx-cli 1.0.8 → 1.0.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.
package/lib/config.js CHANGED
@@ -86,11 +86,9 @@ function writeIfAllowed(filePath, content, force) {
86
86
 
87
87
  function deriveDefaultVariantContent(baseContent, mode) {
88
88
  const isDev = mode === 'dev';
89
- const isProd = mode === 'prod';
90
89
 
91
90
  let content = baseContent || '';
92
91
  const devRe = /let\s+isDev\s*=\s*[^;]*;/;
93
- const prodRe = /let\s+isProd\s*=\s*[^;]*;/;
94
92
 
95
93
  if (devRe.test(content)) {
96
94
  content = content.replace(devRe, `let isDev = ${isDev};`);
@@ -98,11 +96,12 @@ function deriveDefaultVariantContent(baseContent, mode) {
98
96
  content = `let isDev = ${isDev};\n` + content;
99
97
  }
100
98
 
101
- if (prodRe.test(content)) {
102
- content = content.replace(prodRe, `let isProd = ${isProd};`);
103
- } else {
104
- content = `let isProd = ${isProd};\n` + content;
105
- }
99
+ // isProd 已废弃:prod 使用 isDev=false 表示
100
+ // 删除历史遗留的 isProd 变量与输出字段(若存在)
101
+ content = content.replace(/let\s+isProd\s*=\s*[^;]*;\s*\r?\n?/g, '');
102
+ content = content.replace(/window\.config\.IS_PROD\s*=\s*[^;]*;\s*\r?\n?/g, '');
103
+ // 删除对象形式的 IS_PROD 字段(例如 IS_PROD: isProd,)
104
+ content = content.replace(/^\s*IS_PROD\s*:\s*[^,}]*,?\s*\r?\n?/gm, '');
106
105
 
107
106
  return content;
108
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ylyx-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "公司内部代码生成模板脚手架工具,支持快速生成项目初始结构和代码模板",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -1,5 +1,4 @@
1
- let isDev = true; //研发 以上都为false 时 为测试环境
2
- let isProd = true; //线上为true.测试为false
1
+ let isDev = true; // dev=true 为研发环境;prod 环境用 isDev=false 表示
3
2
  let AUTO_ORIGIN = window.location.origin;
4
3
 
5
4
  // 研发环境