A set of Grinder tasks that make it easy to release a Dart command-line application

Overview

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.

Comments
  • Support arm64 in github tasks

    Support arm64 in github tasks

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

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

    opened by ntkme 4
  • GitHub changelog removes line breaks before list items

    GitHub changelog removes line breaks before list items

    When running the command, everything works well, but the Changelog.md section for the version is displayed without the line breaks.

    Please view the following link: https://github.com/leoafarias/fvm/releases/tag/2.0.0

    When digging into the code, it seems that this was done by design. (or maybe I am missing something) https://github.com/google/dart_cli_pkg/blob/master/lib/src/github.dart#L190

    Before making any changes to this, I wanted to make sure this change can be done so it's formatted correctly.

    bug 
    opened by leoafarias 3
  • Improve error handling when nuspec does not exist

    Improve error handling when nuspec does not exist

    When configuring pkg.chocolateyNuspec if the configured file is not found a message Invalid nuspec: "<" expected at 1:1 is shown. This checks if the configured file exists before trying to load it and parse it.

    opened by leoafarias 3
  • Error: Your SDK doesn't have dart2aot or dart2native

    Error: Your SDK doesn't have dart2aot or dart2native

    Hi,

    I'm getting an error that I didn't get before in GitHub Actions:

    pkg-compile-native
      failed: Your SDK doesn't have dart2aot or dart2native. This probably means that you're using a 32-bit SDK, which doesn't support native compilation.
    
    GrinderException: Your SDK doesn't have dart2aot or dart2native. This probably means that you're using a 32-bit SDK, which doesn't support native compilation.
    #0      GrinderContext.fail (package:grinder/src/grinder_context.dart:42:5)
    #1      fail (package:grinder/src/grinder_context.dart:59:39)
    #2      _compileNative (package:cli_pkg/src/standalone.dart:81:5)
    #3      _rootRun (dart:async/zone.dart:14[26](https://github.com/filiph/linkcheck/runs/6373828609?check_suite_focus=true#step:8:26):13)
    ...
    Error: Process completed with exit code 1.
    

    Whole run here.

    Is this because dart2aot and dart2native do not exist anymore? Or has something changed with the default Dart binaries that prevents cli_pkg to do its work inside GitHub Actions?

    Here is the setup, which I'm told is very standard:

    • GitHub actions workflow: https://github.com/filiph/linkcheck/blob/master/.github/workflows/release.yml
    • grind.dart: https://github.com/filiph/linkcheck/blob/master/tool/grind.dart
    bug needs info 
    opened by filiph 2
  • For main functions returning a Future, translate into JS Promises when creating an npm package

    For main functions returning a Future, translate into JS Promises when creating an npm package

    This addresses #50 and enables proper error reporting in rules_sass in worker mode (bazelbuild/rules_sass#96).

    I am not entirely sure if this warrants a particular unit test, given that this is basically a private API.

    opened by BobobUnicorn 2
  • license function searches for Dart SDK license in wrong place when Homebrew'd

    license function searches for Dart SDK license in wrong place when Homebrew'd

    I am assuming this is specific to Homebrew...

    When Dart is installed with Homebrew, and running the pkg-npm-dev grinder task, I get the following crash:

    pkg-npm-dev
      writing build/npm/package.json
      copying build/abc.dart.js to build/npm
    
    FileSystemException: Cannot open file, path = '/usr/local/Cellar/dart/2.7.1/libexec/LICENSE' (OS Error: No such file or directory, errno = 2)
    #0      _File.throwIfError (dart:io/file_impl.dart:645:7)
    #1      _File.openSync (dart:io/file_impl.dart:489:5)
    #2      _File.readAsBytesSync (dart:io/file_impl.dart:549:18)
    #3      _File.readAsStringSync (dart:io/file_impl.dart:594:18)
    #4      license.<anon> (package:cli_pkg/src/utils.dart:94:52)
    #5      new Future.sync (dart:async/future.dart:224:31)
    #6      AsyncMemoizer.runOnce (package:async/src/async_memoizer.dart:43:45)
    #7      license (package:cli_pkg/src/utils.dart:82:44)
    #8      _buildPackage (package:cli_pkg/src/npm.dart:380:50)
    #9      addNpmTasks.<anon> (package:cli_pkg/src/npm.dart:194:27)
    

    Here are the various files in that Homebrew installation:

    ~/code/abc/server:$ ls -FlAh /usr/local/Cellar/dart/2.7.1/libexec/
    total 24
    drwx------  15 sam  admin   510B Jan 23 05:07 bin/
    -rw-r--r--   1 sam  admin   189B Jan 23 04:08 dartdoc_options.yaml
    drwxr-xr-x   5 sam  admin   170B Jan 23 04:08 include/
    drwxr-xr-x  29 sam  admin   986B Jan 23 04:11 lib/
    -rw-r--r--   1 sam  admin    41B Jan 23 04:08 revision
    -rw-r--r--   1 sam  admin     6B Jan 23 04:08 version
    
    ~/code/abc/server:$ ls -FlAh /usr/local/Cellar/dart/2.7.1/
    total 24
    drwxr-xr-x   3 sam  admin   102B Feb 20 21:15 .brew/
    -rw-r--r--   1 sam  admin   584B Feb 20 21:15 INSTALL_RECEIPT.json
    -rw-r--r--   1 sam  admin   1.5K Jan 23 04:05 LICENSE
    -rw-r--r--   1 sam  admin   936B Jan 23 04:05 README
    drwxr-xr-x  11 sam  admin   374B Feb 20 21:14 bin/
    drwxr-xr-x   8 sam  admin   272B Feb 20 21:14 libexec/
    
    bug 
    opened by srawlins 2
  • Add an easy way to configure Travis credentials

    Add an easy way to configure Travis credentials

    All deployments require credentials, and making those credentials available to the deploy steps can be error-prone and annoying. We should provide a way to do this configuration on the user's behalf.

    One possibility would be to provide our own pub run-based CLI which would authenticate with the various services and write the result to the user's .travis.yml.

    enhancement 
    opened by nex3 2
  • Merge package.json

    Merge package.json "exports" with template instead of overwritting

    when having a package.json file with exports like

    "exports": {
      "types": "./path/to/types"
    }
    

    This currently becomes

    "exports": {
      "default": "./${pkg}.default.dart.js"
    }
    

    Ideally this should become

    "exports": {
      "types": "./path/to/types"
      "default": "./${pkg}.default.dart.js"
    }
    

    Note that "exports" can also be string|string[], so the feature request is to keep the behavior of overwriting the field if it was either string|string[]|undefined|null however when the field had value {} (or Map in dart) then use the spread operator and only overwrite "node", "browser", and "default" when specified.

    See https://github.com/sass/dart-sass/issues/1714

    opened by Goodwine 1
  • Allow nullsafe versions of some dependencies

    Allow nullsafe versions of some dependencies

    This is an attempt at unlocking the installation of test 1.16.7+ when running the dart-sass testsuite on dart 2.12+, to have the fix for spawnHybridCode

    opened by stof 1
  • Convert futures to Promise in NPM package

    Convert futures to Promise in NPM package

    Packages like sass (built from the dart-sass repo) do expose Future's in their NPM output for exported functions. This is not desirable in NodeJS and ideally native Promise constructs would be returned.

    Initially conversion for this has been proposed to the dart-sass repo, but it looks like this could be automatically captured in the NPM task that creates the JS interop main wrapper.

    Related: https://github.com/sass/dart-sass/pull/932

    opened by devversion 1
  • Relative symbolic links to generated shell scripts fail to execute on linux

    Relative symbolic links to generated shell scripts fail to execute on linux

    Apparent the dart-sass project uses this project to create the executables. When I created a relative symbolic link to the dart-sass shell script it failed to execute on linux because readlink does not return the full path. In this case readlink -f is needed, however I see that it is not used because of an issue on OS X.

    Please see https://github.com/sass/dart-sass/issues/978 for more details.

    opened by RayDeCampo 1
  • Upload executable checksums

    Upload executable checksums

    Copied from https://github.com/sass/dart-sass/issues/1678:

    Could you please provide checksums of the assets we download from the release page? An integrity check is a good practice after downloading over the net.

    For example, Docker Compose is doing this: https://github.com/docker/compose/releases

    enhancement help wanted 
    opened by nex3 0
  • Add Support to create and upload Debian Packages

    Add Support to create and upload Debian Packages

    Fixes #95.

    • Import of GPG keys is now available with an option to use external tools to import keys. (Also useful if keys are already present)
    • The signing of the release files is now automated.

    Work Left

    • Documentation for steps to use
    • Tests for the module

    If you do have any suggestions or corrections, please drop them below. Thanks.

    Description

    The feature works by:

    1. Creating a .deb package from the given executables. (mentioned in sass/dart-sass#1164)
    2. Updating the Release files in the cloned PPA repo and then signing them.
    3. Updating the remote PPA repo with the new packages.
    4. It creates the Debian packages for both architectures x64 and ia32.

    Usage

    To use this feature,

    1. Set the debianRepo, signingEmail, controlData config variables.
    2. Add the location of control file to controlData config.
    3. Setup the GPG key import action. The key fingerprint and passphrase are taken from the secrets.
    4. Use the addDebianTasks function to add the Debian task to Grinder.
    opened by shubhanshu02 17
  • Debian package support

    Debian package support

    As requested in https://github.com/sass/dart-sass/issues/1164 it would be nice for Dart-SASS and other users (such as FVM of this package to have support for producing Debian packages.

    If no one wants to tackle this first, I'll have a go at adding support for this when I get a chance.

    enhancement help wanted 
    opened by maks 0
  • DRAFT: Generates verification file for Chocolatey

    DRAFT: Generates verification file for Chocolatey

    A verification file is now needed since this cli_pkg builds an embedded package with the software included inside the package.

    Have successfully passed the approval Chocolatey approval process with the dynamically generated file in this PR.

    opened by leoafarias 13
  • Add support for standalone executables

    Add support for standalone executables

    dart2native supports generating fully standalone executables, and we should ideally support this as well for standalone compilation. There are some complications, though: on OS X and Windows, standalone executables need to be signed or they'll produce scary and annoying warnings when they're run. This requires that users purchase a trusted certificate for each OS and run a command to sign the generated executables with those certificates. See details for OS X and Windows.

    I think the best way to handle this would be to have pkg.standaloneWindowsCert and pkg.standaloneMacOSCert fields and, if those fields are set, generate full standalone executables and sign them. I don't think it's especially useful to generate unsigned executables; they won't be much faster than native snapshots, and the generated warnings will be very frustrating.

    Note that for Linux, this is much easier, since code signing isn't required. Given that all three supported operating systems are substantially different here, I'm going to split this up into three tasks:

    • [ ] Linux
    • [ ] Windows
    • [ ] Mac OS
    enhancement 
    opened by nex3 0
Owner
Google
Google ❤️ Open Source
Google
Listen to remote Flutter GTK application instances' command-line arguments and file open requests.

gtk_application This package allows the primary Flutter GTK application instance to listen to remote application instances' command-line arguments and

null 10 Nov 19, 2022
Package your Flutter app into OS-specific bundles (.dmg, .exe, etc.) via Dart or the command line.

flutter_distributor Package your Flutter app into OS-specific bundles (.dmg, .exe, etc.) via Dart or the command line. The flutter_distributor source

LeanFlutter 402 Nov 18, 2022
A Nerolab Command Line Interface for Dart created by Nerolab

Nerolab CLI Nerolab Command Line Interface for Dart. Special thanks to GroovinChip with groovin_cli and very_good_cli. Installing dart pub global acti

Nerolab 1 Jan 19, 2022
This is a command-line app written on dart language for flutter applications that will help you to generate some boilerplate code

dart-generator Manual installation: 1- generate a platform executable from code dart compile exe main.dart -o generator this will generate a new gene

One Studio 11 Oct 26, 2022
Scaff is a simple command-line utility for generating Dart and Flutter components from template files.

Introduction Scaffold Generator for Dart and Flutter. scaff is a simple command-line utility for generating Dart and Flutter components from template

Ganesh Rathinavel Medayil 29 Jul 17, 2022
Interactive command line interface Couchbase Lite REPL utility built with the Dart

Couchbase Lite Dart CLI Interactive command line interface Couchbase Lite REPL utility built with the Dart programming language. This code uses the cb

Pieter Greyling 2 Jul 20, 2022
This is a simple Gantt chart generator written as Dart command line tool.

Gantt Chart Generator This is a simple Gantt chart generator written as Dart command line tool. Currently the tool generates an HTML/CSS Gantt chart.

John Lyon-Smith 1 Apr 26, 2022
Command Line Interface (CLI) for Lucifer

Lucy Command Line Interface (CLI) for Lucifer. Installation Activate command line from your terminal with this command. pub global activate lucy Usage

Salman S 1 Dec 16, 2021
Screenshots - A command line utility and package for capturing screenshots for Flutter

A screenshot image with overlaid status bar placed in a device frame. For an example of images generated with Screenshots on a live app in both stores

Maurice McCabe 259 Nov 18, 2022
An incredible command line interface for Flutter.

Fast CLI An incredible command line interface for Flutter. It allows you to create your own CLI without coding a line. With this CLI, you can create y

Pedro Bissonho 41 Jul 12, 2022
☄ Anime/Manga command-line interface backed up by Tenka.

Yukimi ☄ Anime/Manga command-line interface backed up by Tenka. By using this project, you agree to the usage policy. Installation Pre-built binaries

Yukino Org 27 Oct 19, 2022
shared_versions is a command line tool that allow share the versions for multiple packages in Flutter

shared_versions shared_versions is a CLI tool that allow share the versions for multiple packages in Flutter. Usage shared_versions will match the pac

Littlegnal 6 Sep 20, 2022
Icons Launcher - A command-line tool that simplifies the task of updating your Flutter app's launcher icon.

Icons Launcher - A command-line tool that simplifies the task of updating your Flutter app's launcher icon. Full flexibility allows you to only update the launcher icon for specific platforms as needed.

Mrr Hak 48 Nov 17, 2022
This application was created using the Dart language and it is an application that contains a set of different questions and at the end shows you the number of correct answers you have answered , made by flutter

exams_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

null 0 Dec 28, 2021
A smartphone application called Easy Job goal is to make easier for businesses to find people who meet their standards as well as for job seekers to search for and choose from available positions .

Easy_Jobs 19SW54(MAD-Project) A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to ge

Muskan 2 Nov 6, 2022
Hyakunin Isshu 1 Jan 11, 2022
Appwrite is a secure end-to-end backend server for Web, Mobile, and Flutter developers that is packaged as a set of Docker containers for easy deployment 🚀

A complete backend solution for your [Flutter / Vue / Angular / React / iOS / Android / *ANY OTHER*] app Appwrite 0.12 has been released! Learn what's

Appwrite 27.3k Nov 20, 2022
Flutter app to manage tasks.

A new Flutter app project to manage tasks. Getting Started A few resources to get you started if this is your first Flutter project: Lab: Write your f

Jobin Biju 139 Oct 29, 2022