Skip to content

Commit

Permalink
feat: convert to esm (#81)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drop support for Node < 18
  • Loading branch information
hongaar authored Apr 4, 2023
1 parent 501a59e commit 4e2199b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 420 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,11 @@ on:
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- node-version: 14
node-lts: true
- node-version: 16
node-lts: true
- node-version: 18
node-lts: true
- node-version: 19
node-lts: false
continue-on-error: ${{ ! matrix.node-lts }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: lts/*
cache: yarn
- run: yarn install
- run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"../../../../dist/cjs/index.cjs",
"../../../../dist/index.js",
"@semantic-release/github",
[
"@semantic-release/git",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ yarn husky install
- [ ] Support for release information for each workspace
- [ ] Support for independant versions (probably impossible without custom
analyze-commits plugin)
- [ ] Get rid of CJS build once
- [x] Get rid of CJS build once
[upstream PR 2607](https://github.com/semantic-release/semantic-release/pull/2607)
lands
- [ ] Since we're using the latest AggregateError package, `semantic-release` is
Expand Down
17 changes: 5 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,14 @@
"Gregor Martynus (https://twitter.com/gr2m)"
],
"type": "module",
"exports": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.cjs"
},
"main": "dist/cjs/index.cjs",
"types": "dist/types/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn clean && yarn build:cjs && yarn build:esm",
"build:cjs": "tsc --module commonjs --moduleResolution nodenext --outDir dist/cjs && yarn convert-extension cjs dist/cjs/ && rm dist/cjs/*.map",
"build:esm": "tsc --outDir dist/esm",
"build": "yarn clean && yarn build:esm",
"build:esm": "tsc",
"clean": "rm -rf dist",
"doctoc": "doctoc README.md",
"format": "prettier --write --ignore-unknown .",
Expand Down Expand Up @@ -84,7 +78,6 @@
"@types/sinon": "10.0.13",
"@types/stream-buffers": "3.0.4",
"ava": "5.2.0",
"convert-extension": "0.3.0",
"dockerode": "3.3.5",
"doctoc": "2.2.1",
"get-stream": "6.0.1",
Expand All @@ -99,7 +92,7 @@
"stream-buffers": "3.0.2",
"tempy": "3.0.0",
"ts-node": "10.9.1",
"typescript": "4.9.5"
"typescript": "5.0.3"
},
"peerDependencies": {
"semantic-release": ">=19.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/verify-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from "lodash";
import type { PluginConfig } from "./definitions/pluginConfig.js";
import { ErrorDefinition, getError } from "./get-error.js";
import { getError, type ErrorDefinition } from "./get-error.js";

const isNonEmptyString = (value: unknown) =>
!!(_.isString(value) && value.trim());
Expand Down
11 changes: 5 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 16 + ESM + Strictest",
"display": "Node 18 + ESM + Strictest",
"compilerOptions": {
"lib": ["es2021"],
"lib": ["es2022"],
"module": "es2022",
"target": "es2021",
"target": "es2022",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
Expand All @@ -20,11 +20,10 @@
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"importsNotUsedAsValues": "error",
"verbatimModuleSyntax": true,
"declaration": true,
"sourceMap": true,
"rootDir": "src",
"declarationDir": "dist/types"
"outDir": "dist"
},
"include": ["src"]
}
Loading

0 comments on commit 4e2199b

Please sign in to comment.