Skip to content

Commit a1f82fc

Browse files
committed
Format export manifest CLI changes
1 parent bc50066 commit a1f82fc

File tree

2 files changed

+101
-109
lines changed

2 files changed

+101
-109
lines changed

bin/flutterflow_cli.dart

Lines changed: 82 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ Future<void> appMain(List<String> args) async {
1212
final token =
1313
parsedArguments['token'] ?? Platform.environment['FLUTTERFLOW_API_TOKEN'];
1414

15-
final project =
16-
parsedArguments.command!['project'] ??
15+
final project = parsedArguments.command!['project'] ??
1716
Platform.environment['FLUTTERFLOW_PROJECT'];
1817

1918
if (project == null || project.isEmpty) {
@@ -93,96 +92,89 @@ Future<void> appMain(List<String> args) async {
9392
}
9493

9594
ArgResults _parseArgs(List<String> args) {
96-
final exportCodeCommandParser =
97-
ArgParser()
98-
..addOption('project', abbr: 'p', help: 'Project id')
99-
..addOption(
100-
'dest',
101-
abbr: 'd',
102-
help: 'Destination directory',
103-
defaultsTo: '.',
104-
)
105-
..addOption(
106-
'branch-name',
107-
abbr: 'b',
108-
help: '(Optional) Specify a branch name',
109-
)
110-
..addOption(
111-
'commit-hash',
112-
abbr: 'c',
113-
help: '(Optional) Specify a commit hash',
114-
)
115-
..addFlag(
116-
'include-assets',
117-
negatable: true,
118-
help:
119-
'Include assets. By default, assets are not included.\n'
120-
'We recommend setting this flag only when calling this command '
121-
'for the first time or after updating assets.\n'
122-
'Downloading code without assets is typically much faster.',
123-
defaultsTo: false,
124-
)
125-
..addFlag(
126-
'include-export-manifest',
127-
negatable: true,
128-
help:
129-
'Request .flutterflow/export_manifest.json in the downloaded '
130-
'export so tools can map FlutterFlow entities to generated files.',
131-
defaultsTo: false,
132-
)
133-
..addFlag(
134-
'fix',
135-
negatable: true,
136-
help: 'Run "dart fix" on the downloaded code.',
137-
defaultsTo: false,
138-
)
139-
..addFlag(
140-
'parent-folder',
141-
negatable: true,
142-
help:
143-
'Download into a sub-folder. By default, project is downloaded \n'
144-
'into a folder named <project>.\nSetting this flag to false will '
145-
'download all project code directly into the specified directory, '
146-
'or the current directory if --dest is not set.',
147-
defaultsTo: true,
148-
)
149-
..addFlag(
150-
'as-module',
151-
negatable: true,
152-
help: 'Generate the project as a Flutter module.',
153-
defaultsTo: false,
154-
)
155-
..addFlag(
156-
'as-debug',
157-
negatable: true,
158-
help:
159-
'Generate the project with debug logging to be able to use '
160-
'FlutterFlow Debug Panel inside the DevTools.',
161-
defaultsTo: false,
162-
)
163-
..addOption(
164-
'project-environment',
165-
help: '(Optional) Specify a project environment name.',
166-
);
95+
final exportCodeCommandParser = ArgParser()
96+
..addOption('project', abbr: 'p', help: 'Project id')
97+
..addOption(
98+
'dest',
99+
abbr: 'd',
100+
help: 'Destination directory',
101+
defaultsTo: '.',
102+
)
103+
..addOption(
104+
'branch-name',
105+
abbr: 'b',
106+
help: '(Optional) Specify a branch name',
107+
)
108+
..addOption(
109+
'commit-hash',
110+
abbr: 'c',
111+
help: '(Optional) Specify a commit hash',
112+
)
113+
..addFlag(
114+
'include-assets',
115+
negatable: true,
116+
help: 'Include assets. By default, assets are not included.\n'
117+
'We recommend setting this flag only when calling this command '
118+
'for the first time or after updating assets.\n'
119+
'Downloading code without assets is typically much faster.',
120+
defaultsTo: false,
121+
)
122+
..addFlag(
123+
'include-export-manifest',
124+
negatable: true,
125+
help: 'Request .flutterflow/export_manifest.json in the downloaded '
126+
'export so tools can map FlutterFlow entities to generated files.',
127+
defaultsTo: false,
128+
)
129+
..addFlag(
130+
'fix',
131+
negatable: true,
132+
help: 'Run "dart fix" on the downloaded code.',
133+
defaultsTo: false,
134+
)
135+
..addFlag(
136+
'parent-folder',
137+
negatable: true,
138+
help: 'Download into a sub-folder. By default, project is downloaded \n'
139+
'into a folder named <project>.\nSetting this flag to false will '
140+
'download all project code directly into the specified directory, '
141+
'or the current directory if --dest is not set.',
142+
defaultsTo: true,
143+
)
144+
..addFlag(
145+
'as-module',
146+
negatable: true,
147+
help: 'Generate the project as a Flutter module.',
148+
defaultsTo: false,
149+
)
150+
..addFlag(
151+
'as-debug',
152+
negatable: true,
153+
help: 'Generate the project with debug logging to be able to use '
154+
'FlutterFlow Debug Panel inside the DevTools.',
155+
defaultsTo: false,
156+
)
157+
..addOption(
158+
'project-environment',
159+
help: '(Optional) Specify a project environment name.',
160+
);
167161

168-
final firebaseDeployCommandParser =
169-
ArgParser()
170-
..addOption('project', abbr: 'p', help: 'Project id')
171-
..addFlag(
172-
'append-rules',
173-
abbr: 'a',
174-
help: 'Append to rules, instead of overwriting them.',
175-
defaultsTo: false,
176-
);
162+
final firebaseDeployCommandParser = ArgParser()
163+
..addOption('project', abbr: 'p', help: 'Project id')
164+
..addFlag(
165+
'append-rules',
166+
abbr: 'a',
167+
help: 'Append to rules, instead of overwriting them.',
168+
defaultsTo: false,
169+
);
177170

178-
final parser =
179-
ArgParser()
180-
..addOption('endpoint', abbr: 'e', help: 'Endpoint', hide: true)
181-
..addOption('environment', help: 'Environment', hide: true)
182-
..addOption('token', abbr: 't', help: 'API Token')
183-
..addFlag('help', negatable: false, abbr: 'h', help: 'Help')
184-
..addCommand('export-code', exportCodeCommandParser)
185-
..addCommand('deploy-firebase', firebaseDeployCommandParser);
171+
final parser = ArgParser()
172+
..addOption('endpoint', abbr: 'e', help: 'Endpoint', hide: true)
173+
..addOption('environment', help: 'Environment', hide: true)
174+
..addOption('token', abbr: 't', help: 'API Token')
175+
..addFlag('help', negatable: false, abbr: 'h', help: 'Help')
176+
..addCommand('export-code', exportCodeCommandParser)
177+
..addCommand('deploy-firebase', firebaseDeployCommandParser);
186178

187179
late ArgResults parsed;
188180
try {

lib/src/flutterflow_api_client.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,22 @@ class FlutterFlowApi {
4949
bool format = true,
5050
bool exportAsDebug = false,
5151
bool includeExportManifest = false,
52-
}) => exportCode(
53-
token: token,
54-
endpoint: endpoint,
55-
projectId: projectId,
56-
destinationPath: destinationPath,
57-
includeAssets: includeAssets,
58-
branchName: branchName,
59-
commitHash: commitHash,
60-
unzipToParentFolder: unzipToParentFolder,
61-
fix: fix,
62-
exportAsModule: exportAsModule,
63-
format: format,
64-
exportAsDebug: exportAsDebug,
65-
includeExportManifest: includeExportManifest,
66-
);
52+
}) =>
53+
exportCode(
54+
token: token,
55+
endpoint: endpoint,
56+
projectId: projectId,
57+
destinationPath: destinationPath,
58+
includeAssets: includeAssets,
59+
branchName: branchName,
60+
commitHash: commitHash,
61+
unzipToParentFolder: unzipToParentFolder,
62+
fix: fix,
63+
exportAsModule: exportAsModule,
64+
format: format,
65+
exportAsDebug: exportAsDebug,
66+
includeExportManifest: includeExportManifest,
67+
);
6768
}
6869

6970
Future<String?> exportCode({
@@ -305,10 +306,9 @@ Future _runFix({
305306
final firstFilePath = projectFolder.files.first.name;
306307
final directory = path_util.split(firstFilePath).first;
307308

308-
final workingDirectory =
309-
unzipToParentFolder
310-
? path_util.join(destinationPath, directory)
311-
: destinationPath;
309+
final workingDirectory = unzipToParentFolder
310+
? path_util.join(destinationPath, directory)
311+
: destinationPath;
312312
stderr.write('Running flutter pub get...\n');
313313
final pubGetResult = await Process.run(
314314
'flutter',

0 commit comments

Comments
 (0)