Skip to content

Commit

Permalink
Dropping CommonJS and releasing 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Jan 15, 2024
1 parent bb69787 commit d75d069
Show file tree
Hide file tree
Showing 11 changed files with 732 additions and 3,706 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"env": {
"browser": true,
"node": true,
"es6": true
"es6": true,
"mocha": true
},
"extends": [
"eslint:recommended",
Expand Down Expand Up @@ -61,7 +62,6 @@
"args": "none"
}],
"@typescript-eslint/prefer-for-of": ["error"],
"@typescript-eslint/prefer-optional-chain": ["error"],
"@typescript-eslint/prefer-ts-expect-error": ["error"]
}
}
24 changes: 24 additions & 0 deletions .github/workflows/bun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Bun Test Runner

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
bun-test:
name: Bun tests

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Bun
uses: antongolub/action-setup-bun@v1
- run: bun install
- run: bun run build
- run: bun run mocha
22 changes: 11 additions & 11 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: Node.js Test Runner

on:
push:
Expand All @@ -14,17 +14,17 @@ jobs:
name: Node.js tests (ESM)

runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10

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

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand All @@ -33,19 +33,19 @@ jobs:

cjs-test:
name: Node.js tests (CommonJS)
timeout-minutes: 5

runs-on: ubuntu-latest
timeout-minutes: 10

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

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} (CommonJS)
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand All @@ -58,9 +58,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
Expand All @@ -36,14 +36,14 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
- run: npm ci
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: '@curveball'
- run: npm publish
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
30 changes: 6 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@ SOURCE_FILES:=$(shell find src/ -type f -name '*.ts')
all: build

.PHONY:build
build: cjs/build esm/build
build: dist/build

.PHONY:test
test:
npx nyc mocha --exit

.PHONY:test-cjs
test-cjs:
mkdir -p cjs-test
cd test; npx tsc --module commonjs --outdir ../cjs-test
echo '{"type": "commonjs", "dependencies": {"node-fetch": "^2"}}' > cjs-test/package.json
cp test/polyfills.cjs cjs-test/
cd cjs-test; npm i;
cd cjs-test; npx mocha --exit --no-package --r polyfills.cjs
npx nyc mocha

.PHONY:lint
lint:
Expand All @@ -39,17 +30,8 @@ start: build

.PHONY:clean
clean:
rm -rf dist esm cjs cjs-test

cjs/build: $(SOURCE_FILES)
npx tsc --module commonjs --outDir cjs/
echo '{"type": "commonjs"}' > cjs/package.json
@# Creating a small file to keep track of the last build time
touch cjs/build

rm -rf dist

esm/build: $(SOURCE_FILES)
npx tsc --module es2022 --outDir esm/
echo '{"type": "module"}' > esm/package.json
@# Creating a small file to keep track of the last build time
touch esm/build
dist/build: $(SOURCE_FILES)
npx tsc
touch dist/build
15 changes: 13 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

1.0.0 (????-??-??)
------------------

* Finally! Curveball v1. Only took 6 years.
* CommonJS support has been dropped. The previous version of this library
supported both CommonJS and ESM. The effort of this no longer feels worth it.
ESM is the future, so we're dropping CommonJS.
* Now requires Node 18.


0.21.1 (2023-02-17)
-------------------

Expand Down Expand Up @@ -55,6 +65,7 @@ Identical release as the previous alpha.




0.18.0-alpha.0 (2022-04-09)
---------------------------

Expand Down Expand Up @@ -133,8 +144,8 @@ Happy birthday Mom!
0.14.3 (2020-09-23)
-------------------

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

Expand Down
Loading

0 comments on commit d75d069

Please sign in to comment.