Skip to content
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
16 changes: 16 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Install
description: Install dev dependencies as of DEV_DEPENDENCIES_BEFORE and runtime dependencies at their latest version in range
runs:
using: composite
steps:
- name: Install dev dependencies
shell: bash
run: |
npm pkg delete dependencies
npm install --ignore-scripts --before=$DEV_DEPENDENCIES_BEFORE
git checkout package.json
- name: Install latest runtime dependencies in range
shell: bash
run: |
RUNTIME_DEPENDENCIES=$(node -p "Object.entries(require('./package.json').dependencies).map(([name, range]) => name + '@' + range).join(' ')")
npm install --ignore-scripts --no-save $RUNTIME_DEPENDENCIES pem@$PEM_VERSION @types/node@$TYPES_NODE_VERSION
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
target-branch: v11
schedule:
interval: daily
- package-ecosystem: 'github-actions'
directory: '/'
target-branch: v11
schedule:
# Check for updates to GitHub Actions every weekday
interval: 'daily'
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-minor
- version-update:semver-patch

49 changes: 49 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: main

on:
push:
branches:
- v11

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

env:
DEV_DEPENDENCIES_BEFORE: '2021-06-15'
PEM_VERSION: '1.14.8'
TYPES_NODE_VERSION: '14.18.34'
SKIP_INSTALL_SIMPLE_GIT_HOOKS: true

jobs:
test:
if: |
!startsWith(github.event.head_commit.message, 'chore(release):') &&
!startsWith(github.event.head_commit.message, 'docs:') &&
!startsWith(github.event.head_commit.message, 'ci:')
uses: ./.github/workflows/pull_request.yml

release:
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: lts/*
- name: Install
uses: ./.github/actions/install
- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USERNAME }}"
npm run release
52 changes: 52 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: pull_request

on:
pull_request:
branches:
- v11
workflow_call:

env:
DEV_DEPENDENCIES_BEFORE: '2021-06-15'
PEM_VERSION: '1.14.8'
TYPES_NODE_VERSION: '14.18.34'
SKIP_INSTALL_SIMPLE_GIT_HOOKS: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
# xo 0.34 calls util.isDate, removed in Node.js 23
node-version: 22
- name: Install
uses: ./.github/actions/install
- name: Lint
run: npx xo

test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [lts/*, latest]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- run: node --version && openssl version
- name: Install
uses: ./.github/actions/install
- name: Build
run: npm run build
- name: Test
run: npx nyc --reporter=text ava
37 changes: 0 additions & 37 deletions .github/workflows/test.yml

This file was deleted.

33 changes: 29 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
},
"scripts": {
"test": "xo && npm run build && nyc --reporter=html --reporter=text ava",
"release": "np",
"build": "del-cli dist && tsc",
"prepare": "npm run build"
"prepare": "npm run build",
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
"release": "npm run release:version && npm run release:changelog && npm run release:commit && npm run release:tag",
"release:changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -s",
"release:commit": "git add package.json CHANGELOG.md && git commit -m \"chore(release): $(node -p \"require('./package.json').version\")\"",
"release:github": "npx -y github-generate-release",
"release:tag": "git tag -a v$(node -p \"require('./package.json').version\") -m \"v$(node -p \"require('./package.json').version\")\"",
"release:tags": "git push origin HEAD:v11 --follow-tags",
"release:version": "standard-version --skip.changelog --skip.commit --skip.tag"
},
"files": [
"dist/source"
Expand Down Expand Up @@ -60,6 +67,8 @@
},
"devDependencies": {
"@ava/typescript": "^1.1.1",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@sindresorhus/tsconfig": "^0.7.0",
"@sinonjs/fake-timers": "^6.0.1",
"@types/benchmark": "^1.0.33",
Expand All @@ -74,6 +83,8 @@
"ava": "^3.11.1",
"axios": "^0.20.0",
"benchmark": "^2.1.4",
"ci-publish": "latest",
"conventional-changelog-cli": "latest",
"coveralls": "^3.1.0",
"create-test-server": "^3.0.1",
"del-cli": "^3.0.1",
Expand All @@ -83,13 +94,14 @@
"get-stream": "^6.0.0",
"nock": "^13.0.4",
"node-fetch": "^2.6.0",
"np": "^6.4.0",
"nyc": "^15.1.0",
"p-event": "^4.2.0",
"pem": "^1.14.4",
"pify": "^5.0.0",
"simple-git-hooks": "latest",
"sinon": "^9.0.3",
"slow-stream": "0.0.4",
"standard-version": "latest",
"tempy": "^1.0.0",
"to-readable-stream": "^2.1.0",
"tough-cookie": "^4.0.0",
Expand Down Expand Up @@ -129,5 +141,18 @@
"@typescript-eslint/no-implicit-any-catch": "off"
}
},
"runkitExampleFilename": "./documentation/examples/runkit-example.js"
"runkitExampleFilename": "./documentation/examples/runkit-example.js",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [
0
]
}
},
"simple-git-hooks": {
"commit-msg": "npx commitlint --edit"
}
}
4 changes: 2 additions & 2 deletions test/helpers/invalid-url.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ExecutionContext} from 'ava';
import * as test from 'ava';

export default function invalidUrl(t: ExecutionContext, error: (TypeError & NodeJS.ErrnoException) | undefined, url: string): void {
export default function invalidUrl(t: test.ExecutionContext, error: (TypeError & NodeJS.ErrnoException) | undefined, url: string): void {
t.is(error?.code, 'ERR_INVALID_URL');

if (error?.message === 'Invalid URL') {
Expand Down
Loading