generator-mico-cli 0.2.17 → 0.2.18
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/README.md +12 -0
- package/bin/mico.js +101 -5
- package/generators/micro-react/index.js +46 -0
- package/generators/micro-react/meta.json +12 -0
- package/generators/micro-react/templates/.cursor/rules/cicd-deploy.mdc +10 -8
- package/generators/micro-react/templates/.cursor/rules/development-guide.mdc +1 -1
- package/generators/micro-react/templates/AGENTS.md +3 -0
- package/generators/micro-react/templates/CICD/start_dev.sh +2 -1
- package/generators/micro-react/templates/CICD/start_prod.sh +2 -1
- package/generators/micro-react/templates/CICD/start_test.sh +2 -1
- package/generators/micro-react/templates/CICD/wangsu_fresh_dev.sh +4 -4
- package/generators/micro-react/templates/CICD/wangsu_fresh_prod.sh +4 -4
- package/generators/micro-react/templates/CICD/wangsu_fresh_test.sh +4 -4
- package/generators/micro-react/templates/README.md +39 -1
- package/generators/micro-react/templates/apps/layout/config/config.dev.ts +1 -1
- package/generators/micro-react/templates/apps/layout/config/config.prod.testing.ts +1 -1
- package/generators/micro-react/templates/apps/layout/config/config.prod.ts +3 -3
- package/generators/micro-react/templates/apps/layout/config/config.ts +1 -1
- package/generators/micro-react/templates/apps/layout/docs/feature-/344/270/273/351/242/230/350/211/262/345/210/207/346/215/242.md +1 -1
- package/generators/micro-react/templates/apps/layout/docs/feature-/345/276/256/345/211/215/347/253/257/346/250/241/345/274/217.md +4 -4
- package/generators/micro-react/templates/apps/layout/src/app.tsx +2 -2
- package/generators/micro-react/templates/apps/layout/src/components/HeaderDropdown/index.tsx +0 -2
- package/generators/micro-react/templates/apps/layout/src/layouts/index.less +2 -1
- package/generators/micro-react/templates/deployDesc.md +3 -3
- package/generators/micro-react/templates/dev.preset.json +14 -0
- package/generators/micro-react/templates/docs/dev-preset.md +130 -0
- package/generators/micro-react/templates/package.json +2 -0
- package/generators/micro-react/templates/scripts/dev-preset.js +265 -0
- package/generators/micro-react/templates/scripts/dev-preset.schema.json +39 -0
- package/generators/subapp-react/index.js +31 -1
- package/generators/subapp-react/meta.json +10 -0
- package/generators/subapp-react/templates/homepage/config/config.dev.ts +2 -3
- package/generators/subapp-react/templates/homepage/config/config.prod.development.ts +1 -1
- package/generators/subapp-react/templates/homepage/config/config.prod.testing.ts +1 -1
- package/generators/subapp-react/templates/homepage/config/config.prod.ts +1 -1
- package/generators/subapp-react/templates/homepage/src/pages/index.tsx +1 -1
- package/lib/utils.js +49 -1
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -161,6 +161,50 @@ function getLatestNpmVersion(packageName, fallback = '1.0.0', timeoutMs = 8000,
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
/**
|
|
165
|
+
* 检查是否启用了 verbose 模式
|
|
166
|
+
* @returns {boolean}
|
|
167
|
+
*/
|
|
168
|
+
function isVerbose() {
|
|
169
|
+
return process.env.MICO_VERBOSE === '1';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 详细日志输出(仅在 verbose 模式下打印)
|
|
174
|
+
* @param {...any} args - 要打印的内容
|
|
175
|
+
*/
|
|
176
|
+
function verboseLog(...args) {
|
|
177
|
+
if (isVerbose()) {
|
|
178
|
+
console.log('\x1b[2m[verbose]', ...args, '\x1b[0m');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 创建一个带有 verbose 支持的 Logger
|
|
184
|
+
* @param {object} generator - Yeoman generator 实例
|
|
185
|
+
* @returns {object} Logger 对象
|
|
186
|
+
*/
|
|
187
|
+
function createLogger(generator) {
|
|
188
|
+
const log = generator.log.bind(generator);
|
|
189
|
+
return {
|
|
190
|
+
info: (...args) => log(...args),
|
|
191
|
+
verbose: (...args) => {
|
|
192
|
+
if (isVerbose()) {
|
|
193
|
+
log('\x1b[2m[verbose]', ...args, '\x1b[0m');
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
success: (msg) => log(`\x1b[32m✓\x1b[0m ${msg}`),
|
|
197
|
+
warn: (msg) => log(`\x1b[33m⚠\x1b[0m ${msg}`),
|
|
198
|
+
error: (msg) => log(`\x1b[31m✗\x1b[0m ${msg}`),
|
|
199
|
+
file: (action, filePath) => {
|
|
200
|
+
if (isVerbose()) {
|
|
201
|
+
const actionColor = action === 'create' ? '\x1b[32m' : action === 'copy' ? '\x1b[36m' : '\x1b[33m';
|
|
202
|
+
log(` ${actionColor}${action}\x1b[0m ${filePath}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
164
208
|
/**
|
|
165
209
|
* 安装全局未捕获异常处理
|
|
166
210
|
*/
|
|
@@ -204,5 +248,9 @@ module.exports = {
|
|
|
204
248
|
isTemplateFile,
|
|
205
249
|
getLatestNpmVersion,
|
|
206
250
|
setupErrorHandlers,
|
|
207
|
-
TEMPLATE_EXTENSIONS
|
|
251
|
+
TEMPLATE_EXTENSIONS,
|
|
252
|
+
// Verbose 日志
|
|
253
|
+
isVerbose,
|
|
254
|
+
verboseLog,
|
|
255
|
+
createLogger
|
|
208
256
|
};
|