From 0799283f58843b0f2a6a60802c63d2a4e4c193e5 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 30 Jun 2025 22:01:22 -0700 Subject: [PATCH] feat!: bump `engines` requirement to Node 22 BREAKING CHANGE: bumps required Node.js version to >=22.12.0. ESM-only. --- .github/workflows/test.yml | 3 +-- .nvmrc | 1 + package.json | 12 +++++++----- src/DocsParser.ts | 4 ++-- src/bin.ts | 2 +- src/block-parsers.ts | 2 +- src/index.ts | 2 +- src/markdown-helpers.ts | 6 +++--- tsconfig.json | 12 +----------- yarn.lock | 31 ++++++++++++++++++------------- 10 files changed, 36 insertions(+), 39 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f5cc94..43a63ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,8 +17,7 @@ jobs: strategy: matrix: node-version: - - '22.9' - - '20.11' + - '22.12.x' os: - macos-latest - ubuntu-latest diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..e70b3ae --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.12 \ No newline at end of file diff --git a/package.json b/package.json index 64d62af..a27ac07 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,13 @@ "name": "@electron/docs-parser", "version": "0.0.0-development", "description": "Parse Electron documentation into a machine readable JSON file", - "main": "dist/index.js", + "exports": "./dist/index.js", + "typings": "dist/index.d.ts", "type": "module", "author": "Samuel Attard", "license": "MIT", "engines": { - "node": "^20.11.0 || >= 21.2.0" + "node": ">=22.12.0" }, "publishConfig": { "provenance": true @@ -28,14 +29,15 @@ "dist" ], "devDependencies": { + "@tsconfig/node22": "^22.0.2", "@types/chai": "^4.3.19", "@types/lodash.camelcase": "^4.3.9", - "@types/node": "^22.5.5", + "@types/node": "^22.10.7", "@types/pretty-ms": "^5.0.1", "husky": "^9.1.6", "lint-staged": "^15.2.10", "prettier": "^3.3.3", - "typescript": "^5.6.2", + "typescript": "^5.8.3", "vitest": "^3.0.4" }, "dependencies": { @@ -67,4 +69,4 @@ "url": "https://github.com/electron/docs-parser/issues" }, "homepage": "https://github.com/electron/docs-parser#readme" -} +} \ No newline at end of file diff --git a/src/DocsParser.ts b/src/DocsParser.ts index be947c3..1b5c448 100644 --- a/src/DocsParser.ts +++ b/src/DocsParser.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; import fs from 'node:fs'; import MarkdownIt from 'markdown-it'; -import { Token } from 'markdown-it'; -import * as path from 'path'; +import type Token from 'markdown-it/lib/token.mjs'; +import * as path from 'node:path'; import toCamelCase from 'lodash.camelcase'; import { diff --git a/src/bin.ts b/src/bin.ts index e6e33e6..b6fde55 100755 --- a/src/bin.ts +++ b/src/bin.ts @@ -4,7 +4,7 @@ import chalk from 'chalk'; import fs from 'node:fs'; import { parseArgs } from 'node:util'; import ora from 'ora'; -import * as path from 'path'; +import * as path from 'node:path'; import pretty from 'pretty-ms'; import { parseDocs } from './index.js'; diff --git a/src/block-parsers.ts b/src/block-parsers.ts index 7f20b88..494e6e4 100644 --- a/src/block-parsers.ts +++ b/src/block-parsers.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { Token } from 'markdown-it'; +import type Token from 'markdown-it/lib/token.mjs'; import { parseHeadingTags, diff --git a/src/index.ts b/src/index.ts index df390cc..02f2e2a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import * as path from 'path'; +import * as path from 'node:path'; import { DocsParser } from './DocsParser.js'; type ParseOptions = { diff --git a/src/markdown-helpers.ts b/src/markdown-helpers.ts index 1ff319a..b15afc9 100644 --- a/src/markdown-helpers.ts +++ b/src/markdown-helpers.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { Token } from 'markdown-it'; +import type Token from 'markdown-it/lib/token.mjs'; import { TypeInformation, PropertyDocumentationBlock, @@ -875,10 +875,10 @@ const unconsumedTypedKeyList = ( keys: T, ): T extends null ? null : TypedKeyList => { return keys - ? { + ? ({ consumed: false, keys, - } + } as any) : (null as any); }; diff --git a/tsconfig.json b/tsconfig.json index f950a65..e0ea089 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,10 @@ { + "extends": "@tsconfig/node22/tsconfig.json", "compilerOptions": { - "module": "es2022", - "target": "es2022", - "moduleResolution": "Node", "outDir": "dist", - "lib": [ - "es6", - "es7" - ], - "types": [ - "node" - ], "declaration": true, "sourceMap": true, "rootDir": "src", - "experimentalDecorators": true, "strict": true, "esModuleInterop": true, "incremental": true diff --git a/yarn.lock b/yarn.lock index ad7b063..dc03272 100644 --- a/yarn.lock +++ b/yarn.lock @@ -232,6 +232,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.1.tgz#8078b71fe0d5825dcbf83d52a7dc858b39da165c" integrity sha512-ECyOuDeH3C1I8jH2MK1RtBJW+YPMvSfT0a5NN0nHfQYnDSJ6tUiZH3gzwVP5/Kfh/+Tt7tpWVF9LXNTnhTJ3kA== +"@tsconfig/node22@^22.0.2": + version "22.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node22/-/node22-22.0.2.tgz#1e04e2c5cc946dac787d69bb502462a851ae51b6" + integrity sha512-Kmwj4u8sDRDrMYRoN9FDEcXD8UpBSaPQQ24Gz+Gamqfm7xxn+GBR7ge/Z7pK8OXNGyUzbSwJj+TH6B+DS/epyA== + "@types/chai@^4.3.19": version "4.3.19" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.19.tgz#14519f437361d41e84102ed3fbc922ddace3e228" @@ -277,12 +282,12 @@ resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd" integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg== -"@types/node@^22.5.5": - version "22.5.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.5.tgz#52f939dd0f65fc552a4ad0b392f3c466cc5d7a44" - integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA== +"@types/node@^22.10.7": + version "22.15.34" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.34.tgz#3995a6461d2cfc51c81907da0065fc328f6a459e" + integrity sha512-8Y6E5WUupYy1Dd0II32BsWAx5MWdcnRd8L84Oys3veg1YrYtNtzgO4CFhiBg6MDSjk7Ay36HYOnU7/tuOzIzcw== dependencies: - undici-types "~6.19.2" + undici-types "~6.21.0" "@types/pretty-ms@^5.0.1": version "5.0.1" @@ -1053,20 +1058,20 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -typescript@^5.6.2: - version "5.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" - integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== +typescript@^5.8.3: + version "5.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e" + integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ== uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee" integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A== -undici-types@~6.19.2: - version "6.19.8" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" - integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== +undici-types@~6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" + integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== vite-node@3.0.5: version "3.0.5"