Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping CommonJS and releasing 1.0 #178

Merged
merged 6 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
- name: Use Bun
uses: antongolub/action-setup-bun@v1
- run: bun install
- run: make build
- run: bun run build
- run: bun run mocha
25 changes: 2 additions & 23 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:

jobs:
node-test:
name: Node.js tests (ESM)
name: Node.js tests

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

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

steps:
Expand All @@ -31,27 +31,6 @@ jobs:
- run: npm run build --if-present
- run: npm test

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

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

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

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} (CommonJS)
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: make test-cjs

lint:
name: Lint

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm ci
- run: npm test

Expand All @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
Expand All @@ -39,11 +39,11 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm ci
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@curveball'
- run: npm publish
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
/node_modules

# typescript output
/esm
/cjs
/dist

# Directory used for running tests in CommonJS mode
/cjs-test
Expand Down
29 changes: 5 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@ SOURCE_FILES:=$(shell find src/ -type f -name '*.ts')
all: build

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

.PHONY:test
test:
npx nyc mocha

.PHONY:test-cjs
test-cjs:
mkdir -p cjs-test
cd test; npx tsc --module commonjs --outdir ../cjs-test
echo '{"type": "commonjs"}' > cjs-test/package.json
cd cjs-test; npx mocha --no-package

.PHONY:lint
lint:
npx eslint --quiet 'src/**/*.ts' 'test/**/*.ts'
Expand All @@ -37,34 +30,22 @@ 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


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
rm -rf dist


dist/build: $(SOURCE_FILES)
npx tsc
touch dist/build

.PHONY:assets
assets: assets/js/html-form-enhancer.js assets/js/serialize-json-form.js

assets/js/html-form-enhancer.js: node_modules/html-form-enhancer/dist/html-form-enhancer.js
mkdir -p assets/js
cp node_modules/html-form-enhancer/dist/html-form-enhancer.* assets/js
touch cjs/build

assets/js/serialize-json-form.js: node_modules/html-form-enhancer/dist/serialize-json-form.js
cp node_modules/html-form-enhancer/dist/serialize-json-form.* assets/js


src/data/iana-links.json:
node util/fetch-link-relation-data.mjs > src/data/iana-links.json
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
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.
* Upgraded to Typescript 5.3.


0.20.5 (2024-01-14)
-------------------

Expand Down
Loading