Skip to content

Commit

Permalink
chore: Update project code styles (#353)
Browse files Browse the repository at this point in the history
* chore: use .tool-versions

* chore: refactoring melos.yaml

* chore: update dependencies for example

* chore: add prettier

* chore: add lint-staged

* chore: add autoassign

* chore: add CODEOWNER

* docs: update how to use melos

* chore: enabled flutter cache
  • Loading branch information
wasabeef authored Feb 7, 2023
1 parent 98d8617 commit 162d4b1
Show file tree
Hide file tree
Showing 63 changed files with 12,830 additions and 648 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @wasabeef
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug Report
description: File a bug report
title: "[BUG]: "
labels: ["bug"]
title: '[BUG]: '
labels: ['bug']
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -39,7 +39,7 @@ body:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
value: 'A bug happened!'
validations:
required: true
- type: textarea
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Feature Request
description: File a feature request
title: "[FR]: "
labels: ["enhancement"]
title: '[FR]: '
labels: ['enhancement']
body:
- type: markdown
attributes:
Expand Down
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Please delete options that are not relevant.
## Checklist:

Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

- [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests (`melos run unit:test`)
- [ ] Ensure the analyzer and formatter pass (`melos run format` to automatically apply formatting)
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/autoassign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Auto self assign

on:
pull_request:
types: [opened, synchronize]

jobs:
assign:
if: |
github.event.pull_request.user.type == 'User'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
const assignees = context.payload.pull_request.assignees
if (!assignees || assignees.length === 0) {
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: `${{ github.actor }}`,
})
}
20 changes: 12 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, synchronize]
push:
branches:
- "main"
- 'main'

jobs:
build:
Expand All @@ -16,12 +16,16 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: wasabeef/[email protected]
id: asdf
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.asdf.outputs.flutter }}
channel: stable
cache: true
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
sdk: ${{ steps.asdf.outputs.dart }}

- name: Set environment
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
Expand All @@ -48,12 +52,12 @@ jobs:
- name: Run tests for our dart project.
if: startsWith(matrix.os, 'ubuntu')
run: |
melos run test
melos test
- name: Run coverage
if: startsWith(matrix.os, 'ubuntu')
run: |
melos run coverage
melos coverage
- uses: codecov/codecov-action@v3
with:
Expand All @@ -62,10 +66,10 @@ jobs:

- name: Generate example
run: |
melos run example:command
melos run example:build_runner
melos gen:example:command
melos gen:example:build_runner
- name: Check for any formatting and statically analyze the code.
run: |
melos run format
melos run analyze
melos format
melos analyze
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- "v*.*.*"
- 'v*.*.*'

jobs:
build:
Expand All @@ -23,12 +23,16 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: wasabeef/[email protected]
id: asdf
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.asdf.outputs.flutter }}
channel: stable
cache: true
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
sdk: ${{ steps.asdf.outputs.dart }}

- name: Set environment
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged --allow-empty
4 changes: 0 additions & 4 deletions .husky/pre-push

This file was deleted.

1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19.4.0
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.dart_tool/
build/
packages/**/android/
packages/**/ios/
packages/**/linux/
packages/**/macos/
packages/**/web/
packages/**/windows/
examples/**/android/
examples/**/ios/
examples/**/linux/
examples/**/macos/
examples/**/web/
examples/**/windows/
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 16.18.1

dart 2.19.1
flutter 3.7.1-stable
54 changes: 26 additions & 28 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run example on main.dart",
"program": "${workspaceFolder}/examples/example/lib/main.dart",
"request": "launch",
"type": "dart",
"flutterMode": "debug",
"cwd": "examples/example/"
},
{
"name": "Run on build_runner",
"program": "${workspaceFolder}/examples/example/.dart_tool/build/entrypoint/build.dart",
"request": "launch",
"type": "dart",
"args": [
"build"
],
"cwd": "examples/example/"
},
{
"name": "Run on flutter_gen_command",
"program": "${workspaceFolder}/packages/command/bin/flutter_gen_command.dart",
"request": "launch",
"type": "dart",
"cwd": "examples/example/"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run example on main.dart",
"program": "${workspaceFolder}/examples/example/lib/main.dart",
"request": "launch",
"type": "dart",
"flutterMode": "debug",
"cwd": "examples/example/"
},
{
"name": "Run on build_runner",
"program": "${workspaceFolder}/examples/example/.dart_tool/build/entrypoint/build.dart",
"request": "launch",
"type": "dart",
"args": ["build"],
"cwd": "examples/example/"
},
{
"name": "Run on flutter_gen_command",
"program": "${workspaceFolder}/packages/command/bin/flutter_gen_command.dart",
"request": "launch",
"type": "dart",
"cwd": "examples/example/"
}
]
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"dart.flutterSdkPath": "~/.asdf/installs/flutter/3.0.5-stable",
"dart.sdkPath": "~/.asdf/installs/dart/2.17.6/dart-sdk"
"dart.flutterSdkPath": "~/.asdf/installs/flutter/3.7.1-stable",
"dart.sdkPath": "~/.asdf/installs/dart/2.19.1/dart-sdk"
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 5.2.0

**Feature**
- [#350](https://github.com/FlutterGen/flutter_gen/pull/350) Support flutter_svg 2.0.0.

## 5.1.0, 5.1.0+1

**Feature**
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ dart packages/command/bin/flutter_gen_command.dart --config example/pubspec.ya

Or melos
```sh
$ melos run example:command
$ melos gen:example:command
```

#### Use as part of build_runner
Expand All @@ -43,15 +43,15 @@ $ flutter packages pub run build_runner build

Or melos
```sh
$ melos run example:build_runner
$ melos gen:example:build_runner
```

## Running the tests

To run the unit tests:

```
$ melos run test
$ melos test
```

## Contributing code
Expand Down
6 changes: 3 additions & 3 deletions codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ coverage:
paths: null

ignore:
- "examples/**/*"
- "**/*.g.dart"
- "**/*.gen.dart"
- 'examples/**/*'
- '**/*.g.dart'
- '**/*.gen.dart'
2 changes: 1 addition & 1 deletion examples/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ A sample project using FlutterGen.

```
cd ../flutter_gen
melos run pub:get
melos bootstrap
```
4 changes: 2 additions & 2 deletions examples/example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ include: package:flutter_lints/flutter.yaml

analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
- '**/*.g.dart'
- '**/*.freezed.dart'
strong-mode:
implicit-casts: false
implicit-dynamic: false
Expand Down
4 changes: 2 additions & 2 deletions examples/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 32
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -44,7 +44,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 22
targetSdkVersion 32
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
12 changes: 6 additions & 6 deletions examples/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.8.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.2.2'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:perf-plugin:1.4.1'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:perf-plugin:1.4.2'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand All @@ -18,7 +18,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
2,982 changes: 2,981 additions & 1 deletion examples/example/assets/lottie/alarm-clock-lottie-v440.json

Large diffs are not rendered by default.

2,829 changes: 2,828 additions & 1 deletion examples/example/assets/lottie/geometrical-animation.json

Large diffs are not rendered by default.

Loading

0 comments on commit 162d4b1

Please sign in to comment.