Skip to content

Commit

Permalink
Merge pull request #221 from gradientedge/feature/esm
Browse files Browse the repository at this point in the history
feat: correcly export both ESM and CJS
  • Loading branch information
jimmythomson committed Dec 27, 2023
2 parents f82151c + 48e79d0 commit fbd64b1
Show file tree
Hide file tree
Showing 105 changed files with 6,264 additions and 26,663 deletions.
File renamed without changes.
24 changes: 15 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,28 @@ jobs:
name: Validate build
runs-on: ubuntu-20.04
steps:
- name: Install pnpm
shell: bash
run: npm i -g pnpm@8
- name: Turn on auto-install-peers
shell: bash
run: pnpm config set auto-install-peers true
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
node-version: 20
- name: Install dependencies
run: npm ci
run: pnpm i
- name: Prettier check
run: npm run prettier
run: pnpm prettier
- name: Lint the code
run: npm run lint
run: pnpm lint
- name: Run the test suite
run: npm test
run: pnpm test
- name: Build the code
run: pnpm build
- name: Monitor coverage
uses: slavcodev/coverage-monitor-action@1.2.0
with:
Expand All @@ -31,8 +39,6 @@ jobs:
threshold_alert: 50
threshold_warning: 60
- name: Publish Code Coverage
run: npx codecov
- name: Build and package the code
run: npm run package
run: pnpx codecov
- name: Build the documentation
run: npm run docs
run: pnpm run docs
24 changes: 15 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,37 @@ jobs:
name: Release
runs-on: ubuntu-20.04
steps:
- name: Install pnpm
shell: bash
run: npm i -g pnpm@8
- name: Turn on auto-install-peers
shell: bash
run: pnpm config set auto-install-peers true
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
node-version: 20
- name: Install dependencies
run: npm ci
run: pnpm i
- name: Prettier check
run: npm run prettier
run: pnpm prettier
- name: Lint the code
run: npm run lint
run: pnpm lint
- name: Run the test suite
run: npm test
- name: Compile the TypeScript code
run: npm run package
run: pnpm test
- name: Build the code
run: pnpm build
- name: Publish Code Coverage
run: npx codecov
run: pnpx codecov
- name: Release to npm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Build the documentation
run: npm run docs
run: pnpm run docs
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run validate
pnpm validate
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
strict-peer-dependencies=false
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
33 changes: 33 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const collectCoverage = !!process.env.CI;

export default {
testEnvironment: "node",
rootDir: "./src",
testMatch: ["**/*.test.ts"],
testPathIgnorePatterns: ["node_modules/", "dist/"],
setupFilesAfterEnv: ["jest-matcher-specific-error"],
collectCoverage,
coverageDirectory: '../.coverage',
coverageProvider: 'v8',
verbose: true,
extensionsToTreatAsEsm: [".ts"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
transform: {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
jsc: {
parser: {
useESM: true,
syntax: "typescript",
tsx: false,
decorators: true,
dynamicImport: true
}
}
}
]
}
};
189 changes: 0 additions & 189 deletions jest.config.ts

This file was deleted.

0 comments on commit fbd64b1

Please sign in to comment.