Skip to content

Commit b84e7b7

Browse files
authored
Update dependencies, CI workflows and require Node.js 20 / 22 / 24
* Remove support for Node.js 18 and 21 * Upgrade XO * Update dev dependencies * Break out AVA and c8 config into their own files * Upgrade execa * Update CI workflow * Pin node and npm versions using Volta * Automate releases
1 parent 87afe23 commit b84e7b7

File tree

14 files changed

+164
-38
lines changed

14 files changed

+164
-38
lines changed

.c8rc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"all": true,
3+
"include": "index.js",
4+
"reporter": [
5+
"html",
6+
"lcov",
7+
"text"
8+
]
9+
}

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@ on:
33
push:
44
branches:
55
- main
6+
tags:
7+
- 'v*'
68
pull_request:
79
paths-ignore:
810
- '*.md'
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
914
jobs:
1015
nodejs:
1116
name: Node.js
1217
runs-on: ${{ matrix.os }}
1318
strategy:
1419
fail-fast: false
1520
matrix:
16-
node-version: [^18.18, ^20.8, ^21, ^22, ^24]
21+
node-version: [^20.8, ^22, ^24]
1722
os: [ubuntu-latest, windows-latest]
1823
steps:
1924
- uses: actions/checkout@v4
@@ -26,3 +31,4 @@ jobs:
2631
with:
2732
files: coverage/lcov.info
2833
name: ${{ matrix.os }}/${{ matrix.node-version }}
34+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Release tag (e.g., v1.2.3)'
10+
required: true
11+
type: string
12+
skip_ci_check:
13+
description: 'Skip CI status check'
14+
required: false
15+
type: boolean
16+
default: false
17+
18+
permissions:
19+
contents: write
20+
id-token: write
21+
22+
jobs:
23+
release:
24+
name: Release
25+
runs-on: ubuntu-latest
26+
environment: npm
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
32+
fetch-depth: 0
33+
34+
- name: Verify tag matches package.json version
35+
run: |
36+
jq --raw-output --exit-status --arg tag "$RELEASE_TAG" '
37+
if (.version == ($tag | ltrimstr("v"))) then
38+
"Package version (\(.version)) matches tag version (\($tag | ltrimstr("v")))"
39+
else
40+
"Package version (\(.version)) does not match tag version (\($tag | ltrimstr("v")))" | halt_error(1)
41+
end' package.json
42+
env:
43+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
44+
45+
- name: Verify commit is in main branch
46+
run: |
47+
# Check if the tagged commit is included in the main branch
48+
if git merge-base --is-ancestor ${{ github.sha }} origin/main; then
49+
echo "Tagged commit is properly included in main branch"
50+
else
51+
echo "Tagged commit is not included in the main branch"
52+
echo "Please push the commit to main before releasing"
53+
exit 1
54+
fi
55+
56+
- name: Check CI status
57+
if: ${{ !inputs.skip_ci_check }}
58+
run: |
59+
# Check if CI has completed successfully for this commit
60+
gh run list --commit ${{ github.sha }} --status success --json workflowName | jq --raw-output --exit-status '
61+
if any(.[]; .workflowName == "Install and test @ava/typescript") then
62+
"All CI checks have passed!"
63+
else
64+
"CI has not completed successfully for this commit" | halt_error(1)
65+
end'
66+
env:
67+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Setup Node.js
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version-file: package.json
73+
cache: npm
74+
registry-url: https://registry.npmjs.org
75+
76+
- name: Publish to npm with provenance
77+
run: npm publish --provenance
78+
env:
79+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
80+
81+
- name: Create GitHub Release
82+
run: |
83+
gh release create "$RELEASE_TAG" \
84+
--title "$RELEASE_TAG" \
85+
--draft \
86+
--generate-notes
87+
env:
88+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

ava.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const avaConfig = {
2+
files: [
3+
'!test/broken-fixtures/**',
4+
],
5+
watchMode: {
6+
ignoreChanges: [
7+
'test/fixtures/**',
8+
'test/broken-fixtures/**',
9+
],
10+
},
11+
timeout: '60s',
12+
};
13+
14+
export default avaConfig;

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function validate(target, properties) {
3737
}
3838

3939
async function compileTypeScript(projectDirectory) {
40-
return execa('tsc', ['--incremental'], {preferLocal: true, cwd: projectDirectory});
40+
return execa({preferLocal: true, cwd: projectDirectory})`tsc --incremental`;
4141
}
4242

