grind_publish 0.0.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 47

grind_publish

This package automatically publishes your library when the pubspec.yaml version has been increased and merged into master.

NOTE: We strongly recommend to add a comment to the pubspec.yaml file to note that this package auto publishes if the version is increased. E.g.:

# Increasing this version will automatically
# publish to pub when merged into master
version: 0.0.2

Usage

1. Setup the grind task like this:

@Task('Automatically publishes this package if the pubspec version increases')
autoPublish() async {
  final credentials = grind_publish.Credentials.fromEnvironment();
  await grind_publish.autoPublish('your-package-name', credentials);
}

2. Set the environmental variables in your CI runner

By default the env vars are named: ACCESS_TOKEN, REFRESH_TOKEN, EXPIRATION, TOKEN_ENDPOINT (optional), SCOPES (optional).

You find the values on your local machine in ~/.pub-cache/credentials.json after you once ran pub publish.

On GitLab, setting these variables is in Settings → CI / CD → Variables.

3. Run the script in your CI pipeline

This really depends on where you are running this. For GitLab example, simply look at this .gitlab-ci.yml.

License

MIT

Changelog

0.0.4

  • Make use of the pub_client library to read the latest version.

0.0.3

  • Add analysis_options and make sure to await autoPublish.

0.0.2

  • Fix issue when optional env vars haven't been set.

0.0.1

  • Initial Release

example/example.dart

import 'package:grinder/grinder.dart';
import 'package:grind_publish/grind_publish.dart' as grind_publish;

@Task('Automatically publishes this package if the pubspec version increases')
autoPublish() async {
  // Will use the `ACCESS_TOKEN`, `REFRESH_TOKEN` and `EXPIRATION` env vars
  // as a configuration.
  final credentials = grind_publish.Credentials.fromEnvironment();

  await grind_publish.autoPublish('your-package-name', credentials);
}

Use this package as a library

1. Depend on it

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


dependencies:
  grind_publish: ^0.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:grind_publish/grind_publish.dart';
  
Version Uploaded Documentation Archive
0.0.4 Aug 17, 2018 Go to the documentation of grind_publish 0.0.4 Download grind_publish 0.0.4 archive
0.0.3 Aug 9, 2018 Go to the documentation of grind_publish 0.0.3 Download grind_publish 0.0.3 archive
0.0.2 Aug 8, 2018 Go to the documentation of grind_publish 0.0.2 Download grind_publish 0.0.2 archive
0.0.1 Aug 8, 2018 Go to the documentation of grind_publish 0.0.1 Download grind_publish 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
2
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: other

Primary library: package:grind_publish/grind_publish.dart with components: io, mirrors.

Maintenance issues and suggestions

Documentation URL is not helpful. (-10 points)

Update the documentation property: create a website about the package or remove it.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
grinder ^0.8.3 0.8.3
http ^0.11.0 0.11.3+17 0.12.0
meta ^1.1.0 1.1.6
path ^1.6.0 1.6.2
pub_client ^2.0.0 2.0.0 3.0.2
yaml ^2.1.0 2.1.15
Transitive dependencies
async 2.0.8
charcode 1.1.2
cli_util 0.1.3+2
collection 1.14.11
glob 1.1.7
http_parser 3.1.3
json_annotation 1.2.0
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
logging ^0.11.3
test ^1.3.0