diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000..e5b6d8d --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..4211287 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://unpkg.com/@changesets/config/schema.json", + "changelog": [ + "@changesets/changelog-github", + { + "repo": "prettier/prettier-eslint-cli" + } + ], + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "master", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8957c80..847bfee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,23 +7,32 @@ on: jobs: release: + name: Release runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - name: Checkout Repo + uses: actions/checkout@v3 with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 - - uses: actions/setup-node@v3 + - name: Setup Node.js LTS + uses: actions/setup-node@v3 with: - node-version: 16 - - - run: npm i + node-version: lts/* - - run: npm start build + - name: Install Dependencies + run: npm i - - name: Release + - name: Create Release Pull Request or Publish to npm + uses: changesets/action@v1 + with: + # This expects you to have a script called release which does a build for your packages and calls changeset publish + publish: npm run release + # this expects you to have a npm script called version that runs some logic and then calls `changeset version`. + version: npm run version + commit: 'chore: release prettier-eslint-cli' + title: 'chore: release prettier-eslint-cli' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release diff --git a/.nvmrc b/.nvmrc index 431076a..2a4e4ab 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.16.0 +16.17.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec2f920..a207a07 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,8 +48,8 @@ contribution type. ## Committing and Pushing changes -This project uses [`semantic-release`][semantic-release] to do automatic -releases and generate a changelog based on the commit history. So we follow +This project uses [`changesets`][changesets] to do automatic +releases and generate a changelog based on the changeset files. We follow [a convention][convention] for commit messages. You don't have to follow this convention if you don't like to. Just know that when we merge your commit, we'll probably use "Squash and Merge" so we can change the commit message :) @@ -58,17 +58,16 @@ Please make sure to run the tests before you commit your changes. You can run `npm start test.update` which will update any snapshots that need updating. Make sure to include those changes (if they exist) in your commit. -### opt into git hooks +You or a maintainer will need to add a changeset file on you pull request if we +want to draft a new release for your PR. If there are changeset files on the +master branch, [`changeset-bot`][changeset-bot] will raise a PR for releasing +automatically. When the release is finally ready, we will only need to merge +that PR. -There are git hooks set up with this project that are automatically installed -when you install dependencies. They're really handy, but are turned off by -default (so as to not hinder new contributors). You can opt into these by -creating a file called `.opt-in` at the root of the project and putting this -inside: +### simple-git-hooks -``` -pre-commit -``` +There are git hooks set up with this project that are automatically installed +when you install dependencies. ## Help needed @@ -77,8 +76,9 @@ Please checkout the [the open issues][issues] Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks! [egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github -[semantic-release]: https://npmjs.com/package/semantic-release -[convention]: https://github.com/conventional-changelog/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md +[changesets]: https://github.com/changesets/changesets +[changeset-bot]: https://github.com/apps/changeset-bot +[convention]: https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional [all-contributors]: https://github.com/kentcdodds/all-contributors [issues]: https://github.com/prettier/prettier-eslint-cli/issues [nps]: https://github.com/kentcdodds/nps diff --git a/README.md b/README.md index 262943a..0e7a6e9 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ CLI for [`prettier-eslint`][prettier-eslint] [![version][version-badge]][package] [![downloads][downloads-badge]][npm-stat] [![MIT License][license-badge]][license] +[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg?style=flat-square)](https://github.com/atlassian/changesets) [![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/prettier?style=flat-square)](https://opencollective.com/prettier) [![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors) diff --git a/package.json b/package.json index c4e83d6..ad570a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prettier-eslint-cli", - "version": "0.0.0-development", + "version": "7.0.1", "description": "CLI for prettier-eslint", "main": "dist/no-main.js", "engines": { @@ -13,6 +13,10 @@ "build": "nps build", "lint": "nps lint", "prepare": "patch-package && simple-git-hooks", + "prerelease": "nps build", + "release": "clean-pkg-json && changeset release", + "version": "changeset version", + "postversion": "npm start test.update", "start": "nps", "test": "nps test" }, @@ -59,18 +63,19 @@ "@babel/core": "^7.18.10", "@babel/node": "^7.18.10", "@babel/preset-env": "^7.18.10", + "@changesets/changelog-github": "^0.4.6", + "@changesets/cli": "^2.24.3", "all-contributors-cli": "^6.20.0", + "clean-pkg-json": "^1.0.1", "eslint-config-kentcdodds": "^20.3.1", "eslint-plugin-node-dependencies": "^0.8.0", "jest": "^28.1.3", "lint-staged": "^12.5.0", "nps": "^5.10.0", "nps-utils": "^1.7.0", - "opt-cli": "^1.6.0", "patch-package": "^6.4.7", "pify": "^5.0.0", "rimraf": "^3.0.2", - "semantic-release": "^17.4.7", "simple-git-hooks": "^2.8.0", "spawn-command": "0.0.2-1", "strip-indent": "^3.0.0", @@ -84,7 +89,7 @@ "singleQuote": true }, "simple-git-hooks": { - "pre-commit": "npx lint-staged && npx opt --in pre-commit --exec \"npm start validate\"" + "pre-commit": "npx lint-staged && npm start validate" }, "repository": { "type": "git", diff --git a/test/tests/__snapshots__/cli.spec.js.snap b/test/tests/__snapshots__/cli.spec.js.snap index de14e58..b51dd89 100644 --- a/test/tests/__snapshots__/cli.spec.js.snap +++ b/test/tests/__snapshots__/cli.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`prettier-eslint --version: stdout: --version 1`] = ` -"0.0.0-development +"7.0.1 " `;