Skip to content

Commit e081941

Browse files
authored
refactor!: switch module format to ESM (#234)
BREAKING CHANGE: library is now ESM only
1 parent f0002de commit e081941

File tree

13 files changed

+6113
-6451
lines changed

13 files changed

+6113
-6451
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ rules:
3838
allowRegExp: false
3939
allowNever: false
4040
"@typescript-eslint/no-unnecessary-type-parameters": "off"
41+
n/no-missing-import: "off"
4142

4243
overrides:
4344
- files: ["**/*.js"]

.github/workflows/ci-cd.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
with:
5454
parallel: true
5555
flag-name: Node.js ${{ matrix.node-version }} / ${{ matrix.os }}
56+
fail-on-error: false
5657

5758
coverage:
5859
name: Code Coverage
@@ -64,6 +65,7 @@ jobs:
6465
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
6566
with:
6667
parallel-finished: true
68+
fail-on-error: false
6769

6870
build:
6971
name: Build and lint

action.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */
2-
"use strict";
1+
import { main } from "./dist/main.js";
32

4-
const { main } = require("./dist/main.js");
5-
6-
main();
3+
await main();

bin/npm-publish.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
#!/usr/bin/env node
2-
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/use-unknown-in-catch-callback-variable, unicorn/prefer-module, unicorn/prefer-top-level-await */
3-
"use strict";
2+
import process from "node:process";
3+
import fs from "node:fs";
4+
import path from "node:path";
5+
import url from "node:url";
46

5-
const process = require("node:process");
6-
const { version } = require("../package.json");
7-
const { main } = require("../lib/cli/index.js");
7+
import { main } from "../lib/cli/index.js";
88

9-
main(process.argv.slice(2), version).catch((error) => {
9+
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
10+
11+
// eslint-disable-next-line jsdoc/check-tag-names
12+
/** @type {{ version: string }} */
13+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
14+
const { version } = JSON.parse(
15+
fs.readFileSync(path.join(dirname, "../package.json"), "utf8")
16+
);
17+
18+
try {
19+
await main(process.argv.slice(2), version);
20+
} catch (error) {
1021
console.error(error);
1122
process.exitCode = 1;
12-
});
23+
}

0 commit comments

Comments
 (0)