From 6329f2936c68654fd2f6c6db280545a8eb38a4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 13 Oct 2023 10:17:15 +0200 Subject: [PATCH 1/2] feat: improve exports for ESM and add shorthand export for the full.pretty build --- core.js | 2 +- full.js | 2 +- full.pretty.js | 3 +++ minimal.js | 2 +- package.json | 20 +++++++++++++++++++- 5 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 full.pretty.js diff --git a/core.js b/core.js index 8be7922e..868a66cd 100644 --- a/core.js +++ b/core.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = require('./dist/openchemlib-core'); +module.exports = require('./dist/openchemlib-core.js'); diff --git a/full.js b/full.js index 1b2684cc..9911493c 100644 --- a/full.js +++ b/full.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = require('./dist/openchemlib-full'); +module.exports = require('./dist/openchemlib-full.js'); diff --git a/full.pretty.js b/full.pretty.js new file mode 100644 index 00000000..1cd595b6 --- /dev/null +++ b/full.pretty.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./dist/openchemlib-full.pretty.js'); diff --git a/minimal.js b/minimal.js index 41402481..94aee8d5 100644 --- a/minimal.js +++ b/minimal.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = require('./dist/openchemlib-minimal'); +module.exports = require('./dist/openchemlib-minimal.js'); diff --git a/package.json b/package.json index c2364565..93296c6c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,23 @@ "test-only": "jest" }, "main": "./core.js", + "exports": { + ".": "./core.js", + "./minimal": "./minimal.js", + "./minimal.js": "./minimal.js", + "./core": "./core.js", + "./core.js": "./core.js", + "./full": "./full.js", + "./full.js": "./full.js", + "./full.pretty": { + "types": "./full.d.ts", + "default": "./full.pretty.js" + }, + "./full.pretty.js": { + "types": "./full.d.ts", + "default": "./full.pretty.js" + } + }, "files": [ "dist", "types.d.ts", @@ -36,7 +53,8 @@ "core.js", "core.d.ts", "full.js", - "full.d.ts" + "full.d.ts", + "full.pretty.js" ], "repository": { "type": "git", From fe2af826d6bc9adfec02cb59635422dc45c03433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 13 Oct 2023 10:20:50 +0200 Subject: [PATCH 2/2] chore: update GH actions and test on Node.js 20 --- .github/workflows/lactame.yml | 4 ++-- .github/workflows/nodejs.yml | 11 ++++++----- .github/workflows/release.yml | 4 ++-- .github/workflows/typedoc.yml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lactame.yml b/.github/workflows/lactame.yml index 789a5544..a6ff32fd 100644 --- a/.github/workflows/lactame.yml +++ b/.github/workflows/lactame.yml @@ -8,7 +8,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: 'zulu' @@ -17,7 +17,7 @@ jobs: run: ./scripts/get-gwt.sh - uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Install dependencies run: npm ci - name: Build project diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 2b792e76..ac442f3f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -2,17 +2,18 @@ name: Node.js CI on: push: - branches: main + branches: + - main pull_request: jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Install dependencies run: npm ci - name: Run ESLint @@ -21,10 +22,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [16.x, 18.x, 20.x] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: 'zulu' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 747e75c8..47b9ed6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: token: ${{ secrets.BOT_TOKEN }} release-type: node package-name: 'openchemlib' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # These if statements ensure that a publication only occurs when a new release is created if: ${{ steps.release.outputs.release_created }} - uses: actions/setup-java@v3 @@ -28,7 +28,7 @@ jobs: if: ${{ steps.release.outputs.release_created }} - uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: 'https://registry.npmjs.org' if: ${{ steps.release.outputs.release_created }} - run: npm ci diff --git a/.github/workflows/typedoc.yml b/.github/workflows/typedoc.yml index 1427c89c..4048cacd 100644 --- a/.github/workflows/typedoc.yml +++ b/.github/workflows/typedoc.yml @@ -9,7 +9,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build documentation uses: zakodium/typedoc-action@v2 with: