Skip to content

Commit 8d53311

Browse files
author
Thomas Roovers
committed
Added web-renderer flag and updated run command
1 parent 340836c commit 8d53311

7 files changed

Lines changed: 131 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# CHANGELOG
22

3+
## v1.8.2
4+
5+
### New features
6+
- Add web-renderer flag: auto, canvaskit or html
7+
8+
9+
### Breaking changes
10+
The `run` command has been updated. Previously:
11+
12+
```shell
13+
flttr run --platform ios --flavor accept
14+
flttr run --platform android --flavor accept
15+
flttr run --platform web --flavor accept
16+
```
17+
18+
Currently:
19+
20+
```shell
21+
flttr run ios --flavor accept
22+
flttr run android --flavor accept
23+
flttr run web --flavor accept
24+
```
25+
326
## v1.8.1
427

528
### New features
@@ -24,7 +47,6 @@
2447
## v1.7.0
2548

2649
### Breaking changes
27-
2850
Updated build commands, see README.md for new format and argument descriptions.
2951

3052
**Previously:**
@@ -35,6 +57,6 @@ flttr build --platform android [--flavor=] [--artifact=] [--release] [--[no-]obf
3557

3658
**New:**
3759
```
38-
flttr build ios [--flavor=] [--release] [--archive] [--export-method=] [--[no-]obfuscation] [--[no-]codesign] [--prepare]
39-
flttr build android [--flavor=] [--release] [--artifact=] [--[no-]obfuscation] [--prepare]
60+
flttr build ios [--flavor=] [--release] [--archive] [--export-method=] [--[no-]obfuscation] [--[no-]codesign] [--dry-run]
61+
flttr build android [--flavor=] [--release] [--artifact=] [--[no-]obfuscation] [--dry-run]
4062
```

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
flttr (1.7.1)
4+
flttr (1.8.1)
55
dotenv (~> 2.8.1)
66
gli (~> 2.21.0)
77
jwt (~> 2.7.0)

bin/flttr

Lines changed: 76 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,78 @@ class App
8686

8787
desc 'Run on a device or simulator'
8888
command :run do |c|
89-
c.flag [:p,:platform],
90-
:desc => 'Specify platform, android or ios',
91-
:must_match => ["android", "ios", "web"]
89+
c.command :android do |sc|
90+
sc.flag [:f,:flavor],
91+
:desc => 'Specify flavor'
92+
93+
sc.switch [:r,:release],
94+
:desc => 'Run in release mode, debug by default'
95+
96+
sc.switch [:profile],
97+
:desc => 'Run in profile mode, debug by default'
98+
99+
sc.switch ['dry-run'],
100+
:desc => 'Prepare only for running the app (writing config files)'
101+
102+
sc.flag [:d, :device],
103+
:desc => 'Specify a device ID to target'
92104

93-
c.flag [:f,:flavor],
94-
:desc => 'Specify flavor'
105+
sc.action do |global_options,options,args|
106+
mergedOptions = global_options.merge(**options, **options[GLI::Command::PARENT], **{'platform': 'android'})
107+
mergedOptions.delete(GLI::Command::PARENT)
108+
Commands::Run.new(mergedOptions).execute
109+
end
110+
end
111+
112+
c.command :ios do |sc|
113+
sc.flag [:f,:flavor],
114+
:desc => 'Specify flavor'
115+
116+
sc.switch [:r,:release],
117+
:desc => 'Run in release mode, debug by default'
95118

96-
c.switch [:r,:release],
97-
:desc => 'Run in release mode, debug by default'
98-
99-
c.switch [:profile],
100-
:desc => 'Run in profile mode, debug by default'
101-
102-
c.switch [:prepare],
103-
:desc => 'Prepare only for running the app (writing config files)'
104-
105-
c.flag [:d, :device],
106-
:desc => 'Specify a device ID to target'
119+
sc.switch [:profile],
120+
:desc => 'Run in profile mode, debug by default'
121+
122+
sc.switch ['dry-run'],
123+
:desc => 'Prepare only for running the app (writing config files)'
107124

108-
c.flag [:port],
109-
:desc => 'Specify the port to use: https://localhost:<port>'
125+
sc.flag [:d, :device],
126+
:desc => 'Specify a device ID to target'
110127

111-
c.action do |global_options,options,args|
112-
Commands::Run.new(global_options.merge(options)).execute
128+
sc.action do |global_options,options,args|
129+
mergedOptions = global_options.merge(**options, **options[GLI::Command::PARENT], **{'platform': 'ios'})
130+
mergedOptions.delete(GLI::Command::PARENT)
131+
Commands::Run.new(mergedOptions).execute
132+
end
133+
end
134+
135+
c.command :web do |sc|
136+
sc.flag [:f,:flavor],
137+
:desc => 'Specify flavor'
138+
139+
sc.switch [:r,:release],
140+
:desc => 'Run in release mode, debug by default'
141+
142+
sc.switch ['dry-run'],
143+
:desc => 'Prepare only for running the app (writing config files)'
144+
145+
sc.flag [:d, :device],
146+
:desc => 'Specify a device ID to target'
147+
148+
sc.flag [:port],
149+
:desc => 'Specify the port to use: https://localhost:<port>'
150+
151+
sc.flag ['web-renderer'],
152+
:desc => 'Specify the renderer',
153+
:must_match => ['canvaskit', 'html', 'auto'],
154+
:default_value => 'auto'
155+
156+
sc.action do |global_options,options,args|
157+
mergedOptions = global_options.merge(**options, **options[GLI::Command::PARENT], **{'platform': 'web'})
158+
mergedOptions.delete(GLI::Command::PARENT)
159+
Commands::Run.new(mergedOptions).execute
160+
end
113161
end
114162
end
115163

@@ -122,7 +170,7 @@ class App
122170
sc.flag [:f,:flavor],
123171
:desc => 'Specify flavor'
124172

125-
sc.switch [:prepare],
173+
sc.switch ['dry-run'],
126174
:desc => 'Prepare only for running the app (writing config files)',
127175
:negatable => false
128176

@@ -148,7 +196,7 @@ class App
148196
sc.flag [:f,:flavor],
149197
:desc => 'Specify flavor'
150198

151-
sc.switch [:prepare],
199+
sc.switch ['dry-run'],
152200
:desc => 'Prepare only for running the app (writing config files)',
153201
:negatable => false
154202

@@ -179,10 +227,15 @@ class App
179227
sc.flag [:f,:flavor],
180228
:desc => 'Specify flavor'
181229

182-
sc.switch [:prepare],
230+
sc.switch ['dry-run'],
183231
:desc => 'Prepare only for running the app (writing config files)',
184232
:negatable => false
185233

234+
sc.flag ['web-renderer'],
235+
:desc => 'Specify the renderer',
236+
:must_match => ['canvaskit', 'html', 'auto'],
237+
:default_value => 'auto'
238+
186239
sc.action do |global_options,options,args|
187240
mergedOptions = global_options.merge(**options, **options[GLI::Command::PARENT], **{'platform': 'web'})
188241
mergedOptions.delete(GLI::Command::PARENT)

latest_release.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "1.8.1",
3-
"download_url": "https://github.com/UnlockAgency/flutter-cli/releases/download/v1.8.1/flttr-1.8.1.gem",
4-
"url": "https://github.com/UnlockAgency/flutter-cli/releases/tag/v1.8.1"
2+
"name": "1.8.2",
3+
"download_url": "https://github.com/UnlockAgency/flutter-cli/releases/download/v1.8.2/flttr-1.8.2.gem",
4+
"url": "https://github.com/UnlockAgency/flutter-cli/releases/tag/v1.8.2"
55
}

