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

chore!: fix build:cjs run script, drop node 12 #471

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14, 16]
node: [14, 16, 18]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 14
- run: npm install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
4 changes: 2 additions & 2 deletions .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"html",
"text"
],
"lines": 99.5,
"lines": 99.4,
"branches": "97",
"statements": "99.5"
"statements": "99.4"
}
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { readFileSync } from 'fs'
// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
? Number(process.env.YARGS_MIN_NODE_VERSION)
: 12
: 14
const nodeVersion = process?.versions?.node ?? process?.version?.slice(1)
if (nodeVersion) {
const major = Number(nodeVersion.match(/^([^.]+)/)![1])
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
"pretest": "rimraf build && tsc -p tsconfig.test.json && npm run build:cjs -- --environment NODE_ENV:test",
"test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
"test:esm": "c8 --reporter=text --reporter=html mocha test/*.mjs",
"test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'",
Expand Down Expand Up @@ -51,28 +51,26 @@
"author": "Ben Coe <[email protected]>",
"license": "ISC",
"devDependencies": {
"@rollup/plugin-typescript": "^11.0.0",
"@types/chai": "^4.2.11",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.4",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"c8": "^7.3.0",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"eslint": "^7.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"gts": "^3.0.0",
"mocha": "^10.0.0",
"puppeteer": "^16.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.22.1",
"rollup": "^3.18.0",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-ts": "^3.0.2",
"serve": "^14.0.0",
"standardx": "^7.0.0",
"start-server-and-test": "^1.11.2",
"ts-transform-default-export": "^1.0.2",
"typescript": "^4.0.0"
},
"files": [
Expand All @@ -82,7 +80,7 @@
"!*.d.cts"
],
"engines": {
"node": ">=12"
"node": ">=14"
},
"standardx": {
"ignore": [
Expand Down
9 changes: 2 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import cleanup from 'rollup-plugin-cleanup'
import ts from 'rollup-plugin-ts'
import transformDefaultExport from 'ts-transform-default-export'
import typescript from '@rollup/plugin-typescript'

const output = {
format: 'cjs',
Expand All @@ -14,11 +13,7 @@ export default {
input: './lib/index.ts',
output,
plugins: [
ts({
transformers: ({ program }) => ({
afterDeclarations: transformDefaultExport(program)
})
}),
typescript(),
cleanup({
comments: 'none',
extensions: ['*']
Expand Down