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

Replace multipack with melos #192

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
87 changes: 45 additions & 42 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,36 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Activate multipack
- name: Activate tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
pub global activate multipack
pub global activate melos
pub global activate uni
- name: Check pubspec
run: |
multipack --only $PACKAGE pubspec clean
multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml
- name: Override local dependencies
melos clean
melos --scope $PACKAGE exec -- git diff --exit-code pubspec.yaml
- name: Bootstrap
run: |
multipack pubspec hard_override
melos --scope $PACKAGE bootstrap
- name: Get dependencies
run: |
multipack --only $PACKAGE pub get
melos --scope $PACKAGE exec -- uni pub get
- name: Check formatting
run: |
echo ""
echo "A list of incorrectly formatted files may follow:"
echo ""
multipack --only $PACKAGE fmt -n . --set-exit-if-changed
melos --scope $PACKAGE exec -- uni --tooling legacy format -n . --set-exit-if-changed
echo ""
- name: Analyze package
run: |
multipack --only $PACKAGE analyze --version
multipack --only $PACKAGE analyze --fatal-warnings --no-hints .
melos --scope $PACKAGE exec -- uni analyze --version
melos --scope $PACKAGE exec -- uni analyze --fatal-warnings .
- name: Run tests
run: |
multipack --only $PACKAGE exec [ ! -d ./test ] && exit 0
multipack --only $PACKAGE pub run test
melos --scope $PACKAGE exec -- [ -d ./test ] || exit 0
melos --scope $PACKAGE exec -- uni test
examples:
strategy:
matrix:
Expand All @@ -74,37 +75,38 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Activate multipack
- name: Activate tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
pub global activate multipack
pub global activate melos
pub global activate uni
- name: Check pubspec
run: |
multipack --only $PACKAGE pubspec clean
multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml
- name: Override local dependencies
melos clean
melos --scope $PACKAGE exec -- git diff --exit-code pubspec.yaml
- name: Bootstrap
run: |
multipack pubspec hard_override
melos --scope $PACKAGE bootstrap
- name: Get dependencies
run: |
multipack --only $PACKAGE pub get
melos --scope $PACKAGE exec -- uni pub get
- name: Run builders
run: |
multipack --only $PACKAGE pub run build_runner build --delete-conflicting-outputs
melos --scope $PACKAGE exec -- uni pub run build_runner build --delete-conflicting-outputs
- name: Check build diff
run: |
multipack --only $PACKAGE exec git diff --exit-code **/*.gql.dart
melos --scope $PACKAGE exec -- git diff --exit-code **/*.gql.dart
- name: Check formatting
run: |
echo ""
echo "A list of incorrectly formatted files may follow:"
echo ""
multipack --only $PACKAGE fmt -n . --set-exit-if-changed
melos --scope $PACKAGE exec -- uni --tooling legacy format -n . --set-exit-if-changed
echo ""
- name: Analyze package
run: |
multipack --only $PACKAGE analyze --version
multipack --only $PACKAGE analyze --fatal-warnings --no-hints .
melos --scope $PACKAGE exec -- uni analyze --version
melos --scope $PACKAGE exec -- uni analyze --fatal-warnings .
builder_tests:
strategy:
matrix:
Expand All @@ -119,41 +121,42 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Activate multipack
- name: Activate tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
pub global activate multipack
pub global activate melos
pub global activate uni
- name: Check pubspec
run: |
multipack --only $PACKAGE pubspec clean
multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml
- name: Override local dependencies
melos clean
melos --scope $PACKAGE exec -- git diff --exit-code pubspec.yaml
- name: Bootstrap
run: |
multipack pubspec hard_override
melos --scope $PACKAGE bootstrap
- name: Get dependencies
run: |
multipack --only $PACKAGE pub get
melos --scope $PACKAGE exec -- uni pub get
- name: Run builders
run: |
multipack --only $PACKAGE pub run build_runner build --delete-conflicting-outputs
melos --scope $PACKAGE exec -- uni pub run build_runner build --delete-conflicting-outputs
- name: Check build diff
run: |
multipack --only $PACKAGE exec git diff --exit-code **/*.gql.dart
melos --scope $PACKAGE exec -- git diff --exit-code **/*.gql.dart
- name: Check formatting
run: |
echo ""
echo "A list of incorrectly formatted files may follow:"
echo ""
multipack --only $PACKAGE fmt -n . --set-exit-if-changed
melos --scope $PACKAGE exec -- uni --tooling legacy format -n . --set-exit-if-changed
echo ""
- name: Analyze package
run: |
multipack --only $PACKAGE analyze --version
multipack --only $PACKAGE analyze --fatal-warnings --no-hints .
melos --scope $PACKAGE exec -- uni analyze --version
melos --scope $PACKAGE exec -- uni analyze --fatal-warnings .
- name: Run tests
run: |
multipack --only $PACKAGE exec [ ! -d ./test ] && exit 0
multipack --only $PACKAGE pub run test
melos --scope $PACKAGE exec -- [ -d ./test ] || exit 0
melos --scope $PACKAGE exec -- uni test

publish_dry_run:
runs-on: ubuntu-latest
Expand All @@ -166,7 +169,7 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Activate multipack
- name: Activate tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
pub global activate multipack
Expand All @@ -191,13 +194,13 @@ jobs:
run: |
apt update
apt install -y graphviz
- name: Activate multipack
- name: Activate tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
pub global activate multipack
pub global activate melos
- name: Generate SVG
run: |
multipack info | dot -Tsvg -o docs/gql.svg
melos list --gviz | dot -Tsvg -o docs/gql.svg
cat docs/gql.svg
- name: Check changes
run: |
Expand Down
28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Star on GitHub][github-star-badge]][github-star-link]
[![Watch on GitHub][github-forks-badge]][github-forks-link]
[![Discord][discord-badge]][discord-link]
[![Melos][melos-badge]][melos-link]

[license-badge]: https://img.shields.io/github/license/gql-dart/gql.svg?style=for-the-badge
[license-link]: https://github.com/gql-dart/gql/blob/master/LICENSE
Expand All @@ -21,6 +22,8 @@

[discord-badge]: https://img.shields.io/discord/559455668810153989.svg?style=for-the-badge&logo=discord&logoColor=ffffff
[discord-link]: https://discord.gg/NryjpVa
[melos-badge]: https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=for-the-badge
[melos-link]: https://github.com/invertase/melos


This is an effort to advance the Dart GraphQL ecosystem.
Expand Down Expand Up @@ -154,31 +157,18 @@ and to build a community around this vendor-neutral implementation.

Community contributions are welcome.

### `multipack`
This repo uses [`multipack`](https://github.com/gql-dart/multipack). To activate it run the following command.
### `melos`
This repo uses [`melos`](https://docs.page/invertase/melos) for monorepo management. To activate it run the following command.
```bash
pub global activate multipack
dart pub global activate melos
```

`multipack` provides a simple way of running commands in multiple packages at once. It builds a directed graph of packages
to run commands in topological order.

Link all local packages by running
```bash
multipack pubspec override
```

Get all packages by running
```bash
multipack pub get
```

Clean up the pubspec file before publishing
Start your work by [bootstrapping the monorepo](https://docs.page/invertase/melos/getting-started#bootstrapping).
```bash
multipack pubspec clean
melos bootstrap
```

See more usage examples in [.github/workflows/dart.yml](.github/workflows/dart.yml).
See more usage examples of `melos` in [.github/workflows/dart.yml](.github/workflows/dart.yml).

## Features and bugs

Expand Down
Loading