gpm 0.2.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Pub Package Github Actions CI

Overview #

GPM ("General Package Manager") is a programming tool designed for monorepos (multi-package repositories). GPM automatically discovers packages and infers how to test/build them. You can optionally write .gpm.yaml configuration files.

Alternatives #

  • Custom test/build scripts (Bash, Dart, etc.).
    • GPM saves time and is less error-prone.
  • CI tools
    • GPM is just a simple command-line tool that developers can use in their local development machine. It doesn't replace CI tools. GPM can be used to generate configurations for CI tools.
  • mono_repo
    • mono_repo appears to be focused on running Travis CI tests locally.

Installing #

Then run:

pub global activate gpm

Alternatively, if you have only Flutter SDK installed, you can run: flutter pub global activate gpm

Test installation by running gpm. If you haven't configured your PATH environmental variable properly (see Dart SDK / Flutter SDK instructions), attempting to run GPM will give you a "command not found" error message. In this case, you can still use GPM by running pub global run gpm (or flutter pub global run gpm).

Examples #

Show packages in the directory tree #

gpm info

The command will show debug information.

Get dependencies #

gpm get

The above command will run:

  • flutter pub get (for each Flutter SDK package)
  • pub get (for each Dart SDK package)

Test #

gpm test

The above command will run:

  • flutter test (for each Flutter SDK package, when flutter_test dependency is found)
  • flutter pub run test (for each Flutter SDK package, when flutter_test dependency is not found)
  • pub run test (for each Dart SDK package)

Build #

gpm build

The above command will run:

  • flutter build apk (for each Flutter SDK package that has android directory)
  • flutter build ios (for each Flutter SDK package that has ios directory)
  • flutter build web (for each Flutter SDK package that has web directory)
  • pub global run webdev build (for each Dart SDK package that has web directory)
    • If webdev is not activated, it activates it.

Initialize CI configuration #

Azure Pipelines #

gpm ci init azure

This will generate ".ci/.azure-pipelines.yml".

Github Actions #

gpm ci init github

This will generate ".github/workflows/dart.yml".

Gitlab CI #

gpm ci init gitlab

This will generate ".gitlab-ci.yml".

Travis #

gpm ci init travis

This will generate ".travis-ci.yml".

Upgrade GPM to the latest version #

gpm upgrade

This is just a shorthand for pub global activate gpm.

Optional configuration file #

Filename #

The following filenames are supported:

  • .gpm.yaml
  • gpm.yaml

Defining packages #

By default, GPM assumes that every directory that contains pubspec.yaml is a package. Packages are currently handled in alphabetical order.

You can customize this in gpm.yaml:

  - path: some/package
    # Override default test step(s)
      run: flutter test
    # Override default build step(s)
        - run: flutter build apk
        - run: flutter build ios
        - run: flutter build web

  - path: some/other/package

Defining scripts #

In gpm.yaml:

    description: Generates Dart files from Protocol Buffers definitions.
        # Define working directory
      - directory: some/directory

        # Run 'protoc' command.
        # @(X) causes every "/" in X to be replaced with "\" when running in Windows.
        run: protoc --dart-out @(lib/generated/) definition.proto

        # You could optionally define platform:
        # platform: "posix || windows"

        # Another step
      - directory: some/directory
        run: protoc --dart-out @(lib/generated/) another_definition.proto

Then run:

gpm run protos

Syntax rules for run are:

  • "a b c" (a quoted argument)
  • "\@\(\)" (escape character "\" works inside a quoted argument)
  • $(ENV_VAR) (an environmental variable)
  • @(a/b/c) (replaces "/" with "" in Windows)

0.2.2 #

  • Improves documentation.

0.2.1 #

  • Adds support for overriding test/build steps.
  • Fixes a CI configuration generation bug.

0.2.0 #

  • Lots of improvements.

0.1.0 #

  • Initial release


// Run
// gpm

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate gpm

2. Use it

The package has the following executables:

$ gpm

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  gpm: ^0.2.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:gpm/gpm.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web


  • package:gpm/gpm.dart that imports:
  • dart:io

Package not compatible with runtime js


  • package:gpm/gpm.dart that imports:
  • dart:io


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
args ^1.4.0 1.6.0
boolean_selector ^2.0.0 2.0.0
meta ^1.1.0 1.2.2 1.3.0-nullsafety
yaml ^2.0.0 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
pedantic ^1.9.0
test ^1.10.0