Skip to content

Commit

Permalink
Convert to ES Module (#62)
Browse files Browse the repository at this point in the history
* do not rely on resolution logic to import files

* drop FakeMap

* drop getFuncName, use .name instead

* import test deps as esm

* drop rollup

* port all code to typescript

* add deno mod.ts shortcut

* switch from .ts to .js extensions

* import lib rather than src in test/

Co-authored-by: 43081j <[email protected]>

* add web test runner config

Co-authored-by: 43081j <[email protected]>

* install wtr & friends

Co-authored-by: 43081j <[email protected]>

* fix test runner scripts

Co-authored-by: 43081j <[email protected]>

* More ESM (#68)

* fix: try getting esm working

* fix: update `esbuild`

* remove commitlint

---------

Co-authored-by: 43081j <[email protected]>
Co-authored-by: Kristján Oddsson <[email protected]>
Co-authored-by: Kristján Oddsson <[email protected]>
  • Loading branch information
4 people authored Oct 20, 2023
1 parent 247f948 commit 995ad13
Show file tree
Hide file tree
Showing 62 changed files with 13,912 additions and 12,684 deletions.
76 changes: 15 additions & 61 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ jobs:
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run lint step
Expand All @@ -35,21 +28,14 @@ jobs:
strategy:
matrix:
node-version:
- 10.x # to be removed 2021-04-01
- 12.x # to be removed 2022-04-30
- x.x.x # safety net; don't remove
- 16.x # to be removed 2023-09-11
- 18.x # to be removed 2025-04-30
- 20.x # to be removed 2026-04-30
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand All @@ -63,57 +49,32 @@ jobs:
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Setup Headless Environment
run: sudo apt-get install xvfb
- name: Run Node.js Tests
run: xvfb-run --auto-servernum npm run test:browser -- --browsers Chrome,Firefox
run: npm run test:browser
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v1
- name: Cleanup Headless Environment
run: |
xvfb_pids=`ps aux | grep tmp/xvfb-run | grep -v grep | awk '{print $2}'`
if [ "$xvfb_pids" != "" ]; then
echo "Killing the following xvfb processes: $xvfb_pids"
sudo kill $xvfb_pids
else
echo "No xvfb processes to kill"
fi

test-windows-browsers:
name: Test on Windows Firefox, Chrome & Edge
runs-on: windows-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: $APP_DATA/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser -- --browsers Chrome,Firefox,IE
run: npm run test:browser

release:
name: Publish a Release
Expand All @@ -123,17 +84,10 @@ jobs:
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Semantic Release
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/commitlint.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ npm-debug.log
loupe.test.js
loupe.js
.nyc_output/
lib/
2 changes: 1 addition & 1 deletion bench/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import loupe from '../index'
import loupe from '../index.js'
import { inspect as nodeInspect } from 'util'
import Benchmark from 'benchmark'
const benches = []
Expand Down
3 changes: 0 additions & 3 deletions commitlint.config.js

This file was deleted.

17 changes: 0 additions & 17 deletions karma.conf.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/arguments.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/bigint.js

This file was deleted.

10 changes: 0 additions & 10 deletions lib/function.js

This file was deleted.

27 changes: 0 additions & 27 deletions lib/map.js

This file was deleted.

16 changes: 0 additions & 16 deletions lib/set.js

This file was deleted.

3 changes: 3 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import inspect, { custom } from './src/index.ts'
export default inspect
export { custom, inspect }
Loading

0 comments on commit 995ad13

Please sign in to comment.