Skip to content

Commit

Permalink
feat: use pnpm publish instead of npm
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscon committed Aug 26, 2023
1 parent ef5bb66 commit 3ce8272
Show file tree
Hide file tree
Showing 73 changed files with 8,459 additions and 25,127 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: '8.x'

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 19
cache: 'npm'
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Configure CI Git User
run: |
git config --global user.name 'goestav'
git config --global user.email '27970303+goestav@users.noreply.github.com'
git remote set-url origin https://goestav:$GITHUB_TOKEN@github.com/goestav/nx-semantic-release
git config --global user.name 'ruscon'
git config --global user.email '27970303+ruscon@users.noreply.github.com'
git remote set-url origin https://ruscon:$GITHUB_TOKEN@github.com/ruscon/nx-semantic-release-pnpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install npm dependencies
run: npm ci

- name: Link package
run: npm run build:skip-cache && npm link dist/packages/nx-semantic-release && npm ls @goestav/nx-semantic-release
run: pnpm install --ignore-scripts

- name: Print versions
run: |
Expand All @@ -41,7 +43,7 @@ jobs:
echo "NX version: $(npx nx --version)"
- name: Release
run: npm run release
run: pnpm run release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,39 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [16, 17, 18, 19]
node: [16, 17, 18, 19, 20]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Configure CI Git User
run: |
git config --global user.name 'goestav'
git config --global user.email '27970303+goestav@users.noreply.github.com'
git remote set-url origin https://goestav:$GITHUB_TOKEN@github.com/goestav/nx-semantic-release
git config --global user.name 'ruscon'
git config --global user.email '27970303+ruscon@users.noreply.github.com'
git remote set-url origin https://ruscon:$GITHUB_TOKEN@github.com/ruscon/nx-semantic-release-pnpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: '8.x'

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache: 'pnpm'

- name: Install npm dependencies
run: npm ci
- name: Install dependencies
run: pnpm install --ignore-scripts

- name: Typecheck
run: npm run typecheck
run: pnpm run typecheck

- name: Lint
run: npm run lint
run: pnpm run lint

- name: Run tests
run: npx nx test nx-semantic-release --runInBand --skip-nx-cache
run: pnpm nx test nx-semantic-release-pnpm --runInBand --skip-nx-cache
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ git-server
.env

# dependencies
/node_modules
node_modules

# IDEs and editors
/.idea
Expand Down
9 changes: 9 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
always-auth=true
no-optional=true
auto-install-peers=true
dedupe-peer-dependents=true
strict-peer-dependencies=true
resolve-peers-from-workspace-root=true
audit=false
fund=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.4.0
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @TheUnderScorer
* ruscon
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to nx-semantic-release
# Contributing to nx-semantic-release-pnpm

Do you want to contribute to the project? Thats great! 🎉

Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @goestav/nx-semantic-release
# @ruscon/nx-semantic-release-pnpm

> This fork supports the [ESM import syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
> This fork supports the [ESM import syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) for PNPM publish.
[nx](https://nx.dev/) plugin for automated releases, powered
by [semantic-release](https://github.com/semantic-release/semantic-release)
Expand All @@ -16,8 +16,8 @@ Under the hood, it uses project graph from nx to analyze commits for every confi
Run:

```shell
npm install -D @goestav/nx-semantic-release
nx g @goestav/nx-semantic-release:install
pnpm install -D @ruscon/nx-semantic-release-pnpm
pnpm nx g @ruscon/nx-semantic-release-pnpm:install
```

For now this package supports only <b>Independent</b> versioning mode, synced mode is planned to be added soon.
Expand All @@ -30,12 +30,12 @@ configuration looks like this:
```json
{
"semantic-release": {
"executor": "@goestav/nx-semantic-release:semantic-release"
"executor": "@ruscon/nx-semantic-release-pnpm:semantic-release"
}
}
```

> Hint: You can also use our generator `nx g @goestav/nx-semantic-release:setup-project $PROJECT_NAME` to generate this configuration.
> Hint: You can also use our generator `nx g @ruscon/nx-semantic-release-pnpm:setup-project $PROJECT_NAME` to generate this configuration.
After running this, the executor will do the following:

Expand All @@ -45,7 +45,7 @@ After running this, the executor will do the following:
- @semantic-release/commit-analyzer
- @semantic-release/release-notes-generator
- @semantic-release/changelog
- @semantic-release/npm
- @colbyfayock/semantic-release-pnpm
- @semantic-release/git
- @semantic-release/github
- The result will be a fully versioned project. If you are releasing it as npm package, the package will be built,
Expand All @@ -69,7 +69,7 @@ _Note:_ Object/Array type options are shallowly merged. For example, if gitAsset

### Configuration file

nx-semantic-release's options can be set globally via either:
nx-semantic-release-pnpm's options can be set globally via either:

- a `nxrelease` key in the project's `package.json` file
- a `.nxreleaserc` file, written in YAML or JSON, with optional extensions: `.yaml`/`.yml`/`.json`/`.js`
Expand All @@ -82,7 +82,7 @@ The following examples are all the same.
```json
{
"nxrelease": {
"repositoryUrl": "https://github.com/goestav/nx-semantic-release"
"repositoryUrl": "https://github.com/ruscon/nx-semantic-release-pnpm"
}
}
```
Expand All @@ -91,21 +91,21 @@ The following examples are all the same.

```yaml
---
repositoryUrl: 'https://github.com/goestav/nx-semantic-release'
repositoryUrl: 'https://github.com/ruscon/nx-semantic-release-pnpm'
```

- Via `nxrelease.config.js` file:

```js
module.exports = {
repositoryUrl: 'https://github.com/goestav/nx-semantic-release',
repositoryUrl: 'https://github.com/ruscon/nx-semantic-release-pnpm',
};
```

- Via CLI arguments:

```
$ nx semantic-release app-c --repositoryUrl "https://github.com/goestav/nx-semantic-release"
$ pnpm nx semantic-release app-c --repositoryUrl "https://github.com/ruscon/nx-semantic-release-pnpm"
```

### Available Options
Expand Down Expand Up @@ -206,7 +206,7 @@ You can also use **one single** `[skip my-app1, my-app2]` to skip commits relate
You can release multiple apps/libraries at once by using `nx run-many`:

```shell
npx nx run-many --target=semantic-release --parallel=false
pnpm nx run-many --target=semantic-release --parallel=false
```

> Note: `--parallel=false` is required to run tasks sequentially, otherwise `nx run-many` will run tasks in parallel and semantic-release will fail.
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
- run: npm ci

- run: npx nx run my-app:semantic-release
- run: pnpm nx run my-app:semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"npmScope": "goestav",
"npmScope": "ruscon",
"affected": {
"defaultBase": "master"
},
Expand Down

0 comments on commit 3ce8272

Please sign in to comment.