4343
const configProperties = {

package.json

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "5.0.0",
44
"description": "TypeScript provider for AVA",
55
"engines": {
6-
"node": "^18.18 || ^20.8 || ^21 || ^22 || >=24"
6+
"node": "^20.8 || ^22 || >=24"
77
},
88
"files": [
99
"index.js"
@@ -24,38 +24,17 @@
2424
},
2525
"dependencies": {
2626
"escape-string-regexp": "^5.0.0",
27-
"execa": "^8.0.1"
27+
"execa": "^9.6.0"
2828
},
2929
"devDependencies": {
30-
"ava": "^6.1.2",
31-
"c8": "^9.1.0",
32-
"del": "^7.1.0",
33-
"typescript": "^5.4.5",
34-
"xo": "^0.58.0"
30+
"ava": "^6.4.0",
31+
"c8": "^10.1.3",
32+
"del": "^8.0.0",
33+
"typescript": "^5.8.3",
34+
"xo": "^1.1.0"
3535
},
36-
"c8": {
37-
"reporter": [
38-
"html",
39-
"lcov",
40-
"text"
41-
]
42-
},
43-
"ava": {
44-
"files": [
45-
"!test/broken-fixtures/**"
46-
],
47-
"watcher": {
48-
"ignoreChanges": [
49-
"test/fixtures/**",
50-
"test/broken-fixtures/**"
51-
]
52-
},
53-
"timeout": "60s"
54-
},
55-
"xo": {
56-
"ignores": [
57-
"test/broken-fixtures",
58-
"test/fixtures/**/compiled/**"
59-
]
36+
"volta": {
37+
"node": "22.16.0",
38+
"npm": "11.4.2"
6039
}
6140
}

test/broken-fixtures/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"compilerOptions": {
3-
"outDir": "typescript/compiled"
3+
"outDir": "typescript/compiled",
4+
"lib": [
5+
"es2022"
6+
]
47
},
58
"include": [
69
"typescript"

test/fixtures/load/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"strictNullChecks": true,
4-
"module": "Node16",
4+
"module": "node18",
55
"outDir": "compiled"
66
},
77
"include": [

test/fixtures/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"compilerOptions": {
33
"strictNullChecks": true,
4+
"lib": [
5+
"es2022",
6+
"dom"
7+
],
48
"outDir": "typescript/compiled"
59
},
610
"include": [

test/protocol-ava-6.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,27 @@ test('main() resolvePossibleOutOfBandCompilationSources() .js but .ts not config
121121

122122
test('main() resolvePossibleOutOfBandCompilationSources() .cjs and .cjs and .cts configured', withProvider, (t, provider) => {
123123
const main = provider.main({config: {extensions: ['cjs', 'cts'], rewritePaths: {'src/': 'build/'}, compile: false}});
124-
t.deepEqual(main.resolvePossibleOutOfBandCompilationSources(path.join(projectDirectory, 'build/foo.cjs')), [path.join(projectDirectory, 'src/foo.cjs'), path.join(projectDirectory, 'src/foo.cts')]);
124+
t.deepEqual(main.resolvePossibleOutOfBandCompilationSources(path.join(projectDirectory, 'build/foo.cjs')), [
125+
path.join(projectDirectory, 'src/foo.cjs'),
126+
path.join(projectDirectory, 'src/foo.cts'),
127+
]);
125128
});
126129

127130
test('main() resolvePossibleOutOfBandCompilationSources() .mjs and .mjs and .mts configured', withProvider, (t, provider) => {
128131
const main = provider.main({config: {extensions: ['mjs', 'mts'], rewritePaths: {'src/': 'build/'}, compile: false}});
129-
t.deepEqual(main.resolvePossibleOutOfBandCompilationSources(path.join(projectDirectory, 'build/foo.mjs')), [path.join(projectDirectory, 'src/foo.mjs'), path.join(projectDirectory, 'src/foo.mts')]);
132+
t.deepEqual(main.resolvePossibleOutOfBandCompilationSources(path.join(projectDirectory, 'build/foo.mjs')), [
133+
path.join(projectDirectory, 'src/foo.mjs'),
134+
path.join(projectDirectory, 'src/foo.mts'),
135+
]);
130136
});
131137

132138
test('main() resolvePossibleOutOfBandCompilationSources() .js and .js, .ts and .tsx configured', withProvider, (t, provider) => {
133139
const main = provider.main({config: {extensions: ['js', 'ts', 'tsx'], rewritePaths: {'src/': 'build/'}, compile: false}});
134-
t.deepEqual(main.resolvePossibleOutOfBandCompilationSources(path.join(projectDirectory, 'build/foo.js')), [path.join(projectDirectory, 'src/foo.js'), path.join(projectDirectory, 'src/foo.ts'), path.join(projectDirectory, 'src/foo.tsx')]);
140+
t.deepEqual(main.resolvePossibleOutOfBandCompilationSources(path.join(projectDirectory, 'build/foo.js')), [
141+
path.join(projectDirectory, 'src/foo.js'),
142+
path.join(projectDirectory, 'src/foo.ts'),
143+
path.join(projectDirectory, 'src/foo.tsx'),
144+
]);
135145
});
136146

137147
test('main() resolvePossibleOutOfBandCompilationSources() returns the first possible path that exists', withProvider, (t, provider) => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy