Viewing version 2.1.2. Open the latest package page.

cli_pkg

2.1.2

Grinder tasks for releasing Dart CLI packages.

Download archive

Readme

Dart CLI Packager

This package provides a set of Grinder tasks that make it easy to release a Dart command-line application on many different release channels, to Dart users and non-Dart users alike. It also integrates with Travis CI to make it easy to automatically deploy packages.

To use this package, import package:cli_pkg/cli_pkg.dart and call pkg.addAllTasks() before calling grind():

import 'package:cli_pkg/cli_pkg.dart' as pkg;
import 'package:grinder/grinder.dart';

void main(List<String> args) {
  pkg.addAllTasks();
  grind(args);
}

The following sets of tasks are provided, each of which can also be enabled individually:

It's strongly recommended that this package be imported with the prefix pkg.

Configuration

This package is highly configurable, using ConfigVariable fields defined at the top level of the library. By default, it infers as much configuration as possible from the package's pubspec, but almost all properties can be overridden in the main() method:

import 'package:cli_pkg/cli_pkg.dart' as pkg;
import 'package:grinder/grinder.dart';

void main(List<String> args) {
  pkg.name.value = "bot-name";
  pkg.humanName.value = "My App";

  pkg.addAllTasks();
  grind(args);
}

ConfigVariables whose values are expensive to compute or that might fail under some circumstances can also be set to callback functions, which are called lazily when the variables are used by the Grinder tasks:

import 'package:cli_pkg/cli_pkg.dart' as pkg;
import 'package:grinder/grinder.dart';

void main(List<String> args) {
  pkg.githubReleaseNotes.fn = () => File.read("RELNOTES.md");

  pkg.addAllTasks();
  grind(args);
}

Each task describes exactly which configuration variables it uses. Configuration that just applies to one set of tasks is always prefixed with a corresponding name. For example, pkg.jsFlags applies to JavaScript compilation.

Changelog

2.1.2

  • Use dart pub commands rather than pub for compatibility with the latest Dart releases.

2.1.1

  • Narrow the SDK constraint to reflect the use of a new API.

2.1.0

  • Add pkg-github-$os-$arch tasks, which compile and upload binaries for the given operating system and architecture.

  • pkg-github-linux, pkg-github-macos, and pkg-github-windows now compile and upload binaries for all supported architectures.

  • Use dart pub commands rather than pub for compatibility with the latest Dart releases.

2.0.3

  • Fix a bug where dynamic calls to require() would always be null in an npm package.

2.0.2

  • Fix a bug where an npm package with target-specific JSRequires would include an invalid "main" field in its package.json.

2.0.1

  • Work around an npm bug that was causing npm publish to fail.

2.0.0

  • Breaking change: The jsRequires map has been changed to a list of JSRequire objects. These objects allow packages to specify exactly which target(s) a given dependency should be loaded on, so for example they can provide a package that loads the fs module for Node.js but can still be bundled for the browser without it.

1.7.0

  • Callbacks passed to ConfigVariable.fn= can now return nullable values even for non-nullable types. Doing so will cause the variable to use its default value. The behavior for nullable types remains unchanged.

1.6.0

  • Add pkg-standalone-linux-arm64 and pkg-standalone-mac-arm64 tasks, which compile Linux and Mac OS binaries respectively for 64-bit ARM architectures. As with other 64-bit architectures, these will compile native executables when invoked on the same OS/architecture combination they're targeting, and will compile script snapshots otherwise.

  • pkg-standalone-all now compiles Linux and Mac OS binaries for 64-bit ARM architectures.

1.5.2

  • Use dart compile exe and dart compile aot-snapshot instead of dart2native when compiling standalone executables.

  • The space character is no longer forbidden in environment constants, since https://github.com/dart-lang/sdk/issues/46050 has been fixed.

1.5.1

  • Properly run executables from source in testing.dart when their public names are different than their filenames.

1.5.0

  • Add pkg.npmAdditionalFiles to make it possible to add custom files to npm packages.

  • pkg.addChocolateyTasks() no longer automatically adds standalone tasks, since Chocolatey tasks no longer depend on standalone tasks.

  • pkg-chocolatey now creates a file named LICENSE.txt rather than LICENSE, at the request of the Chocolatey reviewers.

1.4.0

  • Add pkg.environmentConstants to make it possible to define custom environment constants for the compiled executables.

1.3.0

  • Migrate to null-safety.

1.2.0

  • Add a pkg.githubBearerToken to make it easier to integrate with GitHub actions.

  • Generate a fully standalone executable on Linux rather than a native snapshot.

1.1.0

  • The main function generated by this package will return a Promise if the corresponding Dart main function returns a Future.

1.0.0

  • Initial stable release.

Changes since 1.0.0-beta.13

  • Don't fold link reference declarations like paragraphs when generating GitHub release notes.

1.0.0-beta.13

  • Add a ConfigVariable.defaultValue property to get the default value for variables that are overridden by functions.

  • Fix a typo in error messages when files need to be regenerated for tests.

1.0.0-beta.12

  • Deploy Chocolatey packages as source files rather than a zip file, to avoid validation errors around the need for a VERIFICATION file.

1.0.0-beta.11

  • Properly load the Dart SDK license when it's in the directory above the SDK, as in a Homebrew installation.

  • Use the latest version of the xml package.

1.0.0-beta.10

  • Breaking change: All configurable variables are now defined as ConfigVariable objects rather than top-level fields. These objects make it possible to configure variables with callback functions and to freeze those variables once execution has begun.

  • Properly handle git repositories that use branch names other than master.

1.0.0-beta.9

  • Improve error messages if release notes can't be extracted from CHANGELOG.md.

1.0.0-beta.8

  • Fixes a bug when reading a CHANGELOG.md with Windows-style line endings.

1.0.0-beta.7

  • Breaking change: Dart snapshots are now named based on the executable name (specified in the pubspec or in pkg.executables) instead of the name of the Dart file in bin.

1.0.0-beta.6

  • Breaking change: Chocolatey now uses the choco CLI to build and deploy packages, rather than re-implementing its logic in Dart. In particular:

    • The pkg-chocolatey-build task has been renamed to pkg-chocolatey-pack to match the CLI's naming scheme.

    • The pkg-chocolatey-pack and pkg-chocolatey-deploy tasks must be run in an environment with the choco command available.

  • Add a pkg-chocolatey command that builds an un-archived Chocolatey package directory.

  • Rather than releasing binary snapshots on Chocolatey, compile the source code to compile native executables on users' machines.

  • Add a chocolateyFiles getter that returns the files that should be included in the Chocolatey package.

  • Depend on the correct version of pre-release Dart SDKs from Chocolatey packages.

1.0.0-beta.5

  • Use the correct URL when fetching GitHub release metadata.

1.0.0-beta.4

  • Add a pkg.npmDistTag getter that controls the distribution tag for an npm release.

  • Add a pkg.homebrewCreateVersionedFormula getter that controls whether the Homebrew release creates a new formula or updates an existing one.

  • Run pub publish --force so it doesn't hang forever.

  • Properly parse GitHub repositories from HTTP URLs ending in .git.

  • Drop support for Mac OS ia32 packages, since Dart 2.7 doesn't support them anymore.

1.0.0-beta.3

  • Add a cli_pkg/testing.dart library to make it easier for users to efficiently and reliably test their executables.

1.0.0-beta.2

  • Add a pkg-standalone-dev task for building a script that can be invoked for testing.

  • Fix a bug where the version variable wouldn't be set for certain executables.

1.0.0-beta.1

  • Initial beta release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'cli_pkg:2.1.2'
pubspec.yaml
name: cli_pkg
version: 2.1.2
description: Grinder tasks for releasing Dart CLI packages.
homepage: https://github.com/google/dart_cli_pkg

environment:
  sdk: '>=2.16.0 <3.0.0'

dependencies:
  archive: ^3.1.2
  async: ^2.5.0
  charcode: ^1.2.0
  collection: ^1.15.0
  crypto: ^3.0.0
  grinder: ^0.9.0
  http: ^0.13.0
  js: ^0.6.3
  meta: ^1.3.0
  node_interop: ^2.0.0
  node_preamble: ^2.0.0
  package_config: ^2.0.0
  path: ^1.8.0
  pub_semver: ^2.0.0
  pubspec_parse: ^1.0.0
  string_scanner: ^1.1.0
  test: ^1.16.7
  test_process: ^2.0.0
  xml: ^5.0.2
  yaml: ^3.1.0

dev_dependencies:
  sass_analysis:
    git: {url: https://github.com/sass/dart-sass.git, path: analysis}
  shelf: ^1.0.0
  shelf_test_handler: ^2.0.0
  test_descriptor: ^2.0.0
  tuple: ^2.0.0-nullsafety.0

Version history

VersionPublishedArchiveSHA-256
1.0.0-beta.2Cached · Upstream SHA-256 matchedDownloadce218e80…7fc867
1.0.0-beta.3Cached · Upstream SHA-256 matchedDownloadbfa61fea…c87c78
1.0.0-beta.4Cached · Upstream SHA-256 matchedDownload7dd0266a…657eb3
1.0.0-beta.5Cached · Upstream SHA-256 matchedDownload53510dc2…a2e51b
1.0.0-beta.6Cached · Upstream SHA-256 matchedDownloade8573fab…2f3dd0
1.0.0-beta.7Cached · Upstream SHA-256 matchedDownload89e777ba…86f978
1.0.0-beta.8Cached · Upstream SHA-256 matchedDownload0dfbe276…97946f
1.0.0-beta.9Cached · Upstream SHA-256 matchedDownload4c62a40d…dfdf82
1.0.0-beta.10Cached · Upstream SHA-256 matchedDownloadfdaeae3e…99032c
1.0.0-beta.11Cached · Upstream SHA-256 matchedDownload365d85d1…71dd5a
1.0.0-beta.12Cached · Upstream SHA-256 matchedDownloadec4f07e8…1af778
1.0.0-beta.13Cached · Upstream SHA-256 matchedDownload94411bc5…3f84f3
1.0.0Cached · Upstream SHA-256 matchedDownloadf9e8b779…758012
1.1.0Cached · Upstream SHA-256 matchedDownload5a6c78ff…a698b4
1.2.0Cached · Upstream SHA-256 matchedDownloadbef986f7…7db570
1.3.0Cached · Upstream SHA-256 matchedDownloadf44b1c73…5e751a
1.4.0Cached · Upstream SHA-256 matchedDownloadf876bd90…1c5a66
1.5.0Cached · Upstream SHA-256 matchedDownload04269e8c…593dbe
1.5.1Cached · Upstream SHA-256 matchedDownload143760cc…150092
1.5.2Cached · Upstream SHA-256 matchedDownload1f6b1b94…e2a45f
1.6.0Cached · Upstream SHA-256 matchedDownload44ec9ca4…2b89af
1.7.0Cached · Upstream SHA-256 matchedDownload9908fe47…32e197
2.0.0Cached · Upstream SHA-256 matchedDownload55828d79…9331d8
2.0.1Cached · Upstream SHA-256 matchedDownload6ac93874…a7480c
2.0.2Cached · Upstream SHA-256 matchedDownload4a748690…135d96
2.0.3Cached · Upstream SHA-256 matchedDownloadd3c74b1c…9738ef
2.1.0Cached · Upstream SHA-256 matchedDownloadf37d7622…103efd
2.1.1Cached · Upstream SHA-256 matchedDownload21b8bc1e…da1695
2.1.2Cached · Upstream SHA-256 matchedDownloadb9d1ea0c…584e35
2.1.3Cached · Upstream SHA-256 matchedDownloada97c5940…77724c
2.1.4Cached · Upstream SHA-256 matchedDownloadf592bed1…8192ff
2.1.5Cached · Upstream SHA-256 matchedDownload930de52b…b63c94
2.1.6Cached · Upstream SHA-256 matchedDownloadb564e39e…1cbb96
2.1.7Cached · Upstream SHA-256 matchedDownloadca35fda7…e7600e
2.1.8Cached · Upstream SHA-256 matchedDownload0ff7d697…163063
2.1.9Cached · Upstream SHA-256 matchedDownloadca6d4a3b…83213f
2.2.0Cached · Upstream SHA-256 matchedDownload977b0a29…c85431
2.3.0Cached · Upstream SHA-256 matchedDownloadfc862743…c50520
2.4.0Cached · Upstream SHA-256 matchedDownload2f5bdb86…94b59b
2.4.1Cached · Upstream SHA-256 matchedDownload90b2e3bb…bd8d69
2.4.2Cached · Upstream SHA-256 matchedDownload7ae1c54d…ca3efd
2.4.3Cached · Upstream SHA-256 matchedDownloadc5bae978…ac35e6
2.4.4Cached · Upstream SHA-256 matchedDownload0f76b0ea…758517
2.4.5Cached · Upstream SHA-256 matchedDownload023bcaf6…1ab6fa
2.4.6Cached · Upstream SHA-256 matchedDownloadecf59d84…c7bf67
2.4.7Cached · Upstream SHA-256 matchedDownload1057bab2…9b1836
2.5.0Cached · Upstream SHA-256 matchedDownload009e1994…05c9b9
2.6.0Cached · Upstream SHA-256 matchedDownloadd3649863…7cf111
2.7.0Cached · Upstream SHA-256 matchedDownload716254ea…28f6ad
2.7.1Cached · Upstream SHA-256 matchedDownload5e9b44c5…fc0b8a
2.7.2Cached · Upstream SHA-256 matchedDownload7b088621…a7ce4a
2.8.0Cached · Upstream SHA-256 matchedDownloadbe7f66d6…72100f
2.8.1Cached · Upstream SHA-256 matchedDownloada4df039b…d9e03b
2.9.0Cached · Upstream SHA-256 matchedDownloadb15d9558…630a61
2.10.0Cached · Upstream SHA-256 matchedDownloadf812467b…afdcf2
2.11.0Cached · Upstream SHA-256 matchedDownloadf07db559…337dd4
2.12.0Cached · Upstream SHA-256 matchedDownloadeeeea1e0…4c55b2
2.13.0Cached · Upstream SHA-256 matchedDownload8d94c00e…f57d97
2.14.0Cached · Upstream SHA-256 matchedDownloadda207d78…63f3a5
2.15.0Cached · Upstream SHA-256 matchedDownloadbbffba71…a17190
2.15.1Cached · Upstream SHA-256 matchedDownload8343ec3b…8b5150
2.15.2Cached · Upstream SHA-256 matchedDownload1b3915a8…296af8
2.16.0Cached · Upstream SHA-256 matchedDownload8a75add8…b8290a

Dependencies

archive "^3.1.2"

async "^2.5.0"

charcode "^1.2.0"

collection "^1.15.0"

crypto "^3.0.0"

grinder "^0.9.0"

http "^0.13.0"

js "^0.6.3"

meta "^1.3.0"

node_interop "^2.0.0"

node_preamble "^2.0.0"

package_config "^2.0.0"

path "^1.8.0"

pub_semver "^2.0.0"

pubspec_parse "^1.0.0"

string_scanner "^1.1.0"

test "^1.16.7"

test_process "^2.0.0"

xml "^5.0.2"

yaml "^3.1.0"