Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve npm publishing #5

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Tests

on:
push:
branches: [main, dev]
branches: [main]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

Expand Down
25 changes: 25 additions & 0 deletions DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Some developer guidelines


## Merge strategies

- Feature branches to `dev`: squash commit
- Continuous Release from `dev` to `main`: standard merge commit
- Hotfixes: branch off `main`, merge PR into `main` via squash commit, then merge back `main` to `dev` via standard merge commit.


## Create a new release (and publish to npm)

As this is only a small project, we haven't automated publishing to the NPM registry yet and instead rely on the following manual workflow.

- Make sure the tests pass locally: `npm test` ✔
- Make another commit on the `dev` branch bumping the npm version in the `package.json`. For that, use:
```sh
npm run bump-version -- [<newversion> | major | minor | patch]
```
- Once the `dev` branch is ready, open a PR (Pull request) called "Continuous Release <version.number>" and give it the "release" label. Merge this PR into `main`.
- Create a new release via the GitHub UI and assign a new tag alongside that.
- Fetch the tag locally (`git fetch`) and publish to npm via `npm run publish-final`. You probably have to login to npm first (`npm login`).
- Enjoy ✌ Check that the release is available [here on npm](https://www.npmjs.com/package/eslint-plugin-erb).


13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@
"keywords": [
"eslint",
"eslintplugin",
"eslint-processor",
"erb",
"ruby",
"embedded ruby",
"javascript",
"lint",
"linter"
],
"main": "index.js",
"files": [
"index.js",
"lib"
],
"devDependencies": {
"@stylistic/eslint-plugin": "^1.3.3",
"chai": "^4.3.10",
"eslint": "^8.54.0",
"mocha": "^10.2.0"
},
"scripts": {
"test": "mocha"
"test": "mocha",
"whats-included": "npm pack --dry-run",
"bump-version": "npm run test && npm version --no-git-tag-version",
"publish-final": "npm run test && npm publish"
}
}
}