flu-cli-core 1.0.1 → 1.0.3
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 +84 -38
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-FOMWV2YP.js → chunk-ANN4MX7M.js} +25 -15
- package/dist/{factory-6DDXZYQP.js → factory-W73G7NBW.js} +2 -1
- package/dist/index.cjs +5268 -786
- package/dist/index.d.cts +122 -61
- package/dist/index.d.ts +122 -61
- package/dist/index.js +5171 -725
- package/dist/{upgrade_snippets-XFR7Q444.js → upgrade_snippets-J7SRI6M5.js} +1 -0
- package/locales/en-US.json +1 -1
- package/locales/zh-CN.json +2 -2
- package/package.json +56 -49
- package/templates/core_files/network/app_error_code.dart.template +6 -6
- package/templates/core_files/network/app_http.dart.template +4 -4
- package/templates/core_files/network/app_response.dart.template +2 -2
- package/templates/core_files/utils/loading_util.dart.template +13 -4
- package/templates/snippets/flu-cli.code-snippets +26 -36
- package/templates/request_helper.dart.template +0 -59
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { UploadConfig, BuildResult } from 'app-ship';
|
|
2
|
+
export * from '@huoye/app-ship';
|
|
3
|
+
|
|
1
4
|
interface Logger {
|
|
2
5
|
info(message: string): void;
|
|
3
6
|
success(message: string): void;
|
|
@@ -168,83 +171,35 @@ declare class TemplateGenerator {
|
|
|
168
171
|
*/
|
|
169
172
|
declare function updateIndexFile(dirPath: string, fileName: string): boolean;
|
|
170
173
|
|
|
171
|
-
/**
|
|
172
|
-
* 获取模板根目录
|
|
173
|
-
* 兼容 ESM 和打包后的场景
|
|
174
|
-
*/
|
|
175
174
|
declare function getTemplatesRootDir(): string;
|
|
176
|
-
/**
|
|
177
|
-
* 获取 core_files 模板目录
|
|
178
|
-
*/
|
|
179
175
|
declare function getCoreFilesDir(): string;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
* @param projectPath 项目根目录
|
|
183
|
-
* @param options 配置选项
|
|
184
|
-
*/
|
|
176
|
+
declare function getNetworkDir(): string;
|
|
177
|
+
|
|
185
178
|
declare function copyCoreFiles(projectPath: string, options?: {
|
|
186
179
|
includeNetworkLayer?: boolean;
|
|
187
180
|
templateType?: 'lite' | 'modular' | 'clean';
|
|
188
181
|
projectName?: string;
|
|
189
182
|
stateManager?: string;
|
|
190
183
|
}): Promise<void>;
|
|
191
|
-
/**
|
|
192
|
-
* 获取 network 模板目录
|
|
193
|
-
*/
|
|
194
|
-
declare function getNetworkDir(): string;
|
|
195
|
-
/**
|
|
196
|
-
* 复制 network 文件到项目
|
|
197
|
-
* @param projectPath 项目根目录
|
|
198
|
-
* @param targetDir 目标目录(相对于项目根目录),默认为 'lib/core/network'
|
|
199
|
-
* @param includeExamples 是否包含示例文件,默认为 false
|
|
200
|
-
*/
|
|
201
184
|
declare function copyNetworkFiles(projectPath: string, options?: {
|
|
202
185
|
targetDir?: string;
|
|
203
186
|
includeExamples?: boolean;
|
|
204
187
|
}): Promise<void>;
|
|
205
|
-
/**
|
|
206
|
-
* 复制完整的基础设施层(core files)
|
|
207
|
-
* @param projectPath 项目根目录
|
|
208
|
-
* @param includeExamples 是否包含示例文件(已废弃,保留兼容性)
|
|
209
|
-
* @param includeNetwork 是否包含网络层
|
|
210
|
-
*/
|
|
211
188
|
declare function copyInfrastructure(projectPath: string, includeExamples?: boolean, includeNetworkLayer?: boolean, templateType?: 'lite' | 'modular' | 'clean'): Promise<void>;
|
|
212
|
-
|
|
213
|
-
* 移除模板后缀并复制模板
|
|
214
|
-
*/
|
|
189
|
+
|
|
215
190
|
declare function copyTemplate(templatePath: string, targetPath: string, options?: {
|
|
216
191
|
excludes?: string[];
|
|
217
192
|
}): Promise<boolean>;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
*/
|
|
193
|
+
declare function copyCustomTemplate(templatePath: string, targetPath: string): Promise<boolean>;
|
|
194
|
+
declare function ensurePubspecName(projectDir: string, projectName: string): Promise<void>;
|
|
195
|
+
declare function cleanupTemplateFiles(projectDir: string): Promise<void>;
|
|
196
|
+
|
|
223
197
|
declare function injectNetworkExamples(projectPath: string, contextData?: any): Promise<void>;
|
|
224
|
-
/**
|
|
225
|
-
* 自动生成目录下的 index.dart 导出文件
|
|
226
|
-
*/
|
|
227
198
|
declare function generateIndexFile(dir: string): Promise<void>;
|
|
228
|
-
|
|
229
|
-
* 复制自定义模板(仅 lib, assets, .vscode 等)
|
|
230
|
-
*/
|
|
231
|
-
declare function copyCustomTemplate(templatePath: string, targetPath: string): Promise<boolean>;
|
|
232
|
-
/**
|
|
233
|
-
* 变量替换
|
|
234
|
-
*/
|
|
199
|
+
|
|
235
200
|
declare function replaceVariables(projectDir: string, variables: any): Promise<boolean>;
|
|
236
|
-
|
|
237
|
-
* 递归移除目录中所有文件的 .template 后缀
|
|
238
|
-
*/
|
|
201
|
+
|
|
239
202
|
declare function removeTemplateSuffix(dir: string): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* 强制校正 pubspec.yaml 的 name 字段为项目名
|
|
242
|
-
*/
|
|
243
|
-
declare function ensurePubspecName(projectDir: string, projectName: string): Promise<void>;
|
|
244
|
-
/**
|
|
245
|
-
* 清理模板特有文件
|
|
246
|
-
*/
|
|
247
|
-
declare function cleanupTemplateFiles(projectDir: string): Promise<void>;
|
|
248
203
|
|
|
249
204
|
/**
|
|
250
205
|
* 页面生成器
|
|
@@ -335,8 +290,22 @@ interface CustomTemplate {
|
|
|
335
290
|
description?: string;
|
|
336
291
|
lastUsedAt?: number;
|
|
337
292
|
}
|
|
293
|
+
interface ProjectPreset {
|
|
294
|
+
id: string;
|
|
295
|
+
name: string;
|
|
296
|
+
templateType: string;
|
|
297
|
+
stateManager: string;
|
|
298
|
+
includeNetworkLayer: boolean;
|
|
299
|
+
platforms: string[];
|
|
300
|
+
assetStrategy?: 'manual' | 'skip';
|
|
301
|
+
triggerAssetWizard?: boolean;
|
|
302
|
+
includeAppIcon?: boolean;
|
|
303
|
+
includeSplashLogo?: boolean;
|
|
304
|
+
createdAt?: number;
|
|
305
|
+
}
|
|
338
306
|
interface FluConfig {
|
|
339
307
|
templates: CustomTemplate[];
|
|
308
|
+
presets?: ProjectPreset[];
|
|
340
309
|
authorName?: string;
|
|
341
310
|
defaultTemplate?: {
|
|
342
311
|
type: 'builtin' | 'custom';
|
|
@@ -356,6 +325,14 @@ declare class ConfigManager {
|
|
|
356
325
|
addTemplate(template: CustomTemplate): void;
|
|
357
326
|
removeTemplate(id: string): boolean;
|
|
358
327
|
getTemplate(id: string): CustomTemplate | undefined;
|
|
328
|
+
getPresets(): ProjectPreset[];
|
|
329
|
+
addPreset(preset: ProjectPreset): void;
|
|
330
|
+
removePreset(id: string): boolean;
|
|
331
|
+
savePresets(presets: ProjectPreset[]): void;
|
|
332
|
+
getPresetById(id: string): ProjectPreset | undefined;
|
|
333
|
+
updatePreset(id: string, updatedPreset: Partial<ProjectPreset>): boolean;
|
|
334
|
+
isPresetNameUnique(name: string, excludeId?: string): boolean;
|
|
335
|
+
saveTemplates(templates: CustomTemplate[]): void;
|
|
359
336
|
getAuthorName(): string;
|
|
360
337
|
setAuthorName(name: string): void;
|
|
361
338
|
getDefaultTemplate(): {
|
|
@@ -465,7 +442,7 @@ declare class ProjectConfigManager {
|
|
|
465
442
|
* @param generatorType 生成器类型
|
|
466
443
|
* @returns 生成器配置,如果不存在则返回 null
|
|
467
444
|
*/
|
|
468
|
-
static getGeneratorConfig(projectDir: string, generatorType: 'page' | 'viewModel' | 'widget' | 'model' | 'component'): GeneratorConfig | null;
|
|
445
|
+
static getGeneratorConfig(projectDir: string, generatorType: 'page' | 'viewModel' | 'widget' | 'model' | 'component' | 'service'): GeneratorConfig | null;
|
|
469
446
|
/**
|
|
470
447
|
* 获取默认配置模板
|
|
471
448
|
* @param templateType 模板类型
|
|
@@ -620,10 +597,11 @@ declare const t: (key: string, params?: Record<string, any>) => string;
|
|
|
620
597
|
* @param {string} projectDir - 项目目录
|
|
621
598
|
* @param {string} projectName - 项目名称
|
|
622
599
|
* @param {string} packageName - 包名
|
|
623
|
-
* @param {string} flutterTemplate - Flutter 官方模板
|
|
600
|
+
* @param {string} flutterTemplate - Flutter 官方模板
|
|
601
|
+
* @param {string[]} platforms - 目标平台 (ios, android, web, windows, macos, linux, ohos)
|
|
624
602
|
* @returns {Promise<boolean>} 是否成功
|
|
625
603
|
*/
|
|
626
|
-
declare function runFlutterCreate(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string): Promise<boolean>;
|
|
604
|
+
declare function runFlutterCreate(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string, platforms?: string[]): Promise<boolean>;
|
|
627
605
|
/**
|
|
628
606
|
* 运行 flutter pub get
|
|
629
607
|
* @param {string} projectDir - 项目目录
|
|
@@ -641,4 +619,87 @@ declare function checkFlutterInstalled(): Promise<boolean>;
|
|
|
641
619
|
*/
|
|
642
620
|
declare function getFlutterVersion(): Promise<string | null>;
|
|
643
621
|
|
|
644
|
-
|
|
622
|
+
type BuildPlatform = 'android' | 'ios';
|
|
623
|
+
declare class BuildManager {
|
|
624
|
+
static build(platform: BuildPlatform, buildConfig: NonNullable<UploadConfig['build']>, projectDir?: string): Promise<BuildResult>;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
type ProjectRootMarker = 'pubspec.yaml' | '.flu-cli.json';
|
|
628
|
+
interface FindProjectRootOptions {
|
|
629
|
+
markers?: ProjectRootMarker[];
|
|
630
|
+
stopAt?: string;
|
|
631
|
+
}
|
|
632
|
+
interface PubspecInfo {
|
|
633
|
+
name?: string;
|
|
634
|
+
description?: string;
|
|
635
|
+
version?: string;
|
|
636
|
+
}
|
|
637
|
+
declare class ProjectContextService {
|
|
638
|
+
static findProjectRootSync(startPath: string, options?: FindProjectRootOptions): string | null;
|
|
639
|
+
static findProjectRoot(startPath: string, options?: FindProjectRootOptions): Promise<string | null>;
|
|
640
|
+
static listFlutterProjectsInDirectory(directoryPath: string, options?: {
|
|
641
|
+
maxDepth?: number;
|
|
642
|
+
ignore?: string[];
|
|
643
|
+
}): Promise<string[]>;
|
|
644
|
+
static readPubspecInfo(projectRoot: string): Promise<PubspecInfo | null>;
|
|
645
|
+
static inferFeatureFromPath(projectRoot: string, fileOrDirPath: string): string | null;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
declare class TemplatePresetService {
|
|
649
|
+
static listTemplates(): CustomTemplate[];
|
|
650
|
+
static upsertTemplate(template: CustomTemplate): void;
|
|
651
|
+
static removeTemplate(templateId: string): boolean;
|
|
652
|
+
static saveTemplates(templates: CustomTemplate[]): void;
|
|
653
|
+
static listPresets(): ProjectPreset[];
|
|
654
|
+
static upsertPreset(preset: ProjectPreset): void;
|
|
655
|
+
static removePreset(presetId: string): boolean;
|
|
656
|
+
static savePresets(presets: ProjectPreset[]): void;
|
|
657
|
+
static getPresetById(id: string): ProjectPreset | undefined;
|
|
658
|
+
static updatePreset(id: string, updatedPreset: Partial<ProjectPreset>): boolean;
|
|
659
|
+
static isPresetNameUnique(name: string, excludeId?: string): boolean;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
declare class AndroidBuilder {
|
|
663
|
+
/**
|
|
664
|
+
* 执行 Android 构建
|
|
665
|
+
* @param config 构建配置
|
|
666
|
+
* @param projectDir 项目目录
|
|
667
|
+
*/
|
|
668
|
+
static build(config: NonNullable<UploadConfig['build']>['android'], projectDir?: string): Promise<BuildResult>;
|
|
669
|
+
/**
|
|
670
|
+
* 查找构建产物
|
|
671
|
+
* @param projectDir 项目目录
|
|
672
|
+
* @param type 类型 (apk/appbundle)
|
|
673
|
+
* @param flavor 风味
|
|
674
|
+
*/
|
|
675
|
+
private static findArtifact;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
declare class IOSBuilder {
|
|
679
|
+
/**
|
|
680
|
+
* 执行 iOS 构建
|
|
681
|
+
* @param config 构建配置
|
|
682
|
+
* @param projectDir 项目目录
|
|
683
|
+
*/
|
|
684
|
+
static build(config: NonNullable<UploadConfig['build']>['ios'], projectDir?: string): Promise<BuildResult>;
|
|
685
|
+
/**
|
|
686
|
+
* 生成导出选项 (ExportOptions.plist)
|
|
687
|
+
* @param path 文件路径
|
|
688
|
+
* @param method 导出方式
|
|
689
|
+
* @param teamId 团队 ID
|
|
690
|
+
*/
|
|
691
|
+
private static generateExportOptions;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* 修正 Android 包名
|
|
696
|
+
* 强制更新 build.gradle, AndroidManifest.xml 等文件中的包名配置
|
|
697
|
+
*/
|
|
698
|
+
declare function fixAndroidPackageName(projectDir: string, packageName: string, logger?: Logger): Promise<void>;
|
|
699
|
+
/**
|
|
700
|
+
* 修正 iOS Bundle Identifier
|
|
701
|
+
* 强制更新 project.pbxproj 中的 PRODUCT_BUNDLE_IDENTIFIER
|
|
702
|
+
*/
|
|
703
|
+
declare function fixIosBundleIdentifier(projectDir: string, bundleId: string, logger?: Logger): Promise<void>;
|
|
704
|
+
|
|
705
|
+
export { AndroidBuilder, type AppAssetConfig, AppAssetsManager, BUILTIN_TEMPLATES, BuildManager, ConfigManager, ConsoleLogger, type CustomTemplate, type FluConfig, type GeneratorConfig, I18nManager, IOSBuilder, type Logger, type ProjectConfig, ProjectConfigManager, ProjectContextService, ProjectGenerator, type ProjectOptions, type ProjectPreset, type ProjectTemplate, TemplateGenerator, TemplateManager, TemplatePresetService, type TemplateType, checkFlutterInstalled, checkSnippetsVersion, cleanupTemplateFiles, copyCoreFiles, copyCustomTemplate, copyInfrastructure, copyNetworkFiles, copyTemplate, detectProjectTemplate, ensurePubspecName, fixAndroidPackageName, fixIosBundleIdentifier, generateComponent, generateIndexFile, generateModel, generateModule, generatePage, generateService, generateViewModel, generateWidget, getCoreFilesDir, getFlutterVersion, getModelPath, getNetworkDir, getPagePath, getRelativeImportPath, getServicePath, getSnippetContent, getStateManager, getTemplatesRootDir, getViewModelPath, getWidgetPath, injectNetworkExamples, isCustomTemplateProject, loadProjectSnippets, logger, removeTemplateSuffix, renderSnippet, replaceVariables, runFlutterCreate, runFlutterPubGet, t, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toTitleCase, updateIndexFile, upgradeSnippets };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { UploadConfig, BuildResult } from 'app-ship';
|
|
2
|
+
export * from '@huoye/app-ship';
|
|
3
|
+
|
|
1
4
|
interface Logger {
|
|
2
5
|
info(message: string): void;
|
|
3
6
|
success(message: string): void;
|
|
@@ -168,83 +171,35 @@ declare class TemplateGenerator {
|
|
|
168
171
|
*/
|
|
169
172
|
declare function updateIndexFile(dirPath: string, fileName: string): boolean;
|
|
170
173
|
|
|
171
|
-
/**
|
|
172
|
-
* 获取模板根目录
|
|
173
|
-
* 兼容 ESM 和打包后的场景
|
|
174
|
-
*/
|
|
175
174
|
declare function getTemplatesRootDir(): string;
|
|
176
|
-
/**
|
|
177
|
-
* 获取 core_files 模板目录
|
|
178
|
-
*/
|
|
179
175
|
declare function getCoreFilesDir(): string;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
* @param projectPath 项目根目录
|
|
183
|
-
* @param options 配置选项
|
|
184
|
-
*/
|
|
176
|
+
declare function getNetworkDir(): string;
|
|
177
|
+
|
|
185
178
|
declare function copyCoreFiles(projectPath: string, options?: {
|
|
186
179
|
includeNetworkLayer?: boolean;
|
|
187
180
|
templateType?: 'lite' | 'modular' | 'clean';
|
|
188
181
|
projectName?: string;
|
|
189
182
|
stateManager?: string;
|
|
190
183
|
}): Promise<void>;
|
|
191
|
-
/**
|
|
192
|
-
* 获取 network 模板目录
|
|
193
|
-
*/
|
|
194
|
-
declare function getNetworkDir(): string;
|
|
195
|
-
/**
|
|
196
|
-
* 复制 network 文件到项目
|
|
197
|
-
* @param projectPath 项目根目录
|
|
198
|
-
* @param targetDir 目标目录(相对于项目根目录),默认为 'lib/core/network'
|
|
199
|
-
* @param includeExamples 是否包含示例文件,默认为 false
|
|
200
|
-
*/
|
|
201
184
|
declare function copyNetworkFiles(projectPath: string, options?: {
|
|
202
185
|
targetDir?: string;
|
|
203
186
|
includeExamples?: boolean;
|
|
204
187
|
}): Promise<void>;
|
|
205
|
-
/**
|
|
206
|
-
* 复制完整的基础设施层(core files)
|
|
207
|
-
* @param projectPath 项目根目录
|
|
208
|
-
* @param includeExamples 是否包含示例文件(已废弃,保留兼容性)
|
|
209
|
-
* @param includeNetwork 是否包含网络层
|
|
210
|
-
*/
|
|
211
188
|
declare function copyInfrastructure(projectPath: string, includeExamples?: boolean, includeNetworkLayer?: boolean, templateType?: 'lite' | 'modular' | 'clean'): Promise<void>;
|
|
212
|
-
|
|
213
|
-
* 移除模板后缀并复制模板
|
|
214
|
-
*/
|
|
189
|
+
|
|
215
190
|
declare function copyTemplate(templatePath: string, targetPath: string, options?: {
|
|
216
191
|
excludes?: string[];
|
|
217
192
|
}): Promise<boolean>;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
*/
|
|
193
|
+
declare function copyCustomTemplate(templatePath: string, targetPath: string): Promise<boolean>;
|
|
194
|
+
declare function ensurePubspecName(projectDir: string, projectName: string): Promise<void>;
|
|
195
|
+
declare function cleanupTemplateFiles(projectDir: string): Promise<void>;
|
|
196
|
+
|
|
223
197
|
declare function injectNetworkExamples(projectPath: string, contextData?: any): Promise<void>;
|
|
224
|
-
/**
|
|
225
|
-
* 自动生成目录下的 index.dart 导出文件
|
|
226
|
-
*/
|
|
227
198
|
declare function generateIndexFile(dir: string): Promise<void>;
|
|
228
|
-
|
|
229
|
-
* 复制自定义模板(仅 lib, assets, .vscode 等)
|
|
230
|
-
*/
|
|
231
|
-
declare function copyCustomTemplate(templatePath: string, targetPath: string): Promise<boolean>;
|
|
232
|
-
/**
|
|
233
|
-
* 变量替换
|
|
234
|
-
*/
|
|
199
|
+
|
|
235
200
|
declare function replaceVariables(projectDir: string, variables: any): Promise<boolean>;
|
|
236
|
-
|
|
237
|
-
* 递归移除目录中所有文件的 .template 后缀
|
|
238
|
-
*/
|
|
201
|
+
|
|
239
202
|
declare function removeTemplateSuffix(dir: string): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* 强制校正 pubspec.yaml 的 name 字段为项目名
|
|
242
|
-
*/
|
|
243
|
-
declare function ensurePubspecName(projectDir: string, projectName: string): Promise<void>;
|
|
244
|
-
/**
|
|
245
|
-
* 清理模板特有文件
|
|
246
|
-
*/
|
|
247
|
-
declare function cleanupTemplateFiles(projectDir: string): Promise<void>;
|
|
248
203
|
|
|
249
204
|
/**
|
|
250
205
|
* 页面生成器
|
|
@@ -335,8 +290,22 @@ interface CustomTemplate {
|
|
|
335
290
|
description?: string;
|
|
336
291
|
lastUsedAt?: number;
|
|
337
292
|
}
|
|
293
|
+
interface ProjectPreset {
|
|
294
|
+
id: string;
|
|
295
|
+
name: string;
|
|
296
|
+
templateType: string;
|
|
297
|
+
stateManager: string;
|
|
298
|
+
includeNetworkLayer: boolean;
|
|
299
|
+
platforms: string[];
|
|
300
|
+
assetStrategy?: 'manual' | 'skip';
|
|
301
|
+
triggerAssetWizard?: boolean;
|
|
302
|
+
includeAppIcon?: boolean;
|
|
303
|
+
includeSplashLogo?: boolean;
|
|
304
|
+
createdAt?: number;
|
|
305
|
+
}
|
|
338
306
|
interface FluConfig {
|
|
339
307
|
templates: CustomTemplate[];
|
|
308
|
+
presets?: ProjectPreset[];
|
|
340
309
|
authorName?: string;
|
|
341
310
|
defaultTemplate?: {
|
|
342
311
|
type: 'builtin' | 'custom';
|
|
@@ -356,6 +325,14 @@ declare class ConfigManager {
|
|
|
356
325
|
addTemplate(template: CustomTemplate): void;
|
|
357
326
|
removeTemplate(id: string): boolean;
|
|
358
327
|
getTemplate(id: string): CustomTemplate | undefined;
|
|
328
|
+
getPresets(): ProjectPreset[];
|
|
329
|
+
addPreset(preset: ProjectPreset): void;
|
|
330
|
+
removePreset(id: string): boolean;
|
|
331
|
+
savePresets(presets: ProjectPreset[]): void;
|
|
332
|
+
getPresetById(id: string): ProjectPreset | undefined;
|
|
333
|
+
updatePreset(id: string, updatedPreset: Partial<ProjectPreset>): boolean;
|
|
334
|
+
isPresetNameUnique(name: string, excludeId?: string): boolean;
|
|
335
|
+
saveTemplates(templates: CustomTemplate[]): void;
|
|
359
336
|
getAuthorName(): string;
|
|
360
337
|
setAuthorName(name: string): void;
|
|
361
338
|
getDefaultTemplate(): {
|
|
@@ -465,7 +442,7 @@ declare class ProjectConfigManager {
|
|
|
465
442
|
* @param generatorType 生成器类型
|
|
466
443
|
* @returns 生成器配置,如果不存在则返回 null
|
|
467
444
|
*/
|
|
468
|
-
static getGeneratorConfig(projectDir: string, generatorType: 'page' | 'viewModel' | 'widget' | 'model' | 'component'): GeneratorConfig | null;
|
|
445
|
+
static getGeneratorConfig(projectDir: string, generatorType: 'page' | 'viewModel' | 'widget' | 'model' | 'component' | 'service'): GeneratorConfig | null;
|
|
469
446
|
/**
|
|
470
447
|
* 获取默认配置模板
|
|
471
448
|
* @param templateType 模板类型
|
|
@@ -620,10 +597,11 @@ declare const t: (key: string, params?: Record<string, any>) => string;
|
|
|
620
597
|
* @param {string} projectDir - 项目目录
|
|
621
598
|
* @param {string} projectName - 项目名称
|
|
622
599
|
* @param {string} packageName - 包名
|
|
623
|
-
* @param {string} flutterTemplate - Flutter 官方模板
|
|
600
|
+
* @param {string} flutterTemplate - Flutter 官方模板
|
|
601
|
+
* @param {string[]} platforms - 目标平台 (ios, android, web, windows, macos, linux, ohos)
|
|
624
602
|
* @returns {Promise<boolean>} 是否成功
|
|
625
603
|
*/
|
|
626
|
-
declare function runFlutterCreate(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string): Promise<boolean>;
|
|
604
|
+
declare function runFlutterCreate(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string, platforms?: string[]): Promise<boolean>;
|
|
627
605
|
/**
|
|
628
606
|
* 运行 flutter pub get
|
|
629
607
|
* @param {string} projectDir - 项目目录
|
|
@@ -641,4 +619,87 @@ declare function checkFlutterInstalled(): Promise<boolean>;
|
|
|
641
619
|
*/
|
|
642
620
|
declare function getFlutterVersion(): Promise<string | null>;
|
|
643
621
|
|
|
644
|
-
|
|
622
|
+
type BuildPlatform = 'android' | 'ios';
|
|
623
|
+
declare class BuildManager {
|
|
624
|
+
static build(platform: BuildPlatform, buildConfig: NonNullable<UploadConfig['build']>, projectDir?: string): Promise<BuildResult>;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
type ProjectRootMarker = 'pubspec.yaml' | '.flu-cli.json';
|
|
628
|
+
interface FindProjectRootOptions {
|
|
629
|
+
markers?: ProjectRootMarker[];
|
|
630
|
+
stopAt?: string;
|
|
631
|
+
}
|
|
632
|
+
interface PubspecInfo {
|
|
633
|
+
name?: string;
|
|
634
|
+
description?: string;
|
|
635
|
+
version?: string;
|
|
636
|
+
}
|
|
637
|
+
declare class ProjectContextService {
|
|
638
|
+
static findProjectRootSync(startPath: string, options?: FindProjectRootOptions): string | null;
|
|
639
|
+
static findProjectRoot(startPath: string, options?: FindProjectRootOptions): Promise<string | null>;
|
|
640
|
+
static listFlutterProjectsInDirectory(directoryPath: string, options?: {
|
|
641
|
+
maxDepth?: number;
|
|
642
|
+
ignore?: string[];
|
|
643
|
+
}): Promise<string[]>;
|
|
644
|
+
static readPubspecInfo(projectRoot: string): Promise<PubspecInfo | null>;
|
|
645
|
+
static inferFeatureFromPath(projectRoot: string, fileOrDirPath: string): string | null;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
declare class TemplatePresetService {
|
|
649
|
+
static listTemplates(): CustomTemplate[];
|
|
650
|
+
static upsertTemplate(template: CustomTemplate): void;
|
|
651
|
+
static removeTemplate(templateId: string): boolean;
|
|
652
|
+
static saveTemplates(templates: CustomTemplate[]): void;
|
|
653
|
+
static listPresets(): ProjectPreset[];
|
|
654
|
+
static upsertPreset(preset: ProjectPreset): void;
|
|
655
|
+
static removePreset(presetId: string): boolean;
|
|
656
|
+
static savePresets(presets: ProjectPreset[]): void;
|
|
657
|
+
static getPresetById(id: string): ProjectPreset | undefined;
|
|
658
|
+
static updatePreset(id: string, updatedPreset: Partial<ProjectPreset>): boolean;
|
|
659
|
+
static isPresetNameUnique(name: string, excludeId?: string): boolean;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
declare class AndroidBuilder {
|
|
663
|
+
/**
|
|
664
|
+
* 执行 Android 构建
|
|
665
|
+
* @param config 构建配置
|
|
666
|
+
* @param projectDir 项目目录
|
|
667
|
+
*/
|
|
668
|
+
static build(config: NonNullable<UploadConfig['build']>['android'], projectDir?: string): Promise<BuildResult>;
|
|
669
|
+
/**
|
|
670
|
+
* 查找构建产物
|
|
671
|
+
* @param projectDir 项目目录
|
|
672
|
+
* @param type 类型 (apk/appbundle)
|
|
673
|
+
* @param flavor 风味
|
|
674
|
+
*/
|
|
675
|
+
private static findArtifact;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
declare class IOSBuilder {
|
|
679
|
+
/**
|
|
680
|
+
* 执行 iOS 构建
|
|
681
|
+
* @param config 构建配置
|
|
682
|
+
* @param projectDir 项目目录
|
|
683
|
+
*/
|
|
684
|
+
static build(config: NonNullable<UploadConfig['build']>['ios'], projectDir?: string): Promise<BuildResult>;
|
|
685
|
+
/**
|
|
686
|
+
* 生成导出选项 (ExportOptions.plist)
|
|
687
|
+
* @param path 文件路径
|
|
688
|
+
* @param method 导出方式
|
|
689
|
+
* @param teamId 团队 ID
|
|
690
|
+
*/
|
|
691
|
+
private static generateExportOptions;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* 修正 Android 包名
|
|
696
|
+
* 强制更新 build.gradle, AndroidManifest.xml 等文件中的包名配置
|
|
697
|
+
*/
|
|
698
|
+
declare function fixAndroidPackageName(projectDir: string, packageName: string, logger?: Logger): Promise<void>;
|
|
699
|
+
/**
|
|
700
|
+
* 修正 iOS Bundle Identifier
|
|
701
|
+
* 强制更新 project.pbxproj 中的 PRODUCT_BUNDLE_IDENTIFIER
|
|
702
|
+
*/
|
|
703
|
+
declare function fixIosBundleIdentifier(projectDir: string, bundleId: string, logger?: Logger): Promise<void>;
|
|
704
|
+
|
|
705
|
+
export { AndroidBuilder, type AppAssetConfig, AppAssetsManager, BUILTIN_TEMPLATES, BuildManager, ConfigManager, ConsoleLogger, type CustomTemplate, type FluConfig, type GeneratorConfig, I18nManager, IOSBuilder, type Logger, type ProjectConfig, ProjectConfigManager, ProjectContextService, ProjectGenerator, type ProjectOptions, type ProjectPreset, type ProjectTemplate, TemplateGenerator, TemplateManager, TemplatePresetService, type TemplateType, checkFlutterInstalled, checkSnippetsVersion, cleanupTemplateFiles, copyCoreFiles, copyCustomTemplate, copyInfrastructure, copyNetworkFiles, copyTemplate, detectProjectTemplate, ensurePubspecName, fixAndroidPackageName, fixIosBundleIdentifier, generateComponent, generateIndexFile, generateModel, generateModule, generatePage, generateService, generateViewModel, generateWidget, getCoreFilesDir, getFlutterVersion, getModelPath, getNetworkDir, getPagePath, getRelativeImportPath, getServicePath, getSnippetContent, getStateManager, getTemplatesRootDir, getViewModelPath, getWidgetPath, injectNetworkExamples, isCustomTemplateProject, loadProjectSnippets, logger, removeTemplateSuffix, renderSnippet, replaceVariables, runFlutterCreate, runFlutterPubGet, t, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toTitleCase, updateIndexFile, upgradeSnippets };
|