Skip to content

Commit e3e0282

Browse files
committed
add the as-module option
1 parent bb83b5e commit e3e0282

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.12
2+
3+
- Add `--as-module` option.
4+
15
## 0.0.11
26

37
- Fix `--fix` `--no-parent-folder` edge case.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ API access is available only to users with active subscriptions. Visit https://a
1212

1313
## Usage
1414

15-
`flutterflow export-code --project <project id> --dest <output folder> --[no-]include-assets --token <token> --[no-]fix --[no]-parent-folder`
15+
`flutterflow export-code --project <project id> --dest <output folder> --[no-]include-assets --token <token> --[no-]fix --[no]-parent-folder --as-module`
1616

1717
* Instead of passing `--token` you can set `FLUTTERFLOW_API_TOKEN` environment variable.
1818
* Instead of passing `--project` you can set `FLUTTERFLOW_PROJECT` environment variable.
@@ -28,6 +28,7 @@ API access is available only to users with active subscriptions. Visit https://a
2828
| `--branch-name` | `-b` | [Optional] Which branch to download. Defaults to `main`. |
2929
| `--[no-]fix` | None | [Optional] Whether to run `dart fix` on the downloaded code. Defaults to `false`. |
3030
| `--[no-]parent-folder` | None | [Optional] Whether to download code into a project-named sub-folder. If true, downloads all project files directly to the specified directory. Defaults to `true`. |
31+
| `--as-module` | None | [Optional] Whether to generate the project as a Flutter module |
3132

3233
## Issues
3334

bin/flutterflow_cli.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void main(List<String> args) async {
4646
branchName: parsedArguments.command!['branch-name'],
4747
unzipToParentFolder: parsedArguments.command!['parent-folder'],
4848
fix: parsedArguments.command!['fix'],
49+
exportAsModule: parsedArguments.command!['as-module'],
4950
);
5051
}
5152

@@ -79,6 +80,10 @@ ArgResults _parseArgs(List<String> args) {
7980
'download all project code directly into the specified directory, '
8081
'or the current directory if --dest is not set.',
8182
defaultsTo: true,
83+
)
84+
..addFlag(
85+
'as-module',
86+
help: 'Generate the project as a Flutter module.',
8287
);
8388

8489
final parser = ArgParser()

lib/src/flutterflow_cli_base.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class FlutterFlowApi {
3434
String? branchName,
3535
bool unzipToParentFolder = false,
3636
bool fix = false,
37+
bool exportAsModule = false,
3738
}) =>
3839
exportCode(
3940
token: token,
@@ -44,6 +45,7 @@ class FlutterFlowApi {
4445
branchName: branchName,
4546
unzipToParentFolder: unzipToParentFolder,
4647
fix: fix,
48+
exportAsModule: exportAsModule,
4749
);
4850
}
4951

@@ -55,6 +57,7 @@ Future<String?> exportCode({
5557
required bool includeAssets,
5658
required bool unzipToParentFolder,
5759
required bool fix,
60+
required exportAsModule,
5861
String? branchName,
5962
}) async {
6063
final endpointUrl = Uri.parse(endpoint);
@@ -67,6 +70,7 @@ Future<String?> exportCode({
6770
endpoint: endpointUrl,
6871
projectId: projectId,
6972
branchName: branchName,
73+
exportAsModule: exportAsModule,
7074
);
7175
// Download actual code
7276
final projectZipBytes = base64Decode(result['project_zip']);
@@ -136,13 +140,15 @@ Future<dynamic> _callExport({
136140
required Uri endpoint,
137141
required String projectId,
138142
String? branchName,
143+
required bool exportAsModule,
139144
}) async {
140145
final body = jsonEncode({
141146
'project': {
142147
'path': 'projects/$projectId',
143148
},
144149
'token': token,
145150
if (branchName != null) 'branch_name': branchName,
151+
'export_as_module': exportAsModule,
146152
});
147153
final response = await client.post(
148154
Uri.https(endpoint.host, '${endpoint.path}/exportCode'),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutterflow_cli
22
description: >-
33
Command-line client for FlutterFlow. Export code from FlutterFlow projects.
4-
version: 0.0.11
4+
version: 0.0.12
55
homepage: https://github.com/FlutterFlow/flutterflow-cli
66
issue_tracker: https://github.com/flutterflow/flutterflow-issues
77

0 commit comments

Comments
 (0)