diff --git a/__tests__/cmds/openapi/index.test.ts b/__tests__/cmds/openapi/index.test.ts index 827d0d442..854e59f4c 100644 --- a/__tests__/cmds/openapi/index.test.ts +++ b/__tests__/cmds/openapi/index.test.ts @@ -11,7 +11,7 @@ import { describe, beforeAll, beforeEach, afterEach, it, expect, vi } from 'vite import OpenAPICommand from '../../../src/cmds/openapi/index.js'; import APIError from '../../../src/lib/apiError.js'; import config from '../../../src/lib/config.js'; -import petstoreWeird from '../../__fixtures__/petstore-simple-weird-version.json' assert { type: 'json' }; +import petstoreWeird from '../../__fixtures__/petstore-simple-weird-version.json' with { type: 'json' }; import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js'; import { after, before } from '../../helpers/get-gha-setup.js'; import { after as afterGHAEnv, before as beforeGHAEnv } from '../../helpers/setup-gha-env.js'; diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 6bdb88472..5dea2b022 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,7 +1,7 @@ import prompts from 'prompts'; import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest'; -import pkg from '../package.json' assert { type: 'json' }; +import pkg from '../package.json' with { type: 'json' }; import cli from '../src/index.js'; import conf from '../src/lib/configstore.js'; diff --git a/__tests__/lib/analyzeOas.test.ts b/__tests__/lib/analyzeOas.test.ts index 408cffe91..61ebe82fd 100644 --- a/__tests__/lib/analyzeOas.test.ts +++ b/__tests__/lib/analyzeOas.test.ts @@ -1,6 +1,6 @@ import type { OASDocument } from 'oas/types'; -import petstore from '@readme/oas-examples/3.0/json/petstore.json' assert { type: 'json' }; +import petstore from '@readme/oas-examples/3.0/json/petstore.json' with { type: 'json' }; import { describe, it, expect } from 'vitest'; import analyzeOas, { getSupportedFeatures } from '../../src/lib/analyzeOas.js'; diff --git a/__tests__/lib/fetch.test.ts b/__tests__/lib/fetch.test.ts index 6fb870124..3c56a54d8 100644 --- a/__tests__/lib/fetch.test.ts +++ b/__tests__/lib/fetch.test.ts @@ -2,7 +2,7 @@ import { Headers } from 'node-fetch'; import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest'; -import pkg from '../../package.json' assert { type: 'json' }; +import pkg from '../../package.json' with { type: 'json' }; import readmeAPIFetch, { cleanHeaders, handleRes } from '../../src/lib/readmeAPIFetch.js'; import getAPIMock from '../helpers/get-api-mock.js'; import { after, before } from '../helpers/setup-gha-env.js'; diff --git a/__tests__/lib/getPkgVersion.test.ts b/__tests__/lib/getPkgVersion.test.ts index ded06dd79..a57a3025a 100644 --- a/__tests__/lib/getPkgVersion.test.ts +++ b/__tests__/lib/getPkgVersion.test.ts @@ -2,7 +2,7 @@ import nock from 'nock'; import semver from 'semver'; import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest'; -import pkg from '../../package.json' assert { type: 'json' }; +import pkg from '../../package.json' with { type: 'json' }; import { getNodeVersion, getPkgVersion } from '../../src/lib/getPkgVersion.js'; describe('#getNodeVersion()', () => { diff --git a/__tests__/single-threaded/lib/createGHA.test.ts b/__tests__/single-threaded/lib/createGHA.test.ts index f51e19983..0f87c7b5d 100644 --- a/__tests__/single-threaded/lib/createGHA.test.ts +++ b/__tests__/single-threaded/lib/createGHA.test.ts @@ -19,7 +19,7 @@ import createGHA, { getConfigStoreKey, getGHAFileName, getGitData, git } from '. import { getMajorPkgVersion } from '../../../src/lib/getPkgVersion.js'; import { after, before } from '../../helpers/get-gha-setup.js'; import getGitRemoteMock from '../../helpers/get-git-mock.js'; -import ghaWorkflowSchema from '../../helpers/github-workflow-schema.json' assert { type: 'json' }; +import ghaWorkflowSchema from '../../helpers/github-workflow-schema.json' with { type: 'json' }; const testWorkingDir = process.cwd(); diff --git a/bin/set-action-image.js b/bin/set-action-image.js index b0410610f..60d89be85 100755 --- a/bin/set-action-image.js +++ b/bin/set-action-image.js @@ -5,7 +5,7 @@ import fs from 'node:fs/promises'; // eslint-disable-next-line import/no-extraneous-dependencies import jsYaml from 'js-yaml'; -import pkg from '../package.json' assert { type: 'json' }; +import pkg from '../package.json' with { type: 'json' }; /** * Updates our `action.yml` file so it properly points to diff --git a/bin/set-major-version-tag.js b/bin/set-major-version-tag.js index 97b351f68..e60997f0e 100755 --- a/bin/set-major-version-tag.js +++ b/bin/set-major-version-tag.js @@ -5,7 +5,7 @@ import util from 'node:util'; import { parse } from 'semver'; -import pkg from '../package.json' assert { type: 'json' }; +import pkg from '../package.json' with { type: 'json' }; const execFile = util.promisify(unpromisifiedExecFile); diff --git a/package.json b/package.json index aaa067ece..6b486cde9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "MIT", "author": "ReadMe (https://readme.com)", "engines": { - "node": ">=18" + "node": "^18.20.0 || >=20.10.0" }, "bin": { "rdme": "bin/rdme.js" diff --git a/src/cli.ts b/src/cli.ts index 3380a0733..17c8b4d6b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -3,7 +3,7 @@ import * as core from '@actions/core'; import chalk from 'chalk'; import updateNotifier from 'update-notifier'; -import pkg from '../package.json' assert { type: 'json' }; +import pkg from '../package.json' with { type: 'json' }; import { isGHA } from './lib/isCI.js'; diff --git a/src/index.ts b/src/index.ts index 45f3b1951..99c0647af 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,7 @@ import chalk from 'chalk'; import cliArgs from 'command-line-args'; import parseArgsStringToArgv from 'string-argv'; -import pkg from '../package.json' assert { type: 'json' }; +import pkg from '../package.json' with { type: 'json' }; import * as commands from './lib/commands.js'; import config from './lib/config.js'; diff --git a/src/lib/config.ts b/src/lib/config.ts index bf8d11d1b..f28a59b80 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -1,4 +1,4 @@ -import pkg from '../../package.json' assert { type: 'json' }; +import pkg from '../../package.json' with { type: 'json' }; const config = { cli: pkg.name, diff --git a/src/lib/configstore.ts b/src/lib/configstore.ts index c5508b444..05d4250a9 100644 --- a/src/lib/configstore.ts +++ b/src/lib/configstore.ts @@ -1,6 +1,6 @@ import Configstore from 'configstore'; -import pkg from '../../package.json' assert { type: 'json' }; +import pkg from '../../package.json' with { type: 'json' }; const configstore = new Configstore( /** diff --git a/src/lib/getPkgVersion.ts b/src/lib/getPkgVersion.ts index 91728fb4c..9a05333af 100644 --- a/src/lib/getPkgVersion.ts +++ b/src/lib/getPkgVersion.ts @@ -2,7 +2,7 @@ import fetch from 'node-fetch'; import semver from 'semver'; -import pkg from '../../package.json' assert { type: 'json' }; +import pkg from '../../package.json' with { type: 'json' }; import { error } from './logger.js'; @@ -18,13 +18,13 @@ type npmDistTag = 'latest'; * * @example 14 */ -export function getNodeVersion() { +export function getNodeVersion(): string { const { node } = pkg.engines; const parsedVersion = semver.minVersion(node); if (!parsedVersion) { throw new Error('`version` value in package.json is invalid'); } - return parsedVersion.major; + return parsedVersion.version; } /** diff --git a/src/lib/readmeAPIFetch.ts b/src/lib/readmeAPIFetch.ts index 153b2d5f2..25823bc96 100644 --- a/src/lib/readmeAPIFetch.ts +++ b/src/lib/readmeAPIFetch.ts @@ -6,7 +6,7 @@ import path from 'node:path'; import mime from 'mime-types'; import nodeFetch, { Headers } from 'node-fetch'; // eslint-disable-line no-restricted-imports -import pkg from '../../package.json' assert { type: 'json' }; +import pkg from '../../package.json' with { type: 'json' }; import APIError from './apiError.js'; import config from './config.js';