flu-cli 2.0.4 → 2.0.6
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/config/templates.js +1 -1
- package/index.js +2 -0
- package/lib/commands/add.js +1 -1
- package/lib/commands/assets.js +1 -1
- package/lib/commands/config.js +1 -1
- package/lib/commands/newClack.js +5 -5
- package/lib/commands/snippets.js +1 -1
- package/lib/commands/template.js +1 -1
- package/lib/templates/templateCopier.js +2 -2
- package/lib/templates/templateManager.js +2 -2
- package/lib/utils/config.js +2 -2
- package/lib/utils/flutterHelper.js +2 -2
- package/lib/utils/i18n.js +2 -2
- package/lib/utils/templateSelectorEnquirer.js +2 -2
- package/package.json +2 -2
package/config/templates.js
CHANGED
package/index.js
CHANGED
|
@@ -80,6 +80,8 @@ program
|
|
|
80
80
|
.option('-t, --template <type>', t('cmd.new.opt.template'))
|
|
81
81
|
.option('-s, --state <type>', t('cmd.new.opt.state'), 'default')
|
|
82
82
|
.option('-d, --dir <path>', t('cmd.new.opt.dir'), process.cwd())
|
|
83
|
+
.option('-p, --package <name>', '指定包名 (e.g., com.example.myapp)')
|
|
84
|
+
.option('-a, --author <name>', '指定作者名称')
|
|
83
85
|
.option('--no-cache', t('cmd.new.opt.no_cache'))
|
|
84
86
|
.option('--no-network', '不包含网络层(默认包含)')
|
|
85
87
|
.option('--remote', t('cmd.new.opt.remote'))
|
package/lib/commands/add.js
CHANGED
package/lib/commands/assets.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as p from '@clack/prompts';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
|
-
import { AppAssetsManager, ConsoleLogger } from '
|
|
5
|
+
import { AppAssetsManager, ConsoleLogger } from 'flu-cli-core';
|
|
6
6
|
import { t } from '../utils/i18n.js';
|
|
7
7
|
|
|
8
8
|
const logger = new ConsoleLogger();
|
package/lib/commands/config.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 职责:初始化和管理项目配置文件
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ProjectConfigManager, detectProjectTemplate, ConfigManager } from '
|
|
6
|
+
import { ProjectConfigManager, detectProjectTemplate, ConfigManager } from 'flu-cli-core';
|
|
7
7
|
import { writeFileSync, existsSync } from 'fs';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
import chalk from 'chalk';
|
package/lib/commands/newClack.js
CHANGED
|
@@ -13,7 +13,7 @@ import { getTemplate, isValidTemplate, getAllTemplates } from '../../config/temp
|
|
|
13
13
|
import { selectTemplateWithEnquirer } from '../utils/templateSelectorEnquirer.js';
|
|
14
14
|
import { cloneOrUpdateTemplate } from '../templates/templateManager.js';
|
|
15
15
|
import { getAuthorName, saveAuthorName, saveDefaultTemplate } from '../utils/config.js';
|
|
16
|
-
import { ConfigManager, ProjectGenerator } from '
|
|
16
|
+
import { ConfigManager, ProjectGenerator } from 'flu-cli-core';
|
|
17
17
|
import { copyTemplate, replaceVariables, copyCustomTemplate, ensurePubspecName, mergePubspecFromTemplate, cleanupTemplateFiles } from '../templates/templateCopier.js';
|
|
18
18
|
import { runFlutterCreate } from '../utils/flutterHelper.js';
|
|
19
19
|
import { syncSnippets } from './snippets.js';
|
|
@@ -250,8 +250,8 @@ export async function newProjectWithClack (projectName, options) {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
const defaultPackageName = `com.example.${finalProjectName}`;
|
|
253
|
-
let packageName = defaultPackageName;
|
|
254
|
-
if (!nonInteractive) {
|
|
253
|
+
let packageName = options.package || defaultPackageName;
|
|
254
|
+
if (!options.package && !nonInteractive) {
|
|
255
255
|
packageName = await p.text({ message: `请输入包名(直接回车使用: ${defaultPackageName})`, placeholder: defaultPackageName });
|
|
256
256
|
if (p.isCancel(packageName)) {
|
|
257
257
|
p.cancel('操作已取消');
|
|
@@ -262,8 +262,8 @@ export async function newProjectWithClack (projectName, options) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
let author = 'Your Name';
|
|
266
|
-
if (!nonInteractive) {
|
|
265
|
+
let author = options.author || 'Your Name';
|
|
266
|
+
if (!options.author && !nonInteractive) {
|
|
267
267
|
author = await p.text({ message: '请输入作者名称(直接回车使用: Your Name)', placeholder: 'Your Name' });
|
|
268
268
|
if (p.isCancel(author)) {
|
|
269
269
|
p.cancel('操作已取消');
|
package/lib/commands/snippets.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
-
import { ProjectConfigManager, getTemplatesRootDir } from '
|
|
5
|
+
import { ProjectConfigManager, getTemplatesRootDir } from 'flu-cli-core';
|
|
6
6
|
import { t } from '../utils/i18n.js';
|
|
7
7
|
|
|
8
8
|
/**
|
package/lib/commands/template.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 模板复制器 - 桥接至
|
|
2
|
+
* 模板复制器 - 桥接至 flu-cli-core
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export {
|
|
@@ -8,7 +8,7 @@ export {
|
|
|
8
8
|
replaceVariables,
|
|
9
9
|
ensurePubspecName,
|
|
10
10
|
cleanupTemplateFiles
|
|
11
|
-
} from '
|
|
11
|
+
} from 'flu-cli-core';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* 使用模板的 pubspec.yaml 合并覆盖目标项目 (仅限 V2 保持逻辑)
|
package/lib/utils/config.js
CHANGED
package/lib/utils/i18n.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 国际化工具 - 桥接至
|
|
2
|
+
* 国际化工具 - 桥接至 flu-cli-core
|
|
3
3
|
*/
|
|
4
|
-
import { I18nManager, t as coreT } from '
|
|
4
|
+
import { I18nManager, t as coreT } from 'flu-cli-core';
|
|
5
5
|
|
|
6
6
|
export const i18n = I18nManager.getInstance();
|
|
7
7
|
export const t = (key, params) => coreT(key, params);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 使用 Enquirer 实现实时模板预览
|
|
3
3
|
* 职责:负责 CLI 环境下的模板选择交互逻辑
|
|
4
|
-
* 该文件从
|
|
4
|
+
* 该文件从 flu-cli-core 迁移回来,以保持 core 的 Headless 纯净。
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import enquirer from 'enquirer';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import { existsSync } from 'fs';
|
|
10
10
|
import { basename } from 'path';
|
|
11
|
-
import { BUILTIN_TEMPLATES, ConfigManager } from '
|
|
11
|
+
import { BUILTIN_TEMPLATES, ConfigManager } from 'flu-cli-core';
|
|
12
12
|
|
|
13
13
|
const { Select } = enquirer;
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flu-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Flutter MVVM 脚手架工具",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@clack/prompts": "^0.11.0",
|
|
40
|
-
"
|
|
40
|
+
"flu-cli-core": "^1.0.2",
|
|
41
41
|
"chalk": "^4.1.2",
|
|
42
42
|
"commander": "^11.1.0",
|
|
43
43
|
"date-fns": "^4.1.0",
|