lib/commands/build.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ def initialize(args)
1313
@@exportMethod = args['export-method']
1414

1515
@@obfuscation = args['obfuscation'] == true
16-
@@prepare = args['prepare'] == true
16+
@@prepare = args['dry-run'] == true
17+
18+
# Web
19+
@@renderer = args['web-renderer']
1720
end
1821

1922
def execute
@@ -28,7 +31,7 @@ def execute
2831
end
2932

3033
if @@prepare
31-
puts colored :blue, "\n#{CHAR_FLAG} Skipping actual build in prepare mode"
34+
puts colored :blue, "\n#{CHAR_FLAG} Skipping actual build in dry-run mode"
3235
puts colored :default, "#{command}\n\n"
3336
return
3437
end
@@ -68,7 +71,13 @@ def build_ios
6871
end
6972

7073
def build_web
71-
return "flutter build web --target=lib/main.dart --dart-define-from-file=config/.build.json"
74+
command = "flutter build web --target=lib/main.dart --dart-define-from-file=config/.build.json"
75+
76+
unless @@renderer.nil?
77+
command += " --web-renderer #{@@renderer}"
78+
end
79+
80+
return command
7281
end
7382

7483
def generate_ios_export_options

lib/commands/run.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ def initialize(args)
77
@profile = args[:profile]
88
@device = args[:device]
99

10+
@@prepare = args['dry-run'] == true
11+
1012
# Web
1113
@@port = args[:port]
14+
@@renderer = args['web-renderer']
1215
end
1316

1417
def execute
@@ -35,6 +38,16 @@ def execute
3538
command += " --web-port #{@@port}"
3639
end
3740

41+
unless @@renderer.nil?
42+
command += " --web-renderer #{@@renderer}"
43+
end
44+
45+
if @@prepare
46+
puts colored :blue, "\n#{CHAR_FLAG} Skipping actual run in dry-run mode"
47+
puts colored :default, "#{command}\n\n"
48+
return
49+
end
50+
3851
puts colored :blue, "\n#{CHAR_FLAG} Running app in flavor: #{@flavor}"
3952
puts colored :default, "#{command}\n\n"
4053

lib/flttr/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Flttr
2-
VERSION = '1.8.1'
2+
VERSION = '1.8.2'
33
end

0 commit comments

Comments
 (0)