flu-cli-core 1.0.4 → 1.0.5
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 +13 -17
- package/dist/index.cjs +2240 -1173
- package/dist/index.d.cts +86 -9
- package/dist/index.d.ts +86 -9
- package/dist/index.js +2120 -1063
- package/package.json +7 -2
- package/templates/snippets/flu-cli.code-snippets +35 -26
package/dist/index.d.cts
CHANGED
|
@@ -101,6 +101,31 @@ declare function loadProjectSnippets(projectDir: string): any;
|
|
|
101
101
|
declare function renderSnippet(bodyLines: string[] | string, variables: Record<string, any>): string;
|
|
102
102
|
declare function getSnippetContent(projectDir: string, key: string, variables: Record<string, any>): string | null;
|
|
103
103
|
|
|
104
|
+
type GeneratorType = 'page' | 'viewModel' | 'widget' | 'component' | 'model' | 'service';
|
|
105
|
+
interface ResolveGeneratorDirOptions {
|
|
106
|
+
projectRoot: string;
|
|
107
|
+
type: GeneratorType;
|
|
108
|
+
feature?: string | null;
|
|
109
|
+
name?: string;
|
|
110
|
+
clickedPath?: string | null;
|
|
111
|
+
}
|
|
112
|
+
interface MirrorDirOptions {
|
|
113
|
+
sourceBaseDir: string;
|
|
114
|
+
sourceTargetDir: string;
|
|
115
|
+
targetBaseDir: string;
|
|
116
|
+
}
|
|
117
|
+
interface ResolveImportOptions {
|
|
118
|
+
configuredImport?: string | null;
|
|
119
|
+
fromFile: string;
|
|
120
|
+
projectRoot: string;
|
|
121
|
+
fallbackImport?: string | null;
|
|
122
|
+
}
|
|
123
|
+
declare function resolveGeneratorBaseDir(options: ResolveGeneratorDirOptions): string;
|
|
124
|
+
declare function resolveGeneratorTargetDir(options: ResolveGeneratorDirOptions): string;
|
|
125
|
+
declare function mirrorNestedTargetDir(options: MirrorDirOptions): string;
|
|
126
|
+
declare function resolveConfiguredImport(options: ResolveImportOptions): string | null;
|
|
127
|
+
declare function calculateRelativeImport(fromFile: string, toFile: string): string;
|
|
128
|
+
|
|
104
129
|
/**
|
|
105
130
|
* 模板生成器
|
|
106
131
|
* 负责生成各种类型的代码内容,供 Generator 和 Snippets 复用
|
|
@@ -134,6 +159,19 @@ declare class TemplateGenerator {
|
|
|
134
159
|
baseClass?: string;
|
|
135
160
|
extraImports?: string[];
|
|
136
161
|
}): string;
|
|
162
|
+
static generateListViewModel(namePascal: string, modelName: string, options?: {
|
|
163
|
+
coreImportPath?: string;
|
|
164
|
+
modelImportPath?: string;
|
|
165
|
+
baseClass?: string;
|
|
166
|
+
extraImports?: string[];
|
|
167
|
+
}): string;
|
|
168
|
+
static generateListPageWithBase(namePascal: string, nameTitle: string, modelName: string, options?: {
|
|
169
|
+
vmImportPath?: string;
|
|
170
|
+
modelImportPath?: string;
|
|
171
|
+
coreImportPath?: string;
|
|
172
|
+
baseClass?: string;
|
|
173
|
+
extraImports?: string[];
|
|
174
|
+
}): string;
|
|
137
175
|
/**
|
|
138
176
|
* 生成 Service
|
|
139
177
|
*/
|
|
@@ -170,6 +208,13 @@ declare class TemplateGenerator {
|
|
|
170
208
|
* @param {string} fileName - 要添加的文件名
|
|
171
209
|
*/
|
|
172
210
|
declare function updateIndexFile(dirPath: string, fileName: string): boolean;
|
|
211
|
+
/**
|
|
212
|
+
* 为嵌套目录级联更新 index.dart
|
|
213
|
+
* 例如:
|
|
214
|
+
* - pages/test/test_page.dart -> pages/test/index.dart export 'test_page.dart'
|
|
215
|
+
* - pages/index.dart -> export 'test/index.dart'
|
|
216
|
+
*/
|
|
217
|
+
declare function updateNestedIndexExports(rootDir: string, targetDir: string, fileName: string): boolean;
|
|
173
218
|
|
|
174
219
|
declare function getTemplatesRootDir(): string;
|
|
175
220
|
declare function getCoreFilesDir(): string;
|
|
@@ -352,6 +397,7 @@ interface ProjectOptions {
|
|
|
352
397
|
packageName: string;
|
|
353
398
|
outputDir: string;
|
|
354
399
|
includeNetworkLayer?: boolean;
|
|
400
|
+
createProjectConfig?: boolean;
|
|
355
401
|
}
|
|
356
402
|
/**
|
|
357
403
|
* ProjectGenerator (V6.0)
|
|
@@ -375,21 +421,29 @@ declare class ProjectGenerator {
|
|
|
375
421
|
* 项目配置管理器
|
|
376
422
|
* 职责:读取和管理项目级别的 .flu-cli.json 配置文件
|
|
377
423
|
*/
|
|
424
|
+
type ArchitectureMode = 'inherit' | 'mixin';
|
|
425
|
+
interface ArchitectureConfig {
|
|
426
|
+
mode?: ArchitectureMode;
|
|
427
|
+
}
|
|
378
428
|
/**
|
|
379
429
|
* 生成器配置接口
|
|
380
430
|
*/
|
|
381
431
|
interface GeneratorConfig {
|
|
382
432
|
path?: string;
|
|
433
|
+
allowSubDir?: boolean;
|
|
383
434
|
defaultType?: 'stateful' | 'stateless';
|
|
384
435
|
fileSuffix?: string;
|
|
385
436
|
fileName?: string;
|
|
437
|
+
policy?: GeneratorFieldPolicy;
|
|
386
438
|
withBasePage?: boolean;
|
|
387
439
|
basePageClass?: string;
|
|
440
|
+
baseListPageClass?: string;
|
|
388
441
|
basePageImport?: string;
|
|
389
442
|
withViewModel?: boolean;
|
|
390
443
|
viewModelPath?: string;
|
|
391
444
|
withBaseViewModel?: boolean;
|
|
392
445
|
baseViewModelClass?: string;
|
|
446
|
+
baseListViewModelClass?: string;
|
|
393
447
|
baseViewModelImport?: string;
|
|
394
448
|
withBaseWidget?: boolean;
|
|
395
449
|
baseWidgetClass?: string;
|
|
@@ -400,12 +454,18 @@ interface GeneratorConfig {
|
|
|
400
454
|
template?: 'network' | 'simple' | 'auto' | string;
|
|
401
455
|
snippetKey?: string;
|
|
402
456
|
mockLevel?: 'global' | 'instance';
|
|
457
|
+
baseServiceClass?: string;
|
|
458
|
+
baseServiceImport?: string;
|
|
459
|
+
mixins?: string[];
|
|
460
|
+
mixinImports?: string[];
|
|
461
|
+
serviceConstructor?: 'const' | 'normal';
|
|
403
462
|
}
|
|
404
463
|
/**
|
|
405
464
|
* 项目配置接口
|
|
406
465
|
*/
|
|
407
466
|
interface ProjectConfig {
|
|
408
467
|
template?: 'lite' | 'modular' | 'clean' | string;
|
|
468
|
+
architecture?: ArchitectureConfig;
|
|
409
469
|
packageName?: string;
|
|
410
470
|
generators?: {
|
|
411
471
|
page?: GeneratorConfig;
|
|
@@ -419,6 +479,16 @@ interface ProjectConfig {
|
|
|
419
479
|
};
|
|
420
480
|
};
|
|
421
481
|
}
|
|
482
|
+
type ProjectConfigSource = 'disk' | 'inferred' | 'builtin';
|
|
483
|
+
type GeneratorPolicyMode = 'locked' | 'default';
|
|
484
|
+
type GeneratorFieldPolicy = Partial<Record<string, GeneratorPolicyMode>>;
|
|
485
|
+
interface ResolvedProjectConfig {
|
|
486
|
+
source: ProjectConfigSource;
|
|
487
|
+
config: ProjectConfig;
|
|
488
|
+
diagnostics: string[];
|
|
489
|
+
hasDiskConfig: boolean;
|
|
490
|
+
}
|
|
491
|
+
type GeneratorConfigType = 'page' | 'viewModel' | 'widget' | 'model' | 'component' | 'service';
|
|
422
492
|
/**
|
|
423
493
|
* 项目配置管理器
|
|
424
494
|
*/
|
|
@@ -436,20 +506,33 @@ declare class ProjectConfigManager {
|
|
|
436
506
|
* @returns 是否存在配置文件
|
|
437
507
|
*/
|
|
438
508
|
static hasConfig(projectDir: string): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* 解析运行时生效配置。
|
|
511
|
+
* 即使项目没有真实 .flu-cli.json,也会基于目录结构和内置默认值得到一份权威配置。
|
|
512
|
+
*/
|
|
513
|
+
static resolveEffectiveConfig(projectDir: string): ResolvedProjectConfig;
|
|
439
514
|
/**
|
|
440
515
|
* 获取指定生成器的配置
|
|
441
516
|
* @param projectDir 项目目录
|
|
442
517
|
* @param generatorType 生成器类型
|
|
443
518
|
* @returns 生成器配置,如果不存在则返回 null
|
|
444
519
|
*/
|
|
445
|
-
static getGeneratorConfig(projectDir: string, generatorType:
|
|
520
|
+
static getGeneratorConfig(projectDir: string, generatorType: GeneratorConfigType): GeneratorConfig | null;
|
|
521
|
+
/**
|
|
522
|
+
* 仅根据目录结构推断模板类型。
|
|
523
|
+
*/
|
|
524
|
+
static inferTemplateFromStructure(projectDir: string): 'lite' | 'modular' | 'clean' | null;
|
|
446
525
|
/**
|
|
447
526
|
* 获取默认配置模板
|
|
448
527
|
* @param templateType 模板类型
|
|
449
528
|
* @returns 配置模板对象
|
|
450
529
|
*/
|
|
451
530
|
static getDefaultConfigTemplate(templateType: 'lite' | 'modular' | 'clean' | 'custom' | string): ProjectConfig;
|
|
531
|
+
private static readPackageName;
|
|
452
532
|
}
|
|
533
|
+
declare function getArchitectureMode(config?: ProjectConfig | null): ArchitectureMode;
|
|
534
|
+
declare function getGeneratorFieldPolicy(config: ProjectConfig | null | undefined, generatorType: GeneratorConfigType, field: string): GeneratorPolicyMode | null;
|
|
535
|
+
declare function isGeneratorFieldLocked(config: ProjectConfig | null | undefined, generatorType: GeneratorConfigType, field: string): boolean;
|
|
453
536
|
|
|
454
537
|
/**
|
|
455
538
|
* 应用资源选择接口
|
|
@@ -619,7 +702,7 @@ declare function checkFlutterInstalled(): Promise<boolean>;
|
|
|
619
702
|
*/
|
|
620
703
|
declare function getFlutterVersion(): Promise<string | null>;
|
|
621
704
|
|
|
622
|
-
type BuildPlatform = 'android' | 'ios';
|
|
705
|
+
type BuildPlatform = 'android' | 'ios' | 'harmony';
|
|
623
706
|
declare class BuildManager {
|
|
624
707
|
static build(platform: BuildPlatform, buildConfig: NonNullable<UploadConfig['build']>, projectDir?: string): Promise<BuildResult>;
|
|
625
708
|
}
|
|
@@ -666,12 +749,6 @@ declare class AndroidBuilder {
|
|
|
666
749
|
* @param projectDir 项目目录
|
|
667
750
|
*/
|
|
668
751
|
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
752
|
private static findArtifact;
|
|
676
753
|
}
|
|
677
754
|
|
|
@@ -702,4 +779,4 @@ declare function fixAndroidPackageName(projectDir: string, packageName: string,
|
|
|
702
779
|
*/
|
|
703
780
|
declare function fixIosBundleIdentifier(projectDir: string, bundleId: string, logger?: Logger): Promise<void>;
|
|
704
781
|
|
|
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 };
|
|
782
|
+
export { AndroidBuilder, type AppAssetConfig, AppAssetsManager, type ArchitectureConfig, type ArchitectureMode, BUILTIN_TEMPLATES, BuildManager, ConfigManager, ConsoleLogger, type CustomTemplate, type FluConfig, type GeneratorConfig, type GeneratorConfigType, type GeneratorFieldPolicy, type GeneratorPolicyMode, type GeneratorType, I18nManager, IOSBuilder, type Logger, type ProjectConfig, ProjectConfigManager, type ProjectConfigSource, ProjectContextService, ProjectGenerator, type ProjectOptions, type ProjectPreset, type ProjectTemplate, type ResolvedProjectConfig, TemplateGenerator, TemplateManager, TemplatePresetService, type TemplateType, calculateRelativeImport, checkFlutterInstalled, checkSnippetsVersion, cleanupTemplateFiles, copyCoreFiles, copyCustomTemplate, copyInfrastructure, copyNetworkFiles, copyTemplate, detectProjectTemplate, ensurePubspecName, fixAndroidPackageName, fixIosBundleIdentifier, generateComponent, generateIndexFile, generateModel, generateModule, generatePage, generateService, generateViewModel, generateWidget, getArchitectureMode, getCoreFilesDir, getFlutterVersion, getGeneratorFieldPolicy, getModelPath, getNetworkDir, getPagePath, getRelativeImportPath, getServicePath, getSnippetContent, getStateManager, getTemplatesRootDir, getViewModelPath, getWidgetPath, injectNetworkExamples, isCustomTemplateProject, isGeneratorFieldLocked, loadProjectSnippets, logger, mirrorNestedTargetDir, removeTemplateSuffix, renderSnippet, replaceVariables, resolveConfiguredImport, resolveGeneratorBaseDir, resolveGeneratorTargetDir, runFlutterCreate, runFlutterPubGet, t, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toTitleCase, updateIndexFile, updateNestedIndexExports, upgradeSnippets };
|
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,31 @@ declare function loadProjectSnippets(projectDir: string): any;
|
|
|
101
101
|
declare function renderSnippet(bodyLines: string[] | string, variables: Record<string, any>): string;
|
|
102
102
|
declare function getSnippetContent(projectDir: string, key: string, variables: Record<string, any>): string | null;
|
|
103
103
|
|
|
104
|
+
type GeneratorType = 'page' | 'viewModel' | 'widget' | 'component' | 'model' | 'service';
|
|
105
|
+
interface ResolveGeneratorDirOptions {
|
|
106
|
+
projectRoot: string;
|
|
107
|
+
type: GeneratorType;
|
|
108
|
+
feature?: string | null;
|
|
109
|
+
name?: string;
|
|
110
|
+
clickedPath?: string | null;
|
|
111
|
+
}
|
|
112
|
+
interface MirrorDirOptions {
|
|
113
|
+
sourceBaseDir: string;
|
|
114
|
+
sourceTargetDir: string;
|
|
115
|
+
targetBaseDir: string;
|
|
116
|
+
}
|
|
117
|
+
interface ResolveImportOptions {
|
|
118
|
+
configuredImport?: string | null;
|
|
119
|
+
fromFile: string;
|
|
120
|
+
projectRoot: string;
|
|
121
|
+
fallbackImport?: string | null;
|
|
122
|
+
}
|
|
123
|
+
declare function resolveGeneratorBaseDir(options: ResolveGeneratorDirOptions): string;
|
|
124
|
+
declare function resolveGeneratorTargetDir(options: ResolveGeneratorDirOptions): string;
|
|
125
|
+
declare function mirrorNestedTargetDir(options: MirrorDirOptions): string;
|
|
126
|
+
declare function resolveConfiguredImport(options: ResolveImportOptions): string | null;
|
|
127
|
+
declare function calculateRelativeImport(fromFile: string, toFile: string): string;
|
|
128
|
+
|
|
104
129
|
/**
|
|
105
130
|
* 模板生成器
|
|
106
131
|
* 负责生成各种类型的代码内容,供 Generator 和 Snippets 复用
|
|
@@ -134,6 +159,19 @@ declare class TemplateGenerator {
|
|
|
134
159
|
baseClass?: string;
|
|
135
160
|
extraImports?: string[];
|
|
136
161
|
}): string;
|
|
162
|
+
static generateListViewModel(namePascal: string, modelName: string, options?: {
|
|
163
|
+
coreImportPath?: string;
|
|
164
|
+
modelImportPath?: string;
|
|
165
|
+
baseClass?: string;
|
|
166
|
+
extraImports?: string[];
|
|
167
|
+
}): string;
|
|
168
|
+
static generateListPageWithBase(namePascal: string, nameTitle: string, modelName: string, options?: {
|
|
169
|
+
vmImportPath?: string;
|
|
170
|
+
modelImportPath?: string;
|
|
171
|
+
coreImportPath?: string;
|
|
172
|
+
baseClass?: string;
|
|
173
|
+
extraImports?: string[];
|
|
174
|
+
}): string;
|
|
137
175
|
/**
|
|
138
176
|
* 生成 Service
|
|
139
177
|
*/
|
|
@@ -170,6 +208,13 @@ declare class TemplateGenerator {
|
|
|
170
208
|
* @param {string} fileName - 要添加的文件名
|
|
171
209
|
*/
|
|
172
210
|
declare function updateIndexFile(dirPath: string, fileName: string): boolean;
|
|
211
|
+
/**
|
|
212
|
+
* 为嵌套目录级联更新 index.dart
|
|
213
|
+
* 例如:
|
|
214
|
+
* - pages/test/test_page.dart -> pages/test/index.dart export 'test_page.dart'
|
|
215
|
+
* - pages/index.dart -> export 'test/index.dart'
|
|
216
|
+
*/
|
|
217
|
+
declare function updateNestedIndexExports(rootDir: string, targetDir: string, fileName: string): boolean;
|
|
173
218
|
|
|
174
219
|
declare function getTemplatesRootDir(): string;
|
|
175
220
|
declare function getCoreFilesDir(): string;
|
|
@@ -352,6 +397,7 @@ interface ProjectOptions {
|
|
|
352
397
|
packageName: string;
|
|
353
398
|
outputDir: string;
|
|
354
399
|
includeNetworkLayer?: boolean;
|
|
400
|
+
createProjectConfig?: boolean;
|
|
355
401
|
}
|
|
356
402
|
/**
|
|
357
403
|
* ProjectGenerator (V6.0)
|
|
@@ -375,21 +421,29 @@ declare class ProjectGenerator {
|
|
|
375
421
|
* 项目配置管理器
|
|
376
422
|
* 职责:读取和管理项目级别的 .flu-cli.json 配置文件
|
|
377
423
|
*/
|
|
424
|
+
type ArchitectureMode = 'inherit' | 'mixin';
|
|
425
|
+
interface ArchitectureConfig {
|
|
426
|
+
mode?: ArchitectureMode;
|
|
427
|
+
}
|
|
378
428
|
/**
|
|
379
429
|
* 生成器配置接口
|
|
380
430
|
*/
|
|
381
431
|
interface GeneratorConfig {
|
|
382
432
|
path?: string;
|
|
433
|
+
allowSubDir?: boolean;
|
|
383
434
|
defaultType?: 'stateful' | 'stateless';
|
|
384
435
|
fileSuffix?: string;
|
|
385
436
|
fileName?: string;
|
|
437
|
+
policy?: GeneratorFieldPolicy;
|
|
386
438
|
withBasePage?: boolean;
|
|
387
439
|
basePageClass?: string;
|
|
440
|
+
baseListPageClass?: string;
|
|
388
441
|
basePageImport?: string;
|
|
389
442
|
withViewModel?: boolean;
|
|
390
443
|
viewModelPath?: string;
|
|
391
444
|
withBaseViewModel?: boolean;
|
|
392
445
|
baseViewModelClass?: string;
|
|
446
|
+
baseListViewModelClass?: string;
|
|
393
447
|
baseViewModelImport?: string;
|
|
394
448
|
withBaseWidget?: boolean;
|
|
395
449
|
baseWidgetClass?: string;
|
|
@@ -400,12 +454,18 @@ interface GeneratorConfig {
|
|
|
400
454
|
template?: 'network' | 'simple' | 'auto' | string;
|
|
401
455
|
snippetKey?: string;
|
|
402
456
|
mockLevel?: 'global' | 'instance';
|
|
457
|
+
baseServiceClass?: string;
|
|
458
|
+
baseServiceImport?: string;
|
|
459
|
+
mixins?: string[];
|
|
460
|
+
mixinImports?: string[];
|
|
461
|
+
serviceConstructor?: 'const' | 'normal';
|
|
403
462
|
}
|
|
404
463
|
/**
|
|
405
464
|
* 项目配置接口
|
|
406
465
|
*/
|
|
407
466
|
interface ProjectConfig {
|
|
408
467
|
template?: 'lite' | 'modular' | 'clean' | string;
|
|
468
|
+
architecture?: ArchitectureConfig;
|
|
409
469
|
packageName?: string;
|
|
410
470
|
generators?: {
|
|
411
471
|
page?: GeneratorConfig;
|
|
@@ -419,6 +479,16 @@ interface ProjectConfig {
|
|
|
419
479
|
};
|
|
420
480
|
};
|
|
421
481
|
}
|
|
482
|
+
type ProjectConfigSource = 'disk' | 'inferred' | 'builtin';
|
|
483
|
+
type GeneratorPolicyMode = 'locked' | 'default';
|
|
484
|
+
type GeneratorFieldPolicy = Partial<Record<string, GeneratorPolicyMode>>;
|
|
485
|
+
interface ResolvedProjectConfig {
|
|
486
|
+
source: ProjectConfigSource;
|
|
487
|
+
config: ProjectConfig;
|
|
488
|
+
diagnostics: string[];
|
|
489
|
+
hasDiskConfig: boolean;
|
|
490
|
+
}
|
|
491
|
+
type GeneratorConfigType = 'page' | 'viewModel' | 'widget' | 'model' | 'component' | 'service';
|
|
422
492
|
/**
|
|
423
493
|
* 项目配置管理器
|
|
424
494
|
*/
|
|
@@ -436,20 +506,33 @@ declare class ProjectConfigManager {
|
|
|
436
506
|
* @returns 是否存在配置文件
|
|
437
507
|
*/
|
|
438
508
|
static hasConfig(projectDir: string): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* 解析运行时生效配置。
|
|
511
|
+
* 即使项目没有真实 .flu-cli.json,也会基于目录结构和内置默认值得到一份权威配置。
|
|
512
|
+
*/
|
|
513
|
+
static resolveEffectiveConfig(projectDir: string): ResolvedProjectConfig;
|
|
439
514
|
/**
|
|
440
515
|
* 获取指定生成器的配置
|
|
441
516
|
* @param projectDir 项目目录
|
|
442
517
|
* @param generatorType 生成器类型
|
|
443
518
|
* @returns 生成器配置,如果不存在则返回 null
|
|
444
519
|
*/
|
|
445
|
-
static getGeneratorConfig(projectDir: string, generatorType:
|
|
520
|
+
static getGeneratorConfig(projectDir: string, generatorType: GeneratorConfigType): GeneratorConfig | null;
|
|
521
|
+
/**
|
|
522
|
+
* 仅根据目录结构推断模板类型。
|
|
523
|
+
*/
|
|
524
|
+
static inferTemplateFromStructure(projectDir: string): 'lite' | 'modular' | 'clean' | null;
|
|
446
525
|
/**
|
|
447
526
|
* 获取默认配置模板
|
|
448
527
|
* @param templateType 模板类型
|
|
449
528
|
* @returns 配置模板对象
|
|
450
529
|
*/
|
|
451
530
|
static getDefaultConfigTemplate(templateType: 'lite' | 'modular' | 'clean' | 'custom' | string): ProjectConfig;
|
|
531
|
+
private static readPackageName;
|
|
452
532
|
}
|
|
533
|
+
declare function getArchitectureMode(config?: ProjectConfig | null): ArchitectureMode;
|
|
534
|
+
declare function getGeneratorFieldPolicy(config: ProjectConfig | null | undefined, generatorType: GeneratorConfigType, field: string): GeneratorPolicyMode | null;
|
|
535
|
+
declare function isGeneratorFieldLocked(config: ProjectConfig | null | undefined, generatorType: GeneratorConfigType, field: string): boolean;
|
|
453
536
|
|
|
454
537
|
/**
|
|
455
538
|
* 应用资源选择接口
|
|
@@ -619,7 +702,7 @@ declare function checkFlutterInstalled(): Promise<boolean>;
|
|
|
619
702
|
*/
|
|
620
703
|
declare function getFlutterVersion(): Promise<string | null>;
|
|
621
704
|
|
|
622
|
-
type BuildPlatform = 'android' | 'ios';
|
|
705
|
+
type BuildPlatform = 'android' | 'ios' | 'harmony';
|
|
623
706
|
declare class BuildManager {
|
|
624
707
|
static build(platform: BuildPlatform, buildConfig: NonNullable<UploadConfig['build']>, projectDir?: string): Promise<BuildResult>;
|
|
625
708
|
}
|
|
@@ -666,12 +749,6 @@ declare class AndroidBuilder {
|
|
|
666
749
|
* @param projectDir 项目目录
|
|
667
750
|
*/
|
|
668
751
|
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
752
|
private static findArtifact;
|
|
676
753
|
}
|
|
677
754
|
|
|
@@ -702,4 +779,4 @@ declare function fixAndroidPackageName(projectDir: string, packageName: string,
|
|
|
702
779
|
*/
|
|
703
780
|
declare function fixIosBundleIdentifier(projectDir: string, bundleId: string, logger?: Logger): Promise<void>;
|
|
704
781
|
|
|
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 };
|
|
782
|
+
export { AndroidBuilder, type AppAssetConfig, AppAssetsManager, type ArchitectureConfig, type ArchitectureMode, BUILTIN_TEMPLATES, BuildManager, ConfigManager, ConsoleLogger, type CustomTemplate, type FluConfig, type GeneratorConfig, type GeneratorConfigType, type GeneratorFieldPolicy, type GeneratorPolicyMode, type GeneratorType, I18nManager, IOSBuilder, type Logger, type ProjectConfig, ProjectConfigManager, type ProjectConfigSource, ProjectContextService, ProjectGenerator, type ProjectOptions, type ProjectPreset, type ProjectTemplate, type ResolvedProjectConfig, TemplateGenerator, TemplateManager, TemplatePresetService, type TemplateType, calculateRelativeImport, checkFlutterInstalled, checkSnippetsVersion, cleanupTemplateFiles, copyCoreFiles, copyCustomTemplate, copyInfrastructure, copyNetworkFiles, copyTemplate, detectProjectTemplate, ensurePubspecName, fixAndroidPackageName, fixIosBundleIdentifier, generateComponent, generateIndexFile, generateModel, generateModule, generatePage, generateService, generateViewModel, generateWidget, getArchitectureMode, getCoreFilesDir, getFlutterVersion, getGeneratorFieldPolicy, getModelPath, getNetworkDir, getPagePath, getRelativeImportPath, getServicePath, getSnippetContent, getStateManager, getTemplatesRootDir, getViewModelPath, getWidgetPath, injectNetworkExamples, isCustomTemplateProject, isGeneratorFieldLocked, loadProjectSnippets, logger, mirrorNestedTargetDir, removeTemplateSuffix, renderSnippet, replaceVariables, resolveConfiguredImport, resolveGeneratorBaseDir, resolveGeneratorTargetDir, runFlutterCreate, runFlutterPubGet, t, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toTitleCase, updateIndexFile, updateNestedIndexExports, upgradeSnippets };
|