Skip to content

Commit

Permalink
Convert to ESM module (#48)
Browse files Browse the repository at this point in the history
This converts the package to generate an ESM module as the build output. The instigator was #39  but there were a number of ESM-only packages in the dependencies. The final result is as follows:
* Switched from `term-size` to `terminal-size` and upgraded `ansi-regex`, `chalk` and `diff`.
* Switched to [shikiji](https://github.com/antfu/shikiji) and patched the perf optimization for `setTheme` from shiki.
* Update min node version to 18.
* There's a ~35ms improvement in startup time.
* Switched from `yarn` to `npm`. `yarn v4` does pretty weird things that were hard to get to work esp on windows.
  • Loading branch information
banga committed Dec 29, 2023
1 parent 771ba23 commit 3829fbb
Show file tree
Hide file tree
Showing 25 changed files with 6,090 additions and 2,780 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['14', '16', '18', '19']
node_version: ['18', '19', '20']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ./node_modules
key: npm-${{ hashFiles('yarn.lock') }}-${{ matrix.os }}-${{ matrix.node_version }}
restore-keys: npm-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- run: yarn test
- run: npm install --frozen-lockfile
- run: npm test
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.21.2
v18.18.2
3 changes: 0 additions & 3 deletions bin/git-split-diffs

This file was deleted.

9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
/** @type {import('jest').Config} */
const jestConfig = {
preset: 'ts-jest/presets/default-esm',
roots: ['<rootDir>/src'],
testMatch: ['**/?(*.)+(spec|test).+(ts|tsx|js)'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
};

export default jestConfig;

0 comments on commit 3829fbb

Please sign in to comment.