npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ea-semantic-release-pub

v1.1.0

Published

semantic-release plugin to publish a Dart or Flutter package

Downloads

17

Readme

semantic-release-pub

npm License GitHub Actions codecov Codacy Badge Code Style

Github-sponsors BuyMeACoffee Ko-Fi LiberaPay Patreon PayPal

semantic-release plugin to publish a Dart or Flutter package.

| Step | Description | | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | verifyConditions | Verify the presence of the GOOGLE_SERVICE_ACCOUNT_KEY environment variable, the ability to exchange an identity from the service account, and the dart or flutter executable. | | prepare | Update the pubspec.yaml version. | | publish | Publish the Dart or Flutter package to the registry. |

Installation

Install via npm:

npm install --save-dev semantic-release-pub

Or via yarn:

yarn add --dev semantic-release-pub

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer", 
    "@semantic-release/release-notes-generator", 
    "semantic-release-pub"
  ]
}

Configuration

pub.dev authentication

The following instructions are referenced from the documentation of Dart. Below are the key steps to allow authentication to pub.dev.

  1. Create a Google Cloud project, if you don’t have an existing project.

  2. Create a service account either through the Google Cloud Console under IAM and admin > Service accounts or as follow:

    gcloud iam service-accounts create pub-dev \
        --description='Service account to be impersonated when publishing to pub.dev' \
        --display-name='pub-dev'
  3. Grant the service account permission to publish your package.

    To complete this step, you must have uploader permission on the package or be an admin of the publisher that owns the package.

    1. Navigate to the Admin tab (pub.dev/packages//admin).
    2. Click Enable publishing with Google Cloud Service account.
    3. Type the email of the service account into the Service account email field.

      You created this account in the previous step: pub-dev@$PROJECT_ID.iam.gserviceaccount.com

  4. Create exported service account keys for the service account either through the Google Cloud Console under Service account actions > Manage keys > Add key > Create new key > JSON > Create or as follow:

    gcloud iam service-accounts keys create key-file.json \
        PROJECT_ID.iam.gserviceaccount.com
  5. Copy the content of the JSON key file and set it as an environment variable under GOOGLE_SERVICE_ACCOUNT_KEY.

Environment variables

| Variable | Description | | ---------------------------- | ------------------------------------------------------------ | | GOOGLE_SERVICE_ACCOUNT_KEY | The google service account key created from the above steps. |

Options

| Option | Description | Default | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | cli | The dart or flutter CLI to use to publish the package to the registry. | dart | | publishPub | Whether to publish the package to the registry. If set to false, the pubspec.yaml version will still be updated. | true | | updateBuildNumber | Whether to write build number for every newly bumped version in pubspec.yaml. Note that the build number will always be increased by one. Learn more on Flutter docs. | false |

Examples

Publishing a Flutter package

{
  "plugins": [
    "@semantic-release/commit-analyzer", 
    "@semantic-release/release-notes-generator", 
    [
      "semantic-release-pub",
      {
        "cli": "flutter"
      }
    ]
  ]
}

See here for a sample pull request utilising this plugin and semantic-release to publish a Flutter package.