Git Product home page Git Product logo

create-rwjblue-release-it-setup's Introduction

create-rwjblue-release-it-setup

Simple npm init / yarn create bin package to add release-it setup used by rwjblue.

This will do the following:

  • add release-it config to the package.json
  • install required dependencies,
  • add a CHANGELOG.md
  • add a RELEASE.md
  • update your repository's labels with my "go to" defaults

Usage

Prerequisites

  1. Obtain a GitHub personal access token.
  2. Make sure the token is available as the GITHUB_AUTH environment variable. For instance:
export GITHUB_AUTH=abc123def456

Freshly Configuring a Repo

When you want to set up a repo with release-it, you can run:

# in a yarn repo
yarn create rwjblue-release-it-setup

# in an npm repo
npm init rwjblue-release-it-setup

Updating an Already Configured Repo

If you'd like to update an existing repo to use the latest and greatest setup, you can run:

# in a yarn repo
yarn create rwjblue-release-it-setup --update

# in an npm repo
npm init rwjblue-release-it-setup --update

Only Sync Labels

If you'd like to run only the label sync, you can do that with:

# in a yarn repo
yarn create rwjblue-release-it-setup --labels-only

# in an npm repo
npm init rwjblue-release-it-setup --labels-only

License

This project is licensed under the MIT License.

create-rwjblue-release-it-setup's People

Contributors

buschtoens avatar dependabot-preview[bot] avatar dependabot[bot] avatar hjdivad avatar jelhan avatar robbiethewagner avatar rwjblue avatar scalvert avatar sergeastapov avatar simonihmig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

create-rwjblue-release-it-setup's Issues

Ensure repository URL is set in package.json

If the repository URL is not correctly set in package.json, release-it isn't able to correctly infer the changelog/release notes for a release. Let's check to make sure it's set when creating this configuration. We can likely auto-populate it via:

git config --get remote.origin.url

Setup CI based publishing

In order to prevent accidental issues with publishing we should avoid publishing from developer machines (see this example).

In order to do this we should:

Add progress reporting.

Since we do a github-label-sync and npm install internally there is a decent amount of time where we are just waiting. We should bring in ora to provide a reasonable console experience.

Errors when running against an unpublished repo

I wanted to set up the config on a new repo, and this script threw some errors, likely because there is no GitHub repo on NPM package for it yet. Because of the errors, I'm not certain that the setup actually succeeded or if it's fine but just complained about the lack of remote repo/package info.

Commands Run:
ember addon foo --yarn
cd foo
npx create-rwjblue-release-it-setup

CLI output:

npx: installed 154 in 6.467s
[HttpError: Not Found] {
  message: 'Not Found',
  statusCode: 404,
  headers: {
    date: 'Tue, 05 May 2020 23:27:41 GMT',
    'content-type': 'application/json; charset=utf-8',
    'content-length': '88',
    connection: 'close',
    server: 'GitHub.com',
    status: '404 Not Found',
    'x-ratelimit-limit': '5000',
    'x-ratelimit-remaining': '4999',
    'x-ratelimit-reset': '1588724861',
    'x-oauth-scopes': 'repo',
    'x-accepted-oauth-scopes': 'repo',
    'x-github-media-type': 'github.v3; param=symmetra-preview; format=json',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
    'access-control-allow-origin': '*',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'x-frame-options': 'deny',
    'x-content-type-options': 'nosniff',
    'x-xss-protection': '1; mode=block',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    'content-security-policy': "default-src 'none'",
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-github-request-id': 'CE19:DAE8:32B4CEF:3B17B1E:5EB1F66C'
  },
  body: {
    message: 'Not Found',
    documentation_url: 'https://developer.github.com/v3/repos/#get'
  },
  method: 'GET',
  endpoint: '/repos/null/labels'
}
(node:56257) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:56257) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Automatically create the GitHub Release via GitHub Actions

Instead of creating the release locally (during release-it's pipeline), we should create a .github/workflows/release.yml that effectively does:

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
  release:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          bodyPath: ./somepath.md
          draft: false
          prerelease: false

This helps reduce the extra setup requirements (having a $GITHUB_AUTH).

Install release-it globally

First of all, nice repo! :)

I saw a step in the release process saying "install release-it globally", and I traced it down to this repository. But I wonder whether this is the best option?

Generally it's good practice to add release-it to the devDependencies, so it will also automatically receive updates. Also, it's one manual step less in this process.

This could all be automated from the script in this repo, only the command to release would change from release-it to e.g. npm run release (or yarn release).

What do you think?

unhandled rejection when running in npm repo

Thank you for this pro tip.

  1. git clone https://github.com/adopted-ember-addons/ember-page-title.git && cd ember-page-title
  2. run npm init rwjblue-release-it-setup

It works but I noticed the following printed to my terminal:

(node:7098) UnhandledPromiseRejectionWarning
(node:7098) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7098) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Check for ember-cli-release and remove it.

ember-cli-release depends on a very old version of npm (3.x) and needs to be removed if we want folks to run npm run release or yarn release (otherwise release-it gets the wrong npm and blows up).

Error: Cannot find module 'unist-util-stringify-position'

Running yarn create rwjblue-release-it-setup is throwing an error for me:

success Installed "[email protected]" with binaries:
      - create-rwjblue-release-it-setup
internal/modules/cjs/loader.js:1032
  throw err;
  ^

Error: Cannot find module 'unist-util-stringify-position'
Require stack:
- /Users/rwwagner90/.config/yarn/global/node_modules/mdast-util-from-markdown/dist/index.js
- /Users/rwwagner90/.config/yarn/global/node_modules/mdast-util-from-markdown/index.js
- /Users/rwwagner90/.config/yarn/global/node_modules/create-rwjblue-release-it-setup/bin/rwjblue-release-it-setup.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
    at Function.Module._load (internal/modules/cjs/loader.js:898:27)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/Users/rwwagner90/.config/yarn/global/node_modules/mdast-util-from-markdown/dist/index.js:16:25)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/rwwagner90/.config/yarn/global/node_modules/mdast-util-from-markdown/dist/index.js',
    '/Users/rwwagner90/.config/yarn/global/node_modules/mdast-util-from-markdown/index.js',
    '/Users/rwwagner90/.config/yarn/global/node_modules/create-rwjblue-release-it-setup/bin/rwjblue-release-it-setup.js'
  ]
}
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-rwjblue-release-it-setup
Arguments: --labels-only
Directory: /Users/rwwagner90/shipshape/ember-array-utils
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

Dynamically set `launchEditor` based on existence of $EDITOR

We should do the same check that release-it-lerna-changelog does when launchEditor is true to see if the user already has an editor set up. If they don't, we should default this config to false and then output a message to the user that tells them why we think this option is useful and how they can set it up.

Avoid downgrading `release-it` or `release-it-lerna-changelog` versions.

When npm init rwjblue-release-it-setup is ran but the repo already has more recent versions of release-it and/or release-it-lerna-changelog than this package would normally setup we currently downgrade.

We should check the existing devDepencencies in the host project and choose the "highest semver compatible" version of both release-it and release-it-lerna-changelog.

Use `@release-it-plugins/workspaces`

I believe in a monorepo setup this should now start to use the newer @release-it-plugins/workspaces instead of release-it-yarn-workspaces, right?

Improve new user experience with release script

Add

"scripts": {
    "release": "release-it"
  },

And in readme, add instructions for running release:

yarn release --minor
-or-
npm run release --minor

Also add a .release-it.js file with the recommended defaults for ember apps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.