Skip to content

Commit d75d069

Browse files
committed
Dropping CommonJS and releasing 1.0
1 parent bb69787 commit d75d069

11 files changed

+732
-3706
lines changed

.eslintrc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"env": {
33
"browser": true,
44
"node": true,
5-
"es6": true
5+
"es6": true,
6+
"mocha": true
67
},
78
"extends": [
89
"eslint:recommended",
@@ -61,7 +62,6 @@
6162
"args": "none"
6263
}],
6364
"@typescript-eslint/prefer-for-of": ["error"],
64-
"@typescript-eslint/prefer-optional-chain": ["error"],
6565
"@typescript-eslint/prefer-ts-expect-error": ["error"]
6666
}
6767
}

.github/workflows/bun.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Bun Test Runner
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
bun-test:
14+
name: Bun tests
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Use Bun
21+
uses: antongolub/action-setup-bun@v1
22+
- run: bun install
23+
- run: bun run build
24+
- run: bun run mocha

.github/workflows/node.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Node.js CI
4+
name: Node.js Test Runner
55

66
on:
77
push:
@@ -14,17 +14,17 @@ jobs:
1414
name: Node.js tests (ESM)
1515

1616
runs-on: ubuntu-latest
17-
timeout-minutes: 5
17+
timeout-minutes: 10
1818

1919
strategy:
2020
matrix:
21-
node-version: [14.x, 16.x, 18.x]
21+
node-version: [16.x, 18.x, 20.x]
2222
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2323

2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626
- name: Use Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v1
27+
uses: actions/setup-node@v3
2828
with:
2929
node-version: ${{ matrix.node-version }}
3030
- run: npm ci
@@ -33,19 +33,19 @@ jobs:
3333

3434
cjs-test:
3535
name: Node.js tests (CommonJS)
36-
timeout-minutes: 5
3736

3837
runs-on: ubuntu-latest
38+
timeout-minutes: 10
3939

4040
strategy:
4141
matrix:
42-
node-version: [14.x, 16.x, 18.x]
42+
node-version: [16.x, 18.x, 20.x]
4343
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
4444

4545
steps:
46-
- uses: actions/checkout@v2
46+
- uses: actions/checkout@v3
4747
- name: Use Node.js ${{ matrix.node-version }} (CommonJS)
48-
uses: actions/setup-node@v1
48+
uses: actions/setup-node@v3
4949
with:
5050
node-version: ${{ matrix.node-version }}
5151
- run: npm ci
@@ -58,9 +58,9 @@ jobs:
5858
runs-on: ubuntu-latest
5959

6060
steps:
61-
- uses: actions/checkout@v2
61+
- uses: actions/checkout@v3
6262
- name: Use Node.js
63-
uses: actions/setup-node@v1
63+
uses: actions/setup-node@v3
6464
with:
6565
node-version: 18.x
6666
- run: npm ci

.github/workflows/npm-publish.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 14
17+
node-version: 16
1818
- run: npm ci
1919
- run: npm test
2020

2121
publish-npm:
2222
needs: build
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v2
26-
- uses: actions/setup-node@v2
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
2727
with:
28-
node-version: 14
28+
node-version: 16
2929
registry-url: https://registry.npmjs.org/
3030
- run: npm ci
3131
- run: npm publish
@@ -36,14 +36,14 @@ jobs:
3636
needs: build
3737
runs-on: ubuntu-latest
3838
steps:
39-
- uses: actions/checkout@v2
40-
- uses: actions/setup-node@v2
39+
- uses: actions/checkout@v3
40+
- uses: actions/setup-node@v3
4141
with:
42-
node-version: 14
42+
node-version: 16
4343
- run: npm ci
44-
- uses: actions/setup-node@v2
44+
- uses: actions/setup-node@v3
4545
with:
46-
node-version: 14
46+
node-version: 16
4747
registry-url: 'https://npm.pkg.github.com'
4848
scope: '@curveball'
4949
- run: npm publish

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018-2023 Bad Gateway Inc.
3+
Copyright (c) 2018-2024 Bad Gateway Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

+6-24
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,11 @@ SOURCE_FILES:=$(shell find src/ -type f -name '*.ts')
44
all: build
55

66
.PHONY:build
7-
build: cjs/build esm/build
7+
build: dist/build
88

99
.PHONY:test
1010
test:
11-
npx nyc mocha --exit
12-
13-
.PHONY:test-cjs
14-
test-cjs:
15-
mkdir -p cjs-test
16-
cd test; npx tsc --module commonjs --outdir ../cjs-test
17-
echo '{"type": "commonjs", "dependencies": {"node-fetch": "^2"}}' > cjs-test/package.json
18-
cp test/polyfills.cjs cjs-test/
19-
cd cjs-test; npm i;
20-
cd cjs-test; npx mocha --exit --no-package --r polyfills.cjs
11+
npx nyc mocha
2112

2213
.PHONY:lint
2314
lint:
@@ -39,17 +30,8 @@ start: build
3930

4031
.PHONY:clean
4132
clean:
42-
rm -rf dist esm cjs cjs-test
43-
44-
cjs/build: $(SOURCE_FILES)
45-
npx tsc --module commonjs --outDir cjs/
46-
echo '{"type": "commonjs"}' > cjs/package.json
47-
@# Creating a small file to keep track of the last build time
48-
touch cjs/build
49-
33+
rm -rf dist
5034

51-
esm/build: $(SOURCE_FILES)
52-
npx tsc --module es2022 --outDir esm/
53-
echo '{"type": "module"}' > esm/package.json
54-
@# Creating a small file to keep track of the last build time
55-
touch esm/build
35+
dist/build: $(SOURCE_FILES)
36+
npx tsc
37+
touch dist/build

changelog.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
=========
33

4+
1.0.0 (????-??-??)
5+
------------------
6+
7+
* Finally! Curveball v1. Only took 6 years.
8+
* CommonJS support has been dropped. The previous version of this library
9+
supported both CommonJS and ESM. The effort of this no longer feels worth it.
10+
ESM is the future, so we're dropping CommonJS.
11+
* Now requires Node 18.
12+
13+
414
0.21.1 (2023-02-17)
515
-------------------
616

@@ -55,6 +65,7 @@ Identical release as the previous alpha.
5565

5666

5767

68+
5869
0.18.0-alpha.0 (2022-04-09)
5970
---------------------------
6071

@@ -133,8 +144,8 @@ Happy birthday Mom!
133144
0.14.3 (2020-09-23)
134145
-------------------
135146

136-
* #155 - `listen` and `listenWs` now both have a second `host` argument to
137-
bind to a specific interface. (@Nicholaiii)
147+
* #155 - `listen` and `listenWs` now both have a second `host` argument to bind
148+
to a specific interface. (@Nicholaiii)
138149
* #145 - `request.headers` and `response.head` function to get a list of header
139150
values for a given header name. (@Nicholaiii)ers` now have a `getMany()`
140151

0 commit comments

Comments
 (0)