From b7bb85861ee98ae26b7177b0cb4be614770c60ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 27 Mar 2024 10:55:33 +0100 Subject: [PATCH] build: add package publication on JSR MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .github/workflows/publish-package.yml | 84 +++++++++++---------------- .release-it.json | 2 +- CHANGELOG.md | 4 ++ README.md | 10 ++++ jsr.json | 15 +++++ 5 files changed, 65 insertions(+), 50 deletions(-) create mode 100644 jsr.json diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index aa6d4f6a..d137d65d 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -1,4 +1,4 @@ -name: Publish npm package +name: Publish package on: release: @@ -37,6 +37,40 @@ jobs: - name: Production Build run: pnpm build:prod + publish-jsr: + needs: build + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # - name: Setup pnpm + # uses: pnpm/action-setup@v3 + # with: + # version: 8 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'pnpm' + + # - name: Install Dependencies + # run: pnpm install --ignore-scripts --frozen-lockfile + + - name: Read package.json version + id: package-version + uses: jaywcjlove/github-action-package@main + + - name: Publish Release + if: ${{ contains(steps.package-version.outputs.version, '-') == false }} + run: npx jsr publish + publish-npm: needs: build runs-on: ubuntu-latest @@ -81,51 +115,3 @@ jobs: run: pnpm publish --no-git-checks --tag beta env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - # publish-gpr: - # needs: build - # runs-on: ubuntu-latest - # permissions: - # contents: read - # packages: write - - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Setup pnpm - # uses: pnpm/action-setup@v3 - # with: - # version: 8 - - # - name: Setup Node.js - # uses: actions/setup-node@v4 - # with: - # node-version: '20.x' - # registry-url: https://npm.pkg.github.com - # cache: 'pnpm' - - # - name: Install Dependencies - # run: pnpm install --ignore-scripts --frozen-lockfile - - # - name: Read package.json version - # id: package-version - # uses: jaywcjlove/github-action-package@main - - # - name: Publish Release - # if: ${{ contains(steps.package-version.outputs.version, '-') == false }} - # run: pnpm publish --no-git-checks - # env: - # NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }} - - # - name: Publish Pre-Release - # if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }} - # run: pnpm publish --no-git-checks --tag next - # env: - # NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }} - - # - name: Publish Beta Release - # if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }} - # run: pnpm publish --no-git-checks --tag beta - # env: - # NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }} diff --git a/.release-it.json b/.release-it.json index 771b2ced..e738ef00 100644 --- a/.release-it.json +++ b/.release-it.json @@ -15,7 +15,7 @@ }, "plugins": { "@release-it/bumper": { - "out": ["sonar-project.properties", "src/pools/version.ts"] + "out": ["src/pools/version.ts", "sonar-project.properties", "jsr.json"] }, "@release-it/keep-a-changelog": { "filename": "CHANGELOG.md", diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2f94a0..f8c1b833 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Publish on JSR. + ## [3.1.22] - 2024-03-15 ### Fixed diff --git a/README.md b/README.md index 537d3b1f..6f6e79c7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@
[![GitHub commit activity (master)](https://img.shields.io/github/commit-activity/m/poolifier/poolifier/master?color=brightgreen&logo=github)](https://github.com/poolifier/poolifier/graphs/commit-activity) +[![Npm Version](https://badgen.net/npm/v/poolifier?icon=npm)](https://www.npmjs.com/package/poolifier) [![Npm Weekly Downloads](https://badgen.net/npm/dw/poolifier?icon=npm)](https://www.npmjs.com/package/poolifier) +[![JSR Version](https://jsr.io/badges/@poolifier/poolifier)](https://jsr.io/@poolifier/poolifier) [![CI Workflow](https://github.com/poolifier/poolifier/actions/workflows/ci.yml/badge.svg)](https://github.com/poolifier/poolifier/actions/workflows/ci.yml) [![Code Coverage](https://sonarcloud.io/api/project_badges/measure?project=poolifier_poolifier&metric=coverage)](https://sonarcloud.io/dashboard?id=poolifier_poolifier) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=poolifier_poolifier&metric=alert_status)](https://sonarcloud.io/dashboard?id=poolifier_poolifier) @@ -81,10 +83,18 @@ You have to implement your worker by extending the _ThreadWorker_ or _ClusterWor ## Installation +### npm + ```shell npm install poolifier --save ``` +### jsr + +```shell +npx jsr add @poolifier/poolifier +``` + ## Usage You can implement a poolifier [worker_threads](https://nodejs.org/api/worker_threads.html#class-worker) worker in a simple way by extending the class _ThreadWorker_: diff --git a/jsr.json b/jsr.json new file mode 100644 index 00000000..c70d71f2 --- /dev/null +++ b/jsr.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://jsr.io/schema/config-file.v1.json", + "name": "@poolifier/poolifier", + "version": "3.1.22", + "exports": "./lib/index.mjs", + "publish": { + "include": [ + "LICENSE", + "README.md", + "jsr.json", + "lib/**/*.mjs", + "lib/**/*.ts" + ] + } +} -- 2.34.1