Giter VIP home page Giter VIP logo

dripip's Introduction

ci/cd

dripip

Opinionated CLI for continuous delivery of npm packages.

Installation

npm install --save-dev dripip

Overview

diagram

Dripip is a command line interface (CLI) for continuously releasing npm packages. It has support for three kinds of releases: pull-request releases, canary releases, stable releases. It builds on top of Git, Semver, Conventional Commit, and GitHub. Support for alternative version control systems (e.g. Darcs) and platforms (e.g. GitLab) are not currently supported but they probably could be. The concepts of dripip are relatively general.

Continuous delivery means that every single meaningful commit to your library will be released. The benefit of this approach is that when you ship value your users get access to it immediately, and as an author you don't need to manage incoming queries like "when will this be released?". You get to to auto-reply: "It already it! :)".

Pull-Request Releases

Pull-request releases occur on, surprise, pull-requests. You can have CI run them or do them ad-hoc from your machine, either workflow is fine (but choose one, as mixing will naturally lead to already-published errors). These kinds of releases are useful when link workflows are not good enough. For example your feature is a CLI that you want to make sure plays well with npx. Unlike other release types pull-request releases do not result in git tags. Instead, Dripip uses the npm registry to maintain its release state. The version pattern of a pull-request release is:

0.0.0-pr.${pr_num}.${pr_release_num}.${short_sha}

For example:

0.0.0-pr.45.4.9a3b2c1

The 0.0.0 version is used because there is no meaningful semantic version to put here. It cannot be the version you're branching from since this version syntax would indicate it is a pre-release for that version, which it isn't, it's the opposite, a release after it; It cannot be the version you're going towards because it cannot be generally known if a PR will result in a patch minor or major semver change; Even if Dripip tried to apply conventional commit analysis to the PR commits it wouldn't account for concurrent PRs and the generally async nature that PRs live in with regard to one another. So ultimately 0.0.0 is the most sensible general choice.

The pr_num part is the pull-request number. The same one that you see on the GitHub UI, URL etc. of a pull-request.

The pr_release_num is a monotonically increasing 1-based (starts from 1, not 0) integer. It serves a few purposes. It provides orientation for humans at a glance, like how many releases has a PR had or where does a given release fall within the PR release set. Its functional purpose is to support correct lexical sorting. Without this little number it would be impossible to sort PR releases without some kind of additional metadata e.g. publish time. Thanks to this, when you run e.g. npm versions, you get an accurate ordering.

The short_sha is what you see next to commits in much of the GitHub UI, including PR pages. Its primary purpose is to make it easy for you to tie a release back to something in your Git history. For example when looking at a PR page you can copy-paste the sha into search to find the exact commit for that release. Whatever the particular, this is just a convenient piece of information for you. Ultimately we developers practice many a crude workflow, habits (console.log vs debugger anyone?).

When Dripip makes a pr release, it includes an upsert of a dist-tag of pattern pr.${pr_num}. This makes it very easy to install the latest published version for a given pull-request.

Canary Releases

Canary releases occur on trunk branches. These releases should be automated by your CI. They give your users access to what your stable version will become. The version pattern of a canary release is:

${next_stable}-next.${series_release_num}

For example:

1.2.0-next.4

The next_stable is whatever your upcoming stable version will be. The series_release_num is a monotonically increasing 1-based (starts from 1, not 0) integer. The first canary release after a stable release starts at 1, increasing by 1 at each canary release, until a stable is cut at which point the numbering is reset upon the next canary release.

When Dripip makes a canary release, it includes an upsert of a dist-tag called next. This makes it very easy to install the bleeding edge of your package. Additionally, a git tag called next is also maintained. Whatever commit the next tag is on is the same instance of your package that would be installed if a user did npm install <your package>@next.

Stable Releases

Stable releases occur on trunk branches. The version pattern of a stable release is just a regular version, whatever the next stable is:

${next_stable}

For example:

1.2.0

