Skip to content

Commit 981d464

Browse files
authored
Merge branch 'main' into chore/site-github-folder
2 parents 5731ce0 + 41fd19d commit 981d464

10 files changed

Lines changed: 1518 additions & 1322 deletions

File tree

.github/workflows/site.yaml

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: ⚙️ Setup Node
2828
uses: actions/setup-node@v5
2929
with:
30-
node-version: 18.x
30+
node-version: 20.x
3131
cache: npm
3232
cache-dependency-path: site/package-lock.json
3333

@@ -42,45 +42,3 @@ jobs:
4242

4343
- name: 👷 Build website
4444
run: npm run build
45-
46-
deploy:
47-
needs: build
48-
49-
runs-on: ubuntu-latest
50-
51-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
52-
53-
defaults:
54-
run:
55-
working-directory: site
56-
57-
steps:
58-
- name: 📚 Git Checkout
59-
uses: actions/checkout@v5
60-
61-
- name: ⚙️ Setup Node
62-
uses: actions/setup-node@v5
63-
with:
64-
node-version: 18.x
65-
cache: npm
66-
cache-dependency-path: site/package-lock.json
67-
68-
- name: 📦 Install Dependencies
69-
run: npm ci
70-
71-
- name: ✨ Check Format
72-
run: npm run format:check
73-
74-
- name: 🧹 Lint
75-
run: npm run lint
76-
77-
- name: 👷 Build website
78-
run: npm run build
79-
80-
- name: ☁️ Deploy to GitHub Pages
81-
uses: peaceiris/actions-gh-pages@v4
82-
with:
83-
github_token: ${{ secrets.GITHUB_TOKEN }}
84-
publish_dir: ./site/build
85-
user_name: github-actions[bot]
86-
user_email: 41898282+github-actions[bot]@users.noreply.github.com

.github/workflows/site_deploy.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: site_deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
working-directory: site
16+
17+
steps:
18+
- name: 📚 Git Checkout
19+
uses: actions/checkout@v5
20+
21+
- name: ⚙️ Setup Node
22+
uses: actions/setup-node@v5
23+
with:
24+
node-version: 18.x
25+
cache: npm
26+
cache-dependency-path: site/package-lock.json
27+
28+
- name: 📦 Install Dependencies
29+
run: npm ci
30+
31+
- name: ✨ Check Format
32+
run: npm run format:check
33+
34+
- name: 🧹 Lint
35+
run: npm run lint
36+
37+
- name: 👷 Build website
38+
run: npm run build
39+
40+
- name: ☁️ Deploy to GitHub Pages
41+
uses: peaceiris/actions-gh-pages@v4
42+
with:
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
publish_dir: ./site/build
45+
user_name: github-actions[bot]
46+
user_email: 41898282+github-actions[bot]@users.noreply.github.com

e2e/test/commands/create/flame_game/flame_game_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void main() {
5151
['coverage/lcov.info', '-o', 'coverage'],
5252
workingDirectory: workingDirectory,
5353
);
54-
expect(testCoverageResult.stdout, contains('lines......: 97.8%'));
54+
expect(testCoverageResult.stdout, matches(RegExp('lines(.+) 100.0%')));
5555
}),
5656
);
5757
}

lib/src/commands/create/commands/flame_game.dart

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ class CreateFlameGame extends CreateSubCommand with OrgName {
1010
required super.logger,
1111
required super.generatorFromBundle,
1212
required super.generatorFromBrick,
13-
});
13+
}) {
14+
argParser.addMultiOption(
15+
'platforms',
16+
help:
17+
'The platforms supported by the game. By default, all platforms '
18+
'are enabled. Example: --platforms=android,ios',
19+
defaultsTo: ['android', 'ios', 'web', 'macos', 'windows'],
20+
allowed: ['android', 'ios', 'web', 'macos', 'windows'],
21+
allowedHelp: {
22+
'android': 'The game supports the Android platform.',
23+
'ios': 'The game supports the iOS platform.',
24+
'web': 'The game supports the Web platform.',
25+
'macos': 'The game supports the macOS platform.',
26+
'windows': 'The game supports the Windows platform.',
27+
},
28+
);
29+
}
1430

1531
@override
1632
String get name => 'flame_game';
@@ -20,4 +36,15 @@ class CreateFlameGame extends CreateSubCommand with OrgName {
2036

2137
@override
2238
Template get template => VeryGoodFlameGameTemplate();
39+
40+
@override
41+
Map<String, dynamic> getTemplateVars() {
42+
final vars = super.getTemplateVars();
43+
44+
final platforms = argResults['platforms'] as List<String>;
45+
46+
vars['platforms'] = platforms;
47+
48+
return vars;
49+
}
2350
}

lib/src/commands/create/templates/very_good_core/very_good_core_bundle.dart

Lines changed: 17 additions & 449 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/commands/create/templates/very_good_docs_site/very_good_docs_site_bundle.dart

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/docs/templates/flame_game.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Read more about this game template [in our blog][blog].
2424

2525
- **100% Test Coverage** — Each line is executed at least once by a test.
2626

27+
## Providing supported platforms
28+
29+
If you want your game to support only some platforms, pass the `platforms` option with a comma-separated list of the platforms you want to support.
30+
31+
If `platforms` is omitted, all platforms are enabled by default.
32+
33+
The values for platforms are: `android`, `ios`, `web`, `macos`, and `windows`.
34+
2735
## Usage
2836

2937
```sh
@@ -32,6 +40,9 @@ very_good create flame_game my_game --desc "My new Flame game"
3240

3341
# Create a new Flame game named with the name of the current directory
3442
very_good create flame_game . --desc "My new Flame game"
43+
44+
# Create a new Flutter plugin named my_flutter_plugin (supports only android and iOS)
45+
very_good create flame_game my_game --platforms android,ios
3546
```
3647

3748
[blog]: https://verygood.ventures/blog/generate-a-game-with-our-new-template

0 commit comments

Comments
 (0)