Skip to content

Commit

Permalink
Merge pull request #232 from capralifecycle/cals-928/migrate-to-esm
Browse files Browse the repository at this point in the history
cals 928/migrate to esm
  • Loading branch information
joakimen authored Dec 11, 2024
2 parents f84752d + 56afa8a commit fb4e21b
Show file tree
Hide file tree
Showing 25 changed files with 626 additions and 98 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.18.1
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
all: build

.PHONY: build
build:
build: clean
npm install
./scripts/build-and-verify.sh
npm run lint
npm run prepare
npm run test

.PHONY: clean
clean:
rm -rf lib
2 changes: 1 addition & 1 deletion commitlint.config.js → commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
export default {
extends: ["@commitlint/config-conventional"],
}
34 changes: 19 additions & 15 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import path from "node:path"
import { fileURLToPath } from "node:url"
import js from "@eslint/js"
import { FlatCompat } from "@eslint/eslintrc"

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [{
ignores: ["coverage/", "lib/", "**/*.js", "**/*.mjs"],
}, ...compat.extends(
export default [
{
ignores: ["coverage/", "lib/", "**/*.js", "**/*.mjs", "scripts/**/*"],
},
...compat.extends(
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"plugin:prettier/recommended",
), {
),
{
files: ["**/*.ts"],
languageOptions: {
ecmaVersion: 5,
Expand All @@ -30,4 +33,5 @@ export default [{
rules: {
"@typescript-eslint/no-unused-vars": "warn",
},
}];
},
]
7 changes: 0 additions & 7 deletions jest.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
moduleNameMapper: {
"^package.json$": "<rootDir>/package.json",

// workaround: jest doesn't work well with lodash-es,
// so map to cjs lodash during test
"^lodash-es$": "lodash"
},
preset: 'ts-jest',
testEnvironment: "node",
transform: {},
}
Loading

0 comments on commit fb4e21b

Please sign in to comment.