build: add package publication on JSR
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 27 Mar 2024 09:55:33 +0000 (10:55 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 27 Mar 2024 09:55:33 +0000 (10:55 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.github/workflows/publish-package.yml
.release-it.json
CHANGELOG.md
README.md
jsr.json [new file with mode: 0644]

index aa6d4f6aba5e4be88f2493a9e9b22100397d7edd..d137d65d7315740a33c4e71fd93bd4963d7c26f2 100644 (file)
@@ -1,4 +1,4 @@
-name: Publish npm package
+name: Publish package
 
 on:
   release:
 
 on:
   release:
@@ -37,6 +37,40 @@ jobs:
       - name: Production Build
         run: pnpm build:prod
 
       - 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
   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 }}
         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 }}
index 771b2ced17ef240ca366d303e2f424828884f941..e738ef00a9d2a2663c80aad73e268ed9af4690b4 100644 (file)
@@ -15,7 +15,7 @@
   },
   "plugins": {
     "@release-it/bumper": {
   },
   "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",
     },
     "@release-it/keep-a-changelog": {
       "filename": "CHANGELOG.md",
index dc2f94a057468a69dc8ee599120bc2b2e350841e..f8c1b833e6667b4a5c7b1a7090939e322b19c714 100644 (file)
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 
 
 ## [Unreleased]
 
+### Changed
+
+- Publish on JSR.
+
 ## [3.1.22] - 2024-03-15
 
 ### Fixed
 ## [3.1.22] - 2024-03-15
 
 ### Fixed
index 537d3b1fb87045146a445095649b83f521167532..6f6e79c7cb91e089e1e3a8996446f58f38bffa82 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,7 +11,9 @@
 <div align="center">
 
 [![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)
 <div align="center">
 
 [![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)
 [![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)
 [![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
 
 
 ## Installation
 
+### npm
+
 ```shell
 npm install poolifier --save
 ```
 
 ```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_:
 ## 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 (file)
index 0000000..c70d71f
--- /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"
+    ]
+  }
+}