prisma-labs / dripip

Opinionated CLI for continuous delivery of npm packages
100 stars 2 forks source link

Smoother brown field adoption #22

Closed jasonkuhrt closed 4 years ago

jasonkuhrt commented 4 years ago

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 <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "feat: pretty mode (#254)\n\ncloses #252",
          "chore(deps): update dependency husky to v4.0.4 (#253)\n\nCo-authored-by: WhiteSource Renovate <renovatebot@gmail.com>",
          "chore(deps): pin dependency @types/lodash to 4.14.149 (#245)\n\nCo-authored-by: WhiteSource Renovate <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "feat: logger (#244)",
          "chore(deps): update dependency husky to v4.0.1 (#240)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(deps): update dependency husky to v4 (#232)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(deps): update dependency ts-jest to v24.3.0 (#233)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "simple docs with docsify (#235)",
          "chore(deps): remove unused deps",
          "chore(deps): update dependency globby to v11 (#218)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(deps): update patch & minor dev dependencies (#217)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(renovate): remove packagePatterns",
          "chore: group renovate deps pr",
          "chore(deps): pin dependencies (#215)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "Configure Renovate (#214)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "feat: pretty mode (#254)\n\ncloses #252",
          "chore(deps): update dependency husky to v4.0.4 (#253)\n\nCo-authored-by: WhiteSource Renovate <renovatebot@gmail.com>",
          "chore(deps): pin dependency @types/lodash to 4.14.149 (#245)\n\nCo-authored-by: WhiteSource Renovate <renovatebot@gmail.com>",
          "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 <renovatebot@gmail.com>",
          "feat: logger (#244)",
          "chore(deps): update dependency husky to v4.0.1 (#240)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(deps): update dependency husky to v4 (#232)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(deps): update dependency ts-jest to v24.3.0 (#233)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "simple docs with docsify (#235)",
          "chore(deps): remove unused deps",
          "chore(deps): update dependency globby to v11 (#218)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(deps): update patch & minor dev dependencies (#217)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "chore(renovate): remove packagePatterns",
          "chore: group renovate deps pr",
          "chore(deps): pin dependencies (#215)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "Configure Renovate (#214)\n\nCo-authored-by: Renovate Bot <renovatebot@gmail.com>",
          "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",
jasonkuhrt commented 4 years ago

Conclusions have been resolved or tracked as their own issues.