These releases should be managed however your team works, of course, but here are some general tips:

  • Think very carefully before automating stable releases. You need to have very very high confidence in your/your team's git commit message practices to take this route. One wrong BREAKING CHANGE line can be all it takes to make an accidental major release that npm won't allow you to undo (unless you catch very quickly).
  • Releases on a cadence, such as every week or two, either manually or by automation, is often a good way to go.
  • Do not publish stables too often. It dillutes their meaningfulness and creates churn for users of tools like Renovate and Dependabot. Its probably better for your users to get one semi-exciting PR to update their dep on your package once every week or two than once a day! This approach also plays better with the GitHub releases UI where only a handful of releases are rendered for every page and even less visible without scrolling.

When Dripip makes a canary release, it includes an upsert of a dist-tag called latest. This is actually what npm already does by default. Dripip does not deviate here.

Package.json Version Field

Typically when an npm package is released its package.json version field will be updated and committed into version control. This is a bad match for continuous delivery however, because it means that, more or less, half of the git history will become meta commits. To solve this, dripip takes a novel approach of keeping the version out of version control. It uses Git tags to store that state, and when publishing your package, will set the package.json version field right before publishing, and then unset it right after publishing completes. You notice nothing, your users notice nothing, and your git history looks ideal. This is unorthodox, but it works well.

Having a valid semver value in the version field is required by npm. Dripip puts the following value into your project's package.json to satisfy that constraint. This is what you should check into version control.

0.0.0-dripip

Release Notes (aka. Changelogs)

Dripip generates release notes for canary and stable releases. Notes are published within GitHub releases. Canary release notes are published under the next tag. Stable release notes are published under its respective version tag. Stable release notes are stable, while Canary release notes are always changing. When a stable release is cut, the canary release notes are cleared since next becomes the same as stable, until the next Canary is published.

Because the canary release notes have a stable tag, it means you and your uses can always check out what's coming in the next stable version by visiting:

https://github.com/<org>/<repo>/releases/tag/next

For example checkout what's coming up in dripip right now by visiting https://github.com/prisma-labs/dripip/releases/tag/next.

Recipes

Usage inside GitHub Actions

There is a Dripip GitHub action.

It has these prerequisites:

  1. Have dripip installed as a dev dependency
  2. Upload an NPM_TOKEN to your repo (gh docs)

It can be used like this:

name: trunk
on:
  push:
    branches: [main]
jobs:
  release-canary:
    runs-on: ubuntu-latest
    steps:
      - uses: prisma-labs/dripip@master
        with:
          npmToken: ${{secrets.NPM_TOKEN}}
          githubToken: ${{secrets.DRIPIP_GITHUB_TOKEN}}

If the action does not work for your use-case please open an issue about what your needs are. Meanwhile look at the action.yml source and inline a variant of it that works in your own GitHub workflow.

Auditable and Sharable Stable Releases

A nice way to do stable releases is use GitHub workflow dispatch. This keeps stable releases manual but moves the usage onto GitHub actions via Workflow Dispatch UI. This has the following benefits:

  1. Anyone on your team can cut a stable release without need for working local setup.
  2. Every stable release has an auditable CI run associated to it.

It can be done like this:

# .github/workflows/release.yml
name: Release
on: workflow_dispatch
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: prisma-labs/dripip@master
        with:
          isStable: true
          npmToken: ${{secrets.NPM_TOKEN}}
          githubToken: ${{secrets.DRIPIP_GITHUB_TOKEN}}

CLI

dripip get-current-commit-version

USAGE
  $ dripip get-current-commit-version

OPTIONS
  -r, --optional  Exit 0 if a version for the commit cannot be found

See code: dist/cli/commands/get-current-commit-version.ts

dripip get-current-pr-num

USAGE
  $ dripip get-current-pr-num

OPTIONS
  -r, --optional  Exit 0 if a pr number cannot be found for whatever reason

See code: dist/cli/commands/get-current-pr-num.ts

dripip help [COMMAND]

display help for dripip

USAGE
  $ dripip help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

dripip log

USAGE
  $ dripip log

OPTIONS
  -j, --json      format output as JSON
  -m, --markdown  format output as Markdown

See code: dist/cli/commands/log.ts

dripip pr

USAGE
  $ dripip pr

OPTIONS
  -d, --dry-run  output what the next version would be if released now
  -j, --json     format output as JSON

dripip preview

USAGE
  $ dripip preview

OPTIONS
  -d, --dry-run              output what the next version would be if released now
  -j, --json                 format output as JSON
  -n, --build-num=build-num  Force a build number. Should not be needed generally. For exceptional cases.
  --skip-npm                 skip the step of publishing the package to npm

  --trunk=trunk              State which branch is trunk. Defaults to honoring the "base" branch setting in the GitHub
                             repo settings.

dripip preview-or-pr

USAGE
  $ dripip preview-or-pr

See code: dist/cli/commands/preview-or-pr.ts

dripip stable

USAGE
  $ dripip stable

OPTIONS
  -d, --dry-run  output what the next version would be if released now
  -j, --json     format output as JSON
  --skip-npm     skip the step of publishing the package to npm

  --trunk=trunk  State which branch is trunk. Defaults to honoring the "base" branch setting in the GitHub repo
                 settings.

dripip's People

Contributors

dependabot[bot] avatar jasonkuhrt avatar jsoref avatar renovate[bot] 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dripip's Issues

Richer context rendering

When for example pre-flight checks fail on preview release the user gets back something like:

      " �[31m›�[39m   Error: You cannot make a preview release for this commit because a preview 
       �[31m›�[39m   release was already made.
       �[31m›�[39m
       �[31m›�[39m        The commit is:           c14cc64
       �[31m›�[39m        The stable release is:   N/A
       �[31m›�[39m        The preview release is:  1.2.3-next.1
       �[31m›�[39m        Other tags present:      N/A

While ok, it would be a lot nicer if they were shown a cropping of the git tree.

Tags not updated because remote changed

Description

We moved nexus-prisma to the graphql-nexus. When using dripip stable, git crashed because of the following error:

image

Result: latest and next tag weren't updated

I'm not sure what we can do about it, but thought it was still worth mentioning

Handling GITHUB_TOKEN now with changelog support

What

Support 2FA

Tried to use this on Nexus at one point, and was unable to publish because I have 2FA on my npm account. Happy to submit a patch for it, if you have any pointers of where this change should be made that'd be super helpful.

incorrect next stable calc

repro:

  1. git checkout master
  2. gc --am "foobar" --allow-empty
  3. yarn build
  4. node dist/main preview --dry-run

Should be 0.2.9 but is 0.2.8.

❯ node dist/main preview --dry-run
{"kind":"ok","type":"dry_run","data":{"currentStable":"0.2.7","currentPreviewNumber":1,"nextStable":"0.2.8","nextPreviewNumber":2,"currentVersion":"0.2.8-next.1","nextVersion":"0.2.8-next.2","commitsInRelease":["test"],"bumpType":"patch","isFirstVer":false,"isFirstVerStable":false,"isFirstVerPreRelease":false}}

~/projects/prisma-labs/dripip master ⇡
❯ glog
* cdb9fb5 (HEAD -> master) test
* db89270 (tag: next, tag: 0.2.8-next.1, origin/master, origin/HEAD) refactor: remove semver dep (#17)
*   3adacf4 Merge branch 'master' of github.com:prisma-labs/dripip
|\
| * 6e649f7 refactor: release series concept (#16)
* | 078efa6 chore: fix tests
* | 7b727eb (origin/feat/foo-37571159528463616) tests: cover bump func
|/
* 370e75c begin unit tests
* 916ff2a chore: ignore vscode file
* 02089fa (tag: latest, tag: 0.2.8) fix: find latest stable releases
* 29e76b7 (tag: 0.2.0) fix: proper application of bump type
* 9fef5b2 (tag: 0.2.7) feat: rename project to dripip
* 5a76f62 (tag: 0.1.7) fix: fake work to try publish
* e34502d (tag: 0.1.6) fix: publish stable with git tags set
* 81e2109 (tag: 0.1.5) fix: cleanly update remote tag updates when publishing
* 455bc82 (tag: 0.1.4) fix: await promises while publishing stable
* 9856355 (tag: 0.1.3) fix: no race on dist-tag add on stable release
* 013a28d (tag: 0.1.2) fix: dist-tag invocation on stable release again
* da8cac8 (tag: 0.1.1) fix: dist-tag invocation on stable release
* 5dd4866 (tag: 0.1.0) chore: fix build script
* 69dd5ce chore: build using tsc
* 1aecc20 deps: update all to latest
* 77f24b5 feat: stable release command (#12)
* 740a43f chore: remove unused identifier
* 02df093 (tag: 0.1.0-next.4) fix: force push next tag
* f5e2846 (tag: 0.1.0-next.3) fix: return after stable publishing
* 14ee784 (tag: 0.1.0-next.2) fix: await package.json read
* 42310bc (tag: 0.1.0-next.1) feat: publish stable preview
* 0830d20 feat: opt-in output json (#10)
* 5af4544 feat: calculate next preview ver (#9)
* d181c70 feat: guard no preview on not pr or trunk
* 1d1bd5a feat: detect if current branch is a pr (#7)
* a04b353 feat: better feedback on failed preview pre-flight
* 1a3a18f deps: update all to latest
* b77dc05 refactor: higher level tests helper
* 7b206e7 refactor(tests): helpers into lib
* 634e276 refactor: co-locate export
* 188566f tests: refactor with new workspace module
* b1f26c7 feat(preview): preflight assert not already released (#4)
* b99354d feature: scaffold cli (#2)
* 9bae56c Initial commit

Support publishing public npm-scoped packages

When publishing a npm-scoped package it will fail unless:

  1. User is setup to publish prviate npm-scoped packages
  2. User passes --access public flag to npm publish

It seems that the private field in package.json has no effect on this behaviour.

Once a package has been published at least once, the --access flag is no longer needed. Thus we can treat this as a bootstrapping issue.

Optionally force a build num

What

  • $ dripip preview --build 54 would force x.x.x-next.54

Why

  • Give flexibility
  • Say there is a bug with release system, either error on us or them, they may need an escape hatch to force some logic to "get back on track"

Related

  • Use case first came up in #22

Changelog is not posted

Description

Second time that I use dripip to release a stable and that the changelog is not posted. Here's the error:

Error: Failed to publish changelog
RequestError [HttpError]: Not Found
    at ~/projects/prisma/nexus-plugin-prisma/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  name: 'HttpError',
  status: 404,
  headers: {
    'access-control-allow-origin': '*',
    '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',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Mon, 11 May 2020 16:33:00 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    status: '404 Not Found',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'transfer-encoding': 'chunked',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': '2904:41157:65AF117:759CD4B:5EB97E3C',
    'x-ratelimit-limit': '60',
    'x-ratelimit-remaining': '58',
    'x-ratelimit-reset': '1589218380',
    'x-xss-protection': '1; mode=block'
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/graphql-nexus/plugin-prisma/releases',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/17.0.0 octokit-core.js/2.4.2 Node.js/12.13.1 (macOS Catalina; x64)',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"prerelease":false,"tag_name":"0.8.0","draft":false,"body":"#### BREAKING CHANGES//n//n- 37c3bd9 support prisma 2 beta 4 (#111)//n- b8677cd support prisma 2 beta 3 (#109)//n- c0d702e allow passing a

conventional commit parser support for \r\n

Note in the following how raw failed to get parsed.

❯ yarn -s release:preview --dry-run | jq
{
  "kind": "ok",
  "type": "dry_run",
  "data": {
    "bumpType": "patch",
    "version": "0.4.1-next.1",
    "commits": [
      {
        "raw": "feat: model initial dev semantic (#32)\n\ncloses #31\r\n\r\nBased on ideas being slowly discussed at spec level here:\r\nconventional-commits/conventionalcommits.org#214\r\n\r\nBREAKING CHANGE:\r\n* To go from 0.x to 1.x it is now required to use the special keyphrase:\r\n\r\n    COMPLETES INITIAL DEVELOPMENT",
        "parsed": null
      },
      {
        "raw": "fix: spec compliant breaking-change parse",
        "parsed": {
          "type": "fix",
          "scope": null,
          "description": "spec compliant breaking-change parse",
          "body": null,
          "footers": [],
          "breakingChange": null,
          "completesInitialDevelopment": false
        }
      }
    ]
  }
}

Smoother brown field adoption

It is not obvious how to adopt dripip on brownfield projects.

Here's how it played out on graphql-santa:

  1. yarn add --dev dripip

  2. When was the last release?

  3. What would happen now? yarn dripip preview --dry-run

    ❯ yarn -s dripip preview --dry-run | jq
    {
      "kind": "ok",
      "type": "dry_run",
      "data": {
        "currentStable": "v0.1.0",
        "currentPreviewNumber": null,
        "nextStable": "0.2.0",
        "nextPreviewNumber": 1,
        "currentVersion": "v0.1.0",
        "nextVersion": "0.2.0-next.1",
        "commitsInRelease": [
          "docs: improvements\n\n- restructure navbar groupings and section titles\n- bring back guides content\n- introduce getting started group\n- add roadmap section\n- add npx prompt to cover page",
          "chore(deps): update dependency husky to v4.0.8 (#277)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "refactor: rename tsx to ts and remove `jsx` from tsconfig.json",
          "docs: scroll to top on docs page change (#271)",
          "docs(dev): add code architecture",
          "docs: learn section",
          "fix: command rendering glitch (#266)",
          "chore: remove ink",
          "Remove dev ui (fixes #222, #202)",
          "refactor: rename setupTest to createTestContext",
          "feat: add `setupTest` for easy testing (#243)",
          "docs: improvements\n\n- styling\n- logger component features\n- logger component future feature issue links",
          "docs: link components to gh issues",
          "docs: nav style and content",
          "chore(deps): update dependency husky to v4.0.7 (#262)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "docs: move readme contents to website",
          "docs: simplify navigation",
          "docs: explain logging component",
          "docs: add cover to website (#259)",
          "chore(deps): update dependency husky to v4.0.6 (#256)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "improve: log pretty rendering (#257)",
          "tests: refactor and cover pretty format",
          "docs: add logger changes",
          "chore(deps): update dependency husky to v4.0.5 (#255)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "feat: pretty mode (#254)\n\ncloses #252",
          "chore(deps): update dependency husky to v4.0.4 (#253)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "chore(deps): pin dependency @types/lodash to 4.14.149 (#245)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "feat: context logger (#249)\n\ncloses #248",
          "docs: add logger to api ref",
          "chore(deps): update dependency husky to v4.0.3 (#246)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "feat: logger (#244)",
          "chore(deps): update dependency husky to v4.0.1 (#240)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(deps): update dependency husky to v4 (#232)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(deps): update dependency ts-jest to v24.3.0 (#233)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "simple docs with docsify (#235)",
          "chore(deps): remove unused deps",
          "chore(deps): update dependency globby to v11 (#218)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(deps): update patch & minor dev dependencies (#217)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(renovate): remove packagePatterns",
          "chore: group renovate deps pr",
          "chore(deps): pin dependencies (#215)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "Configure Renovate (#214)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "docs: build toc",
          "docs: add links and videos section",
          "docs: fix video link",
          "docs: embed video (#203)\n\ncloses #190",
          "v0.1.2",
          "fix: scaffold santa with carrot pin",
          "v0.1.1",
          "fix: scaffold prisma with latest stable ver"
        ],
        "bumpType": "minor",
        "isFirstVer": false,
        "isFirstVerStable": false,
        "isFirstVerPreRelease": true
      }
    }
    
  4. Nope, not what I want

  5. I have a few releases on GH https://github.com/prisma-labs/graphql-santa/releases

    image

  6. I want to count the last release on GH as the last stable, which is 41eb093 which is:

    * 41eb093 (tag: v0.1.2) v0.1.2
    
  7. Why didn't v0.1.2 (insider knowledge) get picked up? Because of v prefix?

  8. Try git tag -a 0.1.2 v0.1.2 and see if it gets picked up? No

  9. Actually, it is picking up a tag, v0.1.0

    ...
    * bf7b08a docs: embed video (#203)
    * 41eb093 (tag: v0.1.2, tag: 0.1.2) v0.1.2
    * 740977c fix: scaffold santa with carrot pin
    * 9672b03 (tag: v0.1.1) v0.1.1
    * 7988ca8 fix: scaffold prisma with latest stable ver
    * 370f35e chore: fix publish script
    * 0a1cf73 (tag: v0.1.0) v0.1.0
    
  10. Looks like a bug, ... ah not using next which does have a bug fix (goes and publishes a stable release on dripip)

  11. Try again yarn add --dev dripip and this time things look right:

    ❯ yarn -s dripip preview --dry-run | jq
    {
      "kind": "ok",
      "type": "dry_run",
      "data": {
        "currentStable": "0.1.2",
        "currentPreviewNumber": null,
        "nextStable": "0.2.0",
        "nextPreviewNumber": 1,
        "currentVersion": "0.1.2",
        "nextVersion": "0.2.0-next.1",
        "commitsInRelease": [
          "docs: improvements\n\n- restructure navbar groupings and section titles\n- bring back guides content\n- introduce getting started group\n- add roadmap section\n- add npx prompt to cover page",
          "chore(deps): update dependency husky to v4.0.8 (#277)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "refactor: rename tsx to ts and remove `jsx` from tsconfig.json",
          "docs: scroll to top on docs page change (#271)",
          "docs(dev): add code architecture",
          "docs: learn section",
          "fix: command rendering glitch (#266)",
          "chore: remove ink",
          "Remove dev ui (fixes #222, #202)",
          "refactor: rename setupTest to createTestContext",
          "feat: add `setupTest` for easy testing (#243)",
          "docs: improvements\n\n- styling\n- logger component features\n- logger component future feature issue links",
          "docs: link components to gh issues",
          "docs: nav style and content",
          "chore(deps): update dependency husky to v4.0.7 (#262)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "docs: move readme contents to website",
          "docs: simplify navigation",
          "docs: explain logging component",
          "docs: add cover to website (#259)",
          "chore(deps): update dependency husky to v4.0.6 (#256)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "improve: log pretty rendering (#257)",
          "tests: refactor and cover pretty format",
          "docs: add logger changes",
          "chore(deps): update dependency husky to v4.0.5 (#255)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "feat: pretty mode (#254)\n\ncloses #252",
          "chore(deps): update dependency husky to v4.0.4 (#253)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "chore(deps): pin dependency @types/lodash to 4.14.149 (#245)\n\nCo-authored-by: WhiteSource Renovate <[email protected]>",
          "feat: context logger (#249)\n\ncloses #248",
          "docs: add logger to api ref",
          "chore(deps): update dependency husky to v4.0.3 (#246)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "feat: logger (#244)",
          "chore(deps): update dependency husky to v4.0.1 (#240)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(deps): update dependency husky to v4 (#232)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(deps): update dependency ts-jest to v24.3.0 (#233)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "simple docs with docsify (#235)",
          "chore(deps): remove unused deps",
          "chore(deps): update dependency globby to v11 (#218)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(deps): update patch & minor dev dependencies (#217)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "chore(renovate): remove packagePatterns",
          "chore: group renovate deps pr",
          "chore(deps): pin dependencies (#215)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "Configure Renovate (#214)\n\nCo-authored-by: Renovate Bot <[email protected]>",
          "docs: build toc",
          "docs: add links and videos section",
          "docs: fix video link",
          "docs: embed video (#203)\n\ncloses #190"
        ],
        "bumpType": "minor",
        "isFirstVer": false,
        "isFirstVerStable": false,
        "isFirstVerPreRelease": true
      }
    }
    
  12. Let's go for it yarn -s dripip preview

  13. oh no npm ERR! 401 Unauthorized - PUT https://registry.yarnpkg.com/graphql-santa - You must be logged in to publish packages.

  14. because running in yarn context prevents npm registry access...

  15. try workaround node_modules/.bin/dripip preview

  16. Something got published last time after all... huh... confused npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/graphql-santa - You cannot publish over the previously published versions: 0.2.0-next.1

  17. I need to force the next version artificially as there is no way to republish a package ver on npm https://docs.npmjs.com/unpublishing-packages-from-the-registry. The dripip cli doesn't have that feature yet so I need to manually edit the git history... luckily there is a commit I don't care about and can toss a tag on it, but that is pure luck...

    * bf7b08a docs: embed video (#203)
    * 41eb093 (tag: v0.1.2, tag: 0.1.2) v0.1.2
    
  18. git tag -a 0.2.0-next.1 bf7b08a and dry-run looks good again...

  19. Finally worked!

    ❯ node_modules/.bin/dripip preview               
    updated package.json in prep for publishing
    published package to the npm registry
    reverted package.json changes now that publishing is done
    tagged this commit with 0.2.0-next.2
    pushed tag to remote
    updated git-tag "next"
    

Conclusions

  1. feature: support to publish via yarn

  2. feature: cli flag on preview to force a build num

  3. feature: prompt to add release scripts:

    	"release:preview": "dripip preview",
    	"release:stable": "dripip stable",

Changelog formatting improvements

See manual edits that were made here:

https://github.com/graphql-nexus/schema/releases/tag/v0.18.0

  1. Breaking changes line break between each item
  2. Breaking changes titlecased (not all caps)
  3. Two line breaks between breaking changes and rest of sections
  4. Breaking changes sections have titleized level-4 headings
  5. All headings brought up one level to support (3)
  6. Breaking changes headings have pr/commit info on next line, instead of inline
  7. Arrow between pr/commit info
  8. Rest of sections get new title "All Changes"
  9. Improvements section strips "improve:" conventional commit commit type prefix

dripip github action

https://help.github.com/en/actions/building-actions/creating-a-javascript-action

Instead of this:

      - name: Make release
        id: release
        env:
          NPM_TOKEN: ${{secrets.NPM_TOKEN}}
        run: |
          yarn -s dripip preview --json > result.json
          result=$(cat result.json)
          echo '==> Publish Result'
          jq '.' <<< $result
      - name: Save publish result
        uses: actions/upload-artifact@v1
        with:
          name: published
          path: result.json

This

- uses: prisma-labs/dripip
  with:
    npm_token: ${{ secrets.NPM_TOKEN }}    

For handling the artifacts part, refer to this issue which mentions more actions/upload-artifact#62.

stable preview release

Tackle the spec laid out for libre preview at prisma-labs/team#2.

Take the minimal approach to get one vertical working.

Upon completing this issue it should be possible to publish 0.1.0-next.1 of this project.

Support publishing as yarn scripts

What

  • Currently, when trying to publish as yarn scripts npm registry authentication fails

       "scripts": {
         "release:stable": "node dist/main stable",
         "release:preview": "node dist/main preview",

    image

How

  • Not clear what resolution will be. Maybe one of:

    • Internal code changes that make this work
    • Documentation about how user needs to configure their yarn/npm/login credentials/something... (if this, then a doctor check for it too)
    • wontfix worst case if turns out impossible (if this, then docs mentioning it at least)

Introduce term "canary"

What

  • Feedback from @schickling
  • An alternative to next term currently used
    • npm dist tags
    • git tags
    • changelogs (since they mirror git tags)

Why

  • canaray is the term used for preview releases by the Chrome team and the NextJS team, among others
  • next is a very generic word
  • next makes talking about the subject more difficult
    • "Next releases are..."
    • "Upon next next release, please..."
    • "Canary releases are..."
    • "Upon next canary release, please..."

How

  • Need to allow existing users to migrate smoothly
  • Need to support next term as legacy read-only, using canaray to "write-forward"
  • After a few versions We can disable this behaviour

Find a better name

It is not nice to have the package and CLI name be different. Also I am still not super enthusiastic generally about the name libre.

Brainstorm kickoff:

@prisma-labs/release    $ release stable|preview 

command to get ver of current commit

What

  • $ dripip get-current-commit-version

Why

  • version for a commit is not stored in source
  • version for a pr commit is not stored in git
  • because getting version info varies it adds cognitive load, user confusion
  • in CI knowing the version can be import, example:
    • after pr publish, run system tests against that version
    • e2e tests need to know what version was published
  • in CI getting the version number from the publish command output to the e2e test invocation can be actually surprisingly difficult
    • pipeline publishes once then runs systems tests across matrix of node versions, platforms, etc.
    • this leads to publish and test being different jobs
    • sharing data between jobs in ci pipeline is often non-trivial (not super hard but requires thinking, often knowledge/trial-error based where getting a detail wrong doesn't provide clear "error feedback" etc.

Allow chore-like commit type definition

Problem

Solution

  • allow project to define custom chore-like types
  • in package.json { dripip: { chores: { types: ["website"], scopes: ["website"] }}
  • so commits like following would be chores: website(docs): ... and docs(website): ...
  • like chore, chore-like types will never trigger package publishing
  • if the cicd pipeline cannot branch on this (meaning some job is never even run) logic then having dripip support it is nice (job runs, but is noop)

support monorepos

What

  • We currently assume the git history will be associated with one "thing"
  • This is incompatible with monorepos

Why

  • Monorepos are often useful
  • For Labs team there is also an idea from @schickling to create a monorepo to house both nexus-schema-plugin-prisma and nexus-plugin-prisma, bringing the use-case to our daily work

How

  • monorepo members (packages, microservices, whatever it is) need to have unique names, possibly aliased, for shorthands, which would be used as prefixes to commit subject lines
  • it would be essential that ALL git commits prefix with the member the commit is associated with
  • some prefix syntax that works nicely with conventional commit should be chosen, e.g. <package> / <conventional commit>
  • with this in place, dripip, when run inside a monorepo member, can create a "series" as it normally would, filtering out all commits for other members
  • github releases will need a prefix system too
  • do we need to support commits that would apply to multiple monorepo members? If so this adds complexity
    • <package 1>+<package 2>+<package 3> / <conventional commit>?
    • We could introduce dripip commit command that would use git diff to prefix the git subject line with the correct member name? Assumes there would never be code shared by two members outside the member directories...

Command to cleanup pr releases

What

When a PR is closed, merged or not, the releases made, if any, for commits in that PR, and the PR dist-tag itself, if any, should be cleaned up.

How

With $ dripip get-version-for-commit we already know how to fetch all the releases for a given PR. What's needed is new logic that would iterate through each found version, deprecating it on the npm registry.

Why

PR releases can add a lot of pre-release versions to a package history. They are useful for agile reasons but they are not interesting long-term. As such, if left unchecked, they stand to add significant noise to the package version history, making it harder to review it.

Also, if left unchecked, the results from npm view <package> <versions>, which lists ALL versions of a package EVER, will grow larger much faster, potentially creating latency or other problems with flows relying on this information, dripip certainly but also other tools, if any.

log command

What

  • abiliy to print the current stable series as markdown
  • abiliy to print the current stable series as json

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Command to scaffold project scripts

What

  • command to scaffold this pattern in user's project:

     "release:stable": "dripip stable",
     "release:preview": "dripip preview"

Related

  • Original use-case discovered in #22

in-repo changelogs

Some people like to keep release notes in the repo.

To do so generally means a release note update commit for every commit on trunk (aka. 50% git history noise) since dripip is designed for making a canary release for every trunk commit.

Dripip should make that possible though for those that want this tradeoff. They have the following options to be specific:

  • accept 50% git history noise
  • don't make canary releases
  • don't update the release notes on canary releases

I can't think of any other ways to trade things off.

mark commits as fixing something within series

Perceived Problem

  • Sometimes fixes are pushed that address bugs within a series
  • When generating the final changelog, these commits should not be included
  • Since they don't fix anything from the previous stable release, but only within the pre-releases of the series
  • Meaning that from a stable-using user point of view, nothing was fixed, and this is just confusing noise to have in the changelog

Solutions

  • Support a new conventional commit custom footer

     fix: blah
     
     series fix: true
    
  • Support new fix type:

     fix-series: blah
    

    or maybe one word:

     fix-series: blah
    
  • Maybe a raw imperative statement to remove anything from the changelog:

     fix: blah
     
     changelog: no
    

Integrate with GH releases

What

image

How

  • Stable releases should be GH releases
  • Titled by the next version e.g. 1.2.0
  • Preview releases should be a next GH pre-release
    • if next release exists (it always will except for the first release ever) then edit it in place. Because this issue is not about the release contents, it means there may be nothing to do for this point. Simply force updating which commit the next tag points to may be enough to update the next release as outlined here.

References

sdk

Right now the CLI has a layer of logic that integrates lower level components. We need the cli to be further abstracted, calling only into an sdk. This SDK would be what #57 for example would be built on.

--skip-npm flag

use-case

  • Sometimes publish works but git push fails. Example #35
  • Want to redo but skip the npm publish part

Scaffold project

  • help command
  • help flag
  • version command
  • version flag
  • default command is help
  • oclif
  • test setup
  • published on npm as librelibre 0.1.0-next.1

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.