Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: advanced custom script definitions (with package selection prompting) #34

Merged
merged 7 commits into from
Dec 1, 2020

Conversation

Salakar
Copy link
Member

@Salakar Salakar commented Nov 27, 2020


Goal: Improve local developer experience when running scripts and to make scripts in a repository more 'new contributor' friendly (don't need to remember what each script does and can easily target specific packages now).


Example melos.yaml from FlutterFire:

name: FlutterFire

packages:
  - packages/**

scripts:
  analyze:
    run: |
      melos exec -c 5 --fail-fast -- \
        dart analyze .
    description: |
      Run `dart analyze` in all packages.
       - Note: you can also rely on your IDEs Dart Analysis / Issues window.

  format:
    run: dart pub global run flutter_plugin_tools format
    description: |
      Build a specific example app for Android.
       - Requires `flutter_plugin_tools` (`pub global activate flutter_plugin_tools`).
       - Requires `clang-format` (can be installed via Brew on macOS).

  build:example_android:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter build apk --no-pub"
    description: Build a specific example app for Android.
    select-package:
      dir-exists:
        - android
      scope: '*example*'

  build:example_ios:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter build ios --no-codesign --no-pub"
    description: Build a specific example app for iOS.
    select-package:
      dir-exists:
        - ios
      scope: '*example*'

  build:example_macos:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter build macos --no-pub"
    description: |
      Build a specific example app for macOS.
       - Requires `flutter channel master`.
       - Requires `flutter config --enable-macos-desktop` set.
    select-package:
      dir-exists:
        - macos
      scope: '*example*'

  test:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter test --no-pub"
    description: Run `flutter test` for a specific package.
    select-package:
      dir-exists:
        - test
      ignore:
        - '*web*'
        - '*example*'

  test:web:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter test --no-pub --platform=chrome"
    description: Run `flutter test --platform=chrome` for a specific '*web' package.
    select-package:
      dir-exists:
        - test
      scope: '*web*'

  test:mobile_e2e:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter drive --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart"
    description: |
      Run all Android or iOS test driver e2e tests in a specific example app.
       - Requires an Android emulator or iOS simulator.
    select-package:
      dir-exists:
        - test_driver
      scope: '*example*'

  test:web_e2e:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter drive -d web --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart"
    description: |
      Run all Web test driver e2e tests in a specific example app.
       - Requires `flutter channel master` (or beta).
       - Requires `flutter config --enable-web` set.
       - Requires chromedriver running on port 4444.
    select-package:
      dir-exists:
        - web
        - test_driver
      scope: '*example*'

  test:macos_e2e:
    run: |
      melos exec -c 1 --fail-fast -- \
        "flutter drive -d macos --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart"
    description: |
      Run all MacOS test driver e2e tests in a specific example app.
       - Requires `flutter channel master`.
       - Requires `flutter config --enable-macos-desktop` set.
    select-package:
      dir-exists:
        - macos
        - test_driver
      scope: '*example*'

  # Additional cleanup lifecycle script, executed when `melos clean` is ran.
  postclean: >
    melos exec -c 5 -- "flutter clean"

dev_dependencies:
  pedantic: 1.8.0

environment:
  sdk: ">=2.1.0 <3.0.0"
  flutter: ">=1.12.13+hotfix.5 <2.0.0"

melos run output:

image

@Salakar Salakar changed the title [WIP] feat: advanced custom script definitions (with package selection prompting) feat: advanced custom script definitions (with package selection prompting) Dec 1, 2020
@Salakar Salakar marked this pull request as ready for review December 1, 2020 16:44
@Salakar Salakar merged commit e2f8417 into master Dec 1, 2020
@Salakar Salakar deleted the @salakar/feat-select-package_s branch December 1, 2020 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant