From e988e268e36dbb015f392e6666af1c93d5195bde Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 11:38:52 -0800 Subject: [PATCH 01/11] Convert package to ESM --- .eslintrc.js => .eslintrc.cjs | 14 ++++++++++++++ .prettierrc.js => .prettierrc.cjs | 0 bin/create-release-branch.js | 4 ++-- jest.config.js | 3 ++- package.json | 4 +++- tsconfig.json | 4 ++-- 6 files changed, 23 insertions(+), 6 deletions(-) rename .eslintrc.js => .eslintrc.cjs (71%) rename .prettierrc.js => .prettierrc.cjs (100%) diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 71% rename from .eslintrc.js rename to .eslintrc.cjs index 778d9c32..1c303b73 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -3,6 +3,20 @@ module.exports = { extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'], + env: { + // See parserOptions comment + es2022: true, + }, + + parserOptions: { + // We've had issues with the corresponding env setting being overriden. + // As for the specific choice, at the time of writing most of our codebase + // is on Node 16, and ES2022 is the latest version that's mostly compatible + // with Node 16 per https://node.green/. + ecmaVersion: '2022', + sourceType: 'module', + }, + rules: { // This makes integration tests easier to read by allowing setup code and // assertions to be grouped together better diff --git a/.prettierrc.js b/.prettierrc.cjs similarity index 100% rename from .prettierrc.js rename to .prettierrc.cjs diff --git a/bin/create-release-branch.js b/bin/create-release-branch.js index d714c913..63a3047d 100755 --- a/bin/create-release-branch.js +++ b/bin/create-release-branch.js @@ -1,4 +1,4 @@ #!/usr/bin/env node -/* eslint-disable-next-line import/no-unassigned-import,import/no-unresolved */ -require('../dist/cli'); +// eslint-disable-next-line import/no-unassigned-import +import '../dist/cli'; diff --git a/jest.config.js b/jest.config.js index be55ba20..733c2cac 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,8 @@ * https://jestjs.io/docs/configuration */ -module.exports = { +// eslint-disable-next-line import/no-anonymous-default-export +export default { // All imported modules in your tests should be mocked automatically // automock: false, diff --git a/package.json b/package.json index 3f0ad61c..3b3cd946 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "type": "git", "url": "https://github.com/MetaMask/create-release-branch.git" }, + "type": "module", + "exports": null, "bin": "bin/create-release-branch.js", "files": [ "bin/", @@ -71,7 +73,7 @@ }, "packageManager": "yarn@3.2.1", "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "publishConfig": { "access": "public", diff --git a/tsconfig.json b/tsconfig.json index ce8d744f..3035e708 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,13 +4,13 @@ "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, "lib": ["ES2020"], - "module": "CommonJS", + "module": "ES2022", "moduleResolution": "node", "noEmit": true, "noErrorTruncation": true, "skipLibCheck": true, "strict": true, - "target": "es2017" + "target": "ES2022" }, "exclude": ["./dist/**/*", "node_modules"] } From 0d54907118f341eec492cdbecd7a3bf9aff6d3ba Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 11:41:26 -0800 Subject: [PATCH 02/11] Update tested node versions in CI --- .github/workflows/build-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 05117f0a..9c381284 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -14,7 +14,7 @@ jobs: YARN_VERSION: ${{ steps.yarn-version.outputs.YARN_VERSION }} strategy: matrix: - node-version: [14.x, 16.x, 18.x, 19.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} @@ -41,7 +41,7 @@ jobs: - prepare strategy: matrix: - node-version: [14.x, 16.x, 18.x, 19.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} @@ -69,7 +69,7 @@ jobs: - prepare strategy: matrix: - node-version: [14.x, 16.x, 18.x, 19.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} @@ -103,7 +103,7 @@ jobs: - prepare strategy: matrix: - node-version: [14.x, 16.x, 18.x, 19.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} From 717f9a397babea8666d8689420506796671ffc20 Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 11:44:11 -0800 Subject: [PATCH 03/11] Ignore import/no-unresolved in /bin --- bin/create-release-branch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/create-release-branch.js b/bin/create-release-branch.js index 63a3047d..549727e7 100755 --- a/bin/create-release-branch.js +++ b/bin/create-release-branch.js @@ -1,4 +1,4 @@ #!/usr/bin/env node -// eslint-disable-next-line import/no-unassigned-import +// eslint-disable-next-line import/no-unassigned-import,import/no-unresolved import '../dist/cli'; From 23b4a72de724f7869ad6f5a86f47c0f640175e5d Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 16:06:27 -0800 Subject: [PATCH 04/11] Disable git GPG signing in tests --- tests/functional/helpers/repo.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/helpers/repo.ts b/tests/functional/helpers/repo.ts index 7105e62a..54872c73 100644 --- a/tests/functional/helpers/repo.ts +++ b/tests/functional/helpers/repo.ts @@ -218,12 +218,14 @@ export default abstract class Repo { /** * Custom logic with which to further initialize the repo after it is created. - * By default, this configures Git to use an email and name for commits. + * By default, this configures Git to use an email and name for commits, and + * disables GPG signing, which may cause problems in local environments. * Can be overridden in subclasses. */ protected async afterCreate(): Promise { await this.runCommand('git', ['config', 'user.email', 'test@example.com']); await this.runCommand('git', ['config', 'user.name', 'Test User']); + await this.runCommand('git', ['config', 'commit.gpgsign', 'false']); } /** From fc292479926403772563dc2f6c56c0978c8e8b3b Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 16:19:57 -0800 Subject: [PATCH 05/11] Use moduleResolution: NodeNext --- src/cli.ts | 2 +- src/editor.test.ts | 6 ++--- src/editor.ts | 4 ++-- src/env.test.ts | 2 +- src/fs.test.ts | 4 ++-- src/fs.ts | 2 +- src/functional.test.ts | 4 ++-- src/initial-parameters.test.ts | 10 ++++----- src/initial-parameters.ts | 6 ++--- src/main.test.ts | 8 +++---- src/main.ts | 4 ++-- src/misc-utils.test.ts | 2 +- src/monorepo-workflow-operations.test.ts | 22 +++++++++---------- src/monorepo-workflow-operations.ts | 14 ++++++------ src/package-manifest.test.ts | 4 ++-- src/package-manifest.ts | 6 ++--- src/package.test.ts | 12 +++++----- src/package.ts | 14 ++++++------ src/project.test.ts | 13 ++++++----- src/project.ts | 10 ++++----- src/release-plan.test.ts | 8 +++---- src/release-plan.ts | 10 ++++----- src/release-specification.test.ts | 8 +++---- src/release-specification.ts | 10 ++++----- src/repo.test.ts | 4 ++-- src/repo.ts | 2 +- tests/functional/helpers/environment.ts | 6 ++--- tests/functional/helpers/local-monorepo.ts | 6 ++--- tests/functional/helpers/local-repo.ts | 4 ++-- .../helpers/monorepo-environment.ts | 8 +++---- tests/functional/helpers/remote-repo.ts | 2 +- tests/functional/helpers/repo.ts | 4 ++-- tests/functional/helpers/with.ts | 4 ++-- tests/setupAfterEnv.ts | 2 +- tests/unit/helpers.ts | 8 +++---- tsconfig.json | 4 ++-- 36 files changed, 121 insertions(+), 118 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index f01666a6..efc326b1 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,4 +1,4 @@ -import { main } from './main'; +import { main } from './main.js'; /** * The entrypoint to this tool. diff --git a/src/editor.test.ts b/src/editor.test.ts index 728774f6..70b8a957 100644 --- a/src/editor.test.ts +++ b/src/editor.test.ts @@ -1,7 +1,7 @@ import { when } from 'jest-when'; -import { determineEditor } from './editor'; -import * as envModule from './env'; -import * as miscUtils from './misc-utils'; +import { determineEditor } from './editor.js'; +import * as envModule from './env.js'; +import * as miscUtils from './misc-utils.js'; jest.mock('./env'); jest.mock('./misc-utils'); diff --git a/src/editor.ts b/src/editor.ts index 55b9fd1a..ba1b376a 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -1,5 +1,5 @@ -import { getEnvironmentVariables } from './env'; -import { debug, resolveExecutable } from './misc-utils'; +import { getEnvironmentVariables } from './env.js'; +import { debug, resolveExecutable } from './misc-utils.js'; /** * Information about the editor present on the user's computer. diff --git a/src/env.test.ts b/src/env.test.ts index 02f334a5..5a8c6f4e 100644 --- a/src/env.test.ts +++ b/src/env.test.ts @@ -1,4 +1,4 @@ -import { getEnvironmentVariables } from './env'; +import { getEnvironmentVariables } from './env.js'; describe('env', () => { describe('getEnvironmentVariables', () => { diff --git a/src/fs.test.ts b/src/fs.test.ts index 1b86822f..474a6039 100644 --- a/src/fs.test.ts +++ b/src/fs.test.ts @@ -3,7 +3,7 @@ import path from 'path'; import { rimraf } from 'rimraf'; import { when } from 'jest-when'; import * as actionUtils from '@metamask/action-utils'; -import { withSandbox } from '../tests/helpers'; +import { withSandbox } from '../tests/helpers.js'; import { readFile, writeFile, @@ -12,7 +12,7 @@ import { fileExists, ensureDirectoryPathExists, removeFile, -} from './fs'; +} from './fs.js'; jest.mock('@metamask/action-utils'); diff --git a/src/fs.ts b/src/fs.ts index acbcf6c7..c9afd136 100644 --- a/src/fs.ts +++ b/src/fs.ts @@ -3,7 +3,7 @@ import { readJsonObjectFile as underlyingReadJsonObjectFile, writeJsonFile as underlyingWriteJsonFile, } from '@metamask/action-utils'; -import { wrapError, isErrorWithCode } from './misc-utils'; +import { wrapError, isErrorWithCode } from './misc-utils.js'; /** * Represents a writeable stream, such as that represented by `process.stdout` diff --git a/src/functional.test.ts b/src/functional.test.ts index ceb6aafb..602d628a 100644 --- a/src/functional.test.ts +++ b/src/functional.test.ts @@ -1,5 +1,5 @@ -import { withMonorepoProjectEnvironment } from '../tests/functional/helpers/with'; -import { buildChangelog } from '../tests/functional/helpers/utils'; +import { withMonorepoProjectEnvironment } from '../tests/functional/helpers/with.js'; +import { buildChangelog } from '../tests/functional/helpers/utils.js'; jest.setTimeout(10_000); diff --git a/src/initial-parameters.test.ts b/src/initial-parameters.test.ts index 7b765830..2c644d93 100644 --- a/src/initial-parameters.test.ts +++ b/src/initial-parameters.test.ts @@ -5,11 +5,11 @@ import { buildMockProject, buildMockPackage, createNoopWriteStream, -} from '../tests/unit/helpers'; -import { determineInitialParameters } from './initial-parameters'; -import * as commandLineArgumentsModule from './command-line-arguments'; -import * as envModule from './env'; -import * as projectModule from './project'; +} from '../tests/unit/helpers.js'; +import { determineInitialParameters } from './initial-parameters.js'; +import * as commandLineArgumentsModule from './command-line-arguments.js'; +import * as envModule from './env.js'; +import * as projectModule from './project.js'; jest.mock('./command-line-arguments'); jest.mock('./env'); diff --git a/src/initial-parameters.ts b/src/initial-parameters.ts index a6086a3d..2a6a6993 100644 --- a/src/initial-parameters.ts +++ b/src/initial-parameters.ts @@ -1,8 +1,8 @@ import os from 'os'; import path from 'path'; -import { readCommandLineArguments } from './command-line-arguments'; -import { WriteStreamLike } from './fs'; -import { readProject, Project } from './project'; +import { readCommandLineArguments } from './command-line-arguments.js'; +import { WriteStreamLike } from './fs.js'; +import { readProject, Project } from './project.js'; /** * The type of release being created as determined by the parent release. diff --git a/src/main.test.ts b/src/main.test.ts index 82dff548..f2147360 100644 --- a/src/main.test.ts +++ b/src/main.test.ts @@ -1,8 +1,8 @@ import fs from 'fs'; -import { buildMockProject } from '../tests/unit/helpers'; -import { main } from './main'; -import * as initialParametersModule from './initial-parameters'; -import * as monorepoWorkflowOperations from './monorepo-workflow-operations'; +import { buildMockProject } from '../tests/unit/helpers.js'; +import { main } from './main.js'; +import * as initialParametersModule from './initial-parameters.js'; +import * as monorepoWorkflowOperations from './monorepo-workflow-operations.js'; jest.mock('./initial-parameters'); jest.mock('./monorepo-workflow-operations'); diff --git a/src/main.ts b/src/main.ts index 7c5e8768..b54955aa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import type { WriteStream } from 'fs'; -import { determineInitialParameters } from './initial-parameters'; -import { followMonorepoWorkflow } from './monorepo-workflow-operations'; +import { determineInitialParameters } from './initial-parameters.js'; +import { followMonorepoWorkflow } from './monorepo-workflow-operations.js'; /** * The main function for this tool. Designed to not access `process.argv`, diff --git a/src/misc-utils.test.ts b/src/misc-utils.test.ts index bf185b10..e8412c80 100644 --- a/src/misc-utils.test.ts +++ b/src/misc-utils.test.ts @@ -9,7 +9,7 @@ import { runCommand, getStdoutFromCommand, getLinesFromCommand, -} from './misc-utils'; +} from './misc-utils.js'; jest.mock('which'); jest.mock('execa'); diff --git a/src/monorepo-workflow-operations.test.ts b/src/monorepo-workflow-operations.test.ts index e1c1e20d..c4bed39c 100644 --- a/src/monorepo-workflow-operations.test.ts +++ b/src/monorepo-workflow-operations.test.ts @@ -2,17 +2,17 @@ import fs from 'fs'; import path from 'path'; import { when } from 'jest-when'; import { MockWritable } from 'stdio-mock'; -import { withSandbox, Sandbox, isErrorWithCode } from '../tests/helpers'; -import { buildMockProject, Require } from '../tests/unit/helpers'; -import { followMonorepoWorkflow } from './monorepo-workflow-operations'; -import * as editorModule from './editor'; -import type { Editor } from './editor'; -import { ReleaseType } from './initial-parameters'; -import * as releaseSpecificationModule from './release-specification'; -import type { ReleaseSpecification } from './release-specification'; -import * as releasePlanModule from './release-plan'; -import type { ReleasePlan } from './release-plan'; -import * as repoModule from './repo'; +import { withSandbox, Sandbox, isErrorWithCode } from '../tests/helpers.js'; +import { buildMockProject, Require } from '../tests/unit/helpers.js'; +import { followMonorepoWorkflow } from './monorepo-workflow-operations.js'; +import * as editorModule from './editor.js'; +import type { Editor } from './editor.js'; +import { ReleaseType } from './initial-parameters.js'; +import * as releaseSpecificationModule from './release-specification.js'; +import type { ReleaseSpecification } from './release-specification.js'; +import * as releasePlanModule from './release-plan.js'; +import type { ReleasePlan } from './release-plan.js'; +import * as repoModule from './repo.js'; jest.mock('./editor'); jest.mock('./release-plan'); diff --git a/src/monorepo-workflow-operations.ts b/src/monorepo-workflow-operations.ts index 5409ba50..59cd5dc6 100644 --- a/src/monorepo-workflow-operations.ts +++ b/src/monorepo-workflow-operations.ts @@ -5,17 +5,17 @@ import { fileExists, removeFile, writeFile, -} from './fs'; -import { determineEditor } from './editor'; -import { ReleaseType } from './initial-parameters'; -import { Project } from './project'; -import { planRelease, executeReleasePlan } from './release-plan'; -import { captureChangesInReleaseBranch } from './repo'; +} from './fs.js'; +import { determineEditor } from './editor.js'; +import { ReleaseType } from './initial-parameters.js'; +import { Project } from './project.js'; +import { planRelease, executeReleasePlan } from './release-plan.js'; +import { captureChangesInReleaseBranch } from './repo.js'; import { generateReleaseSpecificationTemplateForMonorepo, waitForUserToEditReleaseSpecification, validateReleaseSpecification, -} from './release-specification'; +} from './release-specification.js'; /** * For a monorepo, the process works like this: diff --git a/src/package-manifest.test.ts b/src/package-manifest.test.ts index 7e051a78..d2ce7888 100644 --- a/src/package-manifest.test.ts +++ b/src/package-manifest.test.ts @@ -1,8 +1,8 @@ import fs from 'fs'; import path from 'path'; import { SemVer } from 'semver'; -import { withSandbox } from '../tests/helpers'; -import { readPackageManifest } from './package-manifest'; +import { withSandbox } from '../tests/helpers.js'; +import { readPackageManifest } from './package-manifest.js'; describe('package-manifest', () => { describe('readPackageManifest', () => { diff --git a/src/package-manifest.ts b/src/package-manifest.ts index a31aba10..facdd617 100644 --- a/src/package-manifest.ts +++ b/src/package-manifest.ts @@ -4,9 +4,9 @@ import { ManifestDependencyFieldNames as PackageManifestDependenciesFieldNames, } from '@metamask/action-utils'; import { isPlainObject } from '@metamask/utils'; -import { readJsonObjectFile } from './fs'; -import { isTruthyString } from './misc-utils'; -import { semver, SemVer } from './semver'; +import { readJsonObjectFile } from './fs.js'; +import { isTruthyString } from './misc-utils.js'; +import { semver, SemVer } from './semver.js'; export { PackageManifestFieldNames, PackageManifestDependenciesFieldNames }; diff --git a/src/package.test.ts b/src/package.test.ts index 78ee319d..2f3d7623 100644 --- a/src/package.test.ts +++ b/src/package.test.ts @@ -4,21 +4,21 @@ import { when } from 'jest-when'; import * as autoChangelog from '@metamask/auto-changelog'; import { SemVer } from 'semver'; import { MockWritable } from 'stdio-mock'; -import { withSandbox } from '../tests/helpers'; +import { withSandbox } from '../tests/helpers.js'; import { buildMockPackage, buildMockProject, buildMockManifest, createNoopWriteStream, -} from '../tests/unit/helpers'; +} from '../tests/unit/helpers.js'; import { readMonorepoRootPackage, readMonorepoWorkspacePackage, updatePackage, -} from './package'; -import * as fsModule from './fs'; -import * as packageManifestModule from './package-manifest'; -import * as repoModule from './repo'; +} from './package.js'; +import * as fsModule from './fs.js'; +import * as packageManifestModule from './package-manifest.js'; +import * as repoModule from './repo.js'; jest.mock('@metamask/auto-changelog'); jest.mock('./package-manifest'); diff --git a/src/package.ts b/src/package.ts index 3e765667..df8e3d9b 100644 --- a/src/package.ts +++ b/src/package.ts @@ -2,17 +2,17 @@ import fs, { WriteStream } from 'fs'; import path from 'path'; import { format } from 'util'; import { updateChangelog } from '@metamask/auto-changelog'; -import { WriteStreamLike, readFile, writeFile, writeJsonFile } from './fs'; -import { isErrorWithCode } from './misc-utils'; +import { WriteStreamLike, readFile, writeFile, writeJsonFile } from './fs.js'; +import { isErrorWithCode } from './misc-utils.js'; import { readPackageManifest, UnvalidatedPackageManifest, ValidatedPackageManifest, -} from './package-manifest'; -import { Project } from './project'; -import { PackageReleasePlan } from './release-plan'; -import { hasChangesInDirectorySinceGitTag } from './repo'; -import { SemVer } from './semver'; +} from './package-manifest.js'; +import { Project } from './project.js'; +import { PackageReleasePlan } from './release-plan.js'; +import { hasChangesInDirectorySinceGitTag } from './repo.js'; +import { SemVer } from './semver.js'; const MANIFEST_FILE_NAME = 'package.json'; const CHANGELOG_FILE_NAME = 'CHANGELOG.md'; diff --git a/src/project.test.ts b/src/project.test.ts index 20bb02f9..f6f2f386 100644 --- a/src/project.test.ts +++ b/src/project.test.ts @@ -3,11 +3,14 @@ import path from 'path'; import { when } from 'jest-when'; import { SemVer } from 'semver'; import * as actionUtils from '@metamask/action-utils'; -import { withSandbox } from '../tests/helpers'; -import { buildMockPackage, createNoopWriteStream } from '../tests/unit/helpers'; -import { readProject } from './project'; -import * as packageModule from './package'; -import * as repoModule from './repo'; +import { withSandbox } from '../tests/helpers.js'; +import { + buildMockPackage, + createNoopWriteStream, +} from '../tests/unit/helpers.js'; +import { readProject } from './project.js'; +import * as packageModule from './package.js'; +import * as repoModule from './repo.js'; jest.mock('./package'); jest.mock('./repo'); diff --git a/src/project.ts b/src/project.ts index 931f3ea1..fc52ae6f 100644 --- a/src/project.ts +++ b/src/project.ts @@ -1,14 +1,14 @@ import { resolve } from 'path'; import { getWorkspaceLocations } from '@metamask/action-utils'; -import { WriteStreamLike } from './fs'; +import { WriteStreamLike } from './fs.js'; import { Package, readMonorepoRootPackage, readMonorepoWorkspacePackage, -} from './package'; -import { getRepositoryHttpsUrl, getTagNames } from './repo'; -import { SemVer } from './semver'; -import { PackageManifestFieldNames } from './package-manifest'; +} from './package.js'; +import { getRepositoryHttpsUrl, getTagNames } from './repo.js'; +import { SemVer } from './semver.js'; +import { PackageManifestFieldNames } from './package-manifest.js'; /** * The release version of the root package of a monorepo extracted from its diff --git a/src/release-plan.test.ts b/src/release-plan.test.ts index d49e9eab..743cd3ed 100644 --- a/src/release-plan.test.ts +++ b/src/release-plan.test.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import { SemVer } from 'semver'; -import { buildMockProject, buildMockPackage } from '../tests/unit/helpers'; -import { planRelease, executeReleasePlan } from './release-plan'; -import { IncrementableVersionParts } from './release-specification'; -import * as packageUtils from './package'; +import { buildMockProject, buildMockPackage } from '../tests/unit/helpers.js'; +import { planRelease, executeReleasePlan } from './release-plan.js'; +import { IncrementableVersionParts } from './release-specification.js'; +import * as packageUtils from './package.js'; jest.mock('./package'); diff --git a/src/release-plan.ts b/src/release-plan.ts index 0ee52235..04e17ff9 100644 --- a/src/release-plan.ts +++ b/src/release-plan.ts @@ -1,10 +1,10 @@ import type { WriteStream } from 'fs'; import { SemVer } from 'semver'; -import { ReleaseType } from './initial-parameters'; -import { debug } from './misc-utils'; -import { Package, updatePackage } from './package'; -import { Project } from './project'; -import { ReleaseSpecification } from './release-specification'; +import { ReleaseType } from './initial-parameters.js'; +import { debug } from './misc-utils.js'; +import { Package, updatePackage } from './package.js'; +import { Project } from './project.js'; +import { ReleaseSpecification } from './release-specification.js'; /** * Instructions for how to update the project in order to prepare it for a new diff --git a/src/release-specification.test.ts b/src/release-specification.test.ts index 3932e3c6..1be176c0 100644 --- a/src/release-specification.test.ts +++ b/src/release-specification.test.ts @@ -4,14 +4,14 @@ import { when } from 'jest-when'; import { MockWritable } from 'stdio-mock'; import YAML from 'yaml'; import { SemVer } from 'semver'; -import { withSandbox } from '../tests/helpers'; -import { buildMockProject, buildMockPackage } from '../tests/unit/helpers'; +import { withSandbox } from '../tests/helpers.js'; +import { buildMockProject, buildMockPackage } from '../tests/unit/helpers.js'; import { generateReleaseSpecificationTemplateForMonorepo, waitForUserToEditReleaseSpecification, validateReleaseSpecification, -} from './release-specification'; -import * as miscUtils from './misc-utils'; +} from './release-specification.js'; +import * as miscUtils from './misc-utils.js'; jest.mock('./misc-utils', () => { return { diff --git a/src/release-specification.ts b/src/release-specification.ts index a81c4ea7..d73a0b8e 100644 --- a/src/release-specification.ts +++ b/src/release-specification.ts @@ -1,17 +1,17 @@ import fs, { WriteStream } from 'fs'; import YAML from 'yaml'; import { diff } from 'semver'; -import { Editor } from './editor'; -import { readFile } from './fs'; +import { Editor } from './editor.js'; +import { readFile } from './fs.js'; import { debug, hasProperty, wrapError, isObject, runCommand, -} from './misc-utils'; -import { Project } from './project'; -import { isValidSemver, semver, SemVer } from './semver'; +} from './misc-utils.js'; +import { Project } from './project.js'; +import { isValidSemver, semver, SemVer } from './semver.js'; /** * The SemVer-compatible parts of a version string that can be bumped by this diff --git a/src/repo.test.ts b/src/repo.test.ts index 667c35e8..edb8c5e8 100644 --- a/src/repo.test.ts +++ b/src/repo.test.ts @@ -4,8 +4,8 @@ import { captureChangesInReleaseBranch, getTagNames, hasChangesInDirectorySinceGitTag, -} from './repo'; -import * as miscUtils from './misc-utils'; +} from './repo.js'; +import * as miscUtils from './misc-utils.js'; jest.mock('./misc-utils'); diff --git a/src/repo.ts b/src/repo.ts index 2741101e..a7384516 100644 --- a/src/repo.ts +++ b/src/repo.ts @@ -3,7 +3,7 @@ import { runCommand, getStdoutFromCommand, getLinesFromCommand, -} from './misc-utils'; +} from './misc-utils.js'; const CHANGED_FILE_PATHS_BY_TAG_NAME: Record = {}; diff --git a/tests/functional/helpers/environment.ts b/tests/functional/helpers/environment.ts index 5530984b..779fe9b3 100644 --- a/tests/functional/helpers/environment.ts +++ b/tests/functional/helpers/environment.ts @@ -1,7 +1,7 @@ import path from 'path'; -import LocalRepo from './local-repo'; -import RemoteRepo from './remote-repo'; -import Repo from './repo'; +import LocalRepo from './local-repo.js'; +import RemoteRepo from './remote-repo.js'; +import Repo from './repo.js'; /** * Describes the package that is used to initialize a polyrepo, or one of the diff --git a/tests/functional/helpers/local-monorepo.ts b/tests/functional/helpers/local-monorepo.ts index 4fdab70f..e7d282a1 100644 --- a/tests/functional/helpers/local-monorepo.ts +++ b/tests/functional/helpers/local-monorepo.ts @@ -1,7 +1,7 @@ import path from 'path'; -import { PackageSpecification } from './environment'; -import LocalRepo, { LocalRepoOptions } from './local-repo'; -import { knownKeysOf } from './utils'; +import { PackageSpecification } from './environment.js'; +import LocalRepo, { LocalRepoOptions } from './local-repo.js'; +import { knownKeysOf } from './utils.js'; /** * A set of configuration options for a {@link LocalMonorepo}. In addition diff --git a/tests/functional/helpers/local-repo.ts b/tests/functional/helpers/local-repo.ts index 39227e2c..22f62bdc 100644 --- a/tests/functional/helpers/local-repo.ts +++ b/tests/functional/helpers/local-repo.ts @@ -1,6 +1,6 @@ import path from 'path'; -import Repo, { RepoOptions } from './repo'; -import { buildChangelog } from './utils'; +import Repo, { RepoOptions } from './repo.js'; +import { buildChangelog } from './utils.js'; /** * A set of configuration options for a {@link LocalRepo}. In addition to the diff --git a/tests/functional/helpers/monorepo-environment.ts b/tests/functional/helpers/monorepo-environment.ts index 5afb949c..b39e422d 100644 --- a/tests/functional/helpers/monorepo-environment.ts +++ b/tests/functional/helpers/monorepo-environment.ts @@ -2,13 +2,13 @@ import fs from 'fs'; import path from 'path'; import { ExecaReturnValue } from 'execa'; import YAML from 'yaml'; -import { TOOL_EXECUTABLE_PATH, TS_NODE_PATH } from './constants'; +import { TOOL_EXECUTABLE_PATH, TS_NODE_PATH } from './constants.js'; import Environment, { EnvironmentOptions, PackageSpecification, -} from './environment'; -import LocalMonorepo from './local-monorepo'; -import { debug, knownKeysOf } from './utils'; +} from './environment.js'; +import LocalMonorepo from './local-monorepo.js'; +import { debug, knownKeysOf } from './utils.js'; /** * A set of configuration options for a {@link MonorepoEnvironment}. In addition diff --git a/tests/functional/helpers/remote-repo.ts b/tests/functional/helpers/remote-repo.ts index 2a3c1e7c..94dafdbc 100644 --- a/tests/functional/helpers/remote-repo.ts +++ b/tests/functional/helpers/remote-repo.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import Repo from './repo'; +import Repo from './repo.js'; /** * A facade for the "remote" repo, which only exists so that the tool can run diff --git a/tests/functional/helpers/repo.ts b/tests/functional/helpers/repo.ts index 54872c73..ea632ea0 100644 --- a/tests/functional/helpers/repo.ts +++ b/tests/functional/helpers/repo.ts @@ -2,8 +2,8 @@ import fs from 'fs'; import path from 'path'; import execa, { ExecaChildProcess, Options as ExecaOptions } from 'execa'; import deepmerge from 'deepmerge'; -import { isErrorWithCode } from '../../helpers'; -import { debug, sleepFor } from './utils'; +import { isErrorWithCode } from '../../helpers.js'; +import { debug, sleepFor } from './utils.js'; /** * A set of configuration options for a {@link Repo}. diff --git a/tests/functional/helpers/with.ts b/tests/functional/helpers/with.ts index 1095c83d..53659177 100644 --- a/tests/functional/helpers/with.ts +++ b/tests/functional/helpers/with.ts @@ -1,7 +1,7 @@ -import { withSandbox } from '../../helpers'; +import { withSandbox } from '../../helpers.js'; import MonorepoEnvironment, { MonorepoEnvironmentOptions, -} from './monorepo-environment'; +} from './monorepo-environment.js'; /** * Runs the given function and ensures that even if `process.env` is changed diff --git a/tests/setupAfterEnv.ts b/tests/setupAfterEnv.ts index 4e74b5f6..3ff14471 100644 --- a/tests/setupAfterEnv.ts +++ b/tests/setupAfterEnv.ts @@ -1,5 +1,5 @@ import type { ExecaReturnValue } from 'execa'; -import { isExecaError } from './helpers'; +import { isExecaError } from './helpers.js'; /** * Matches a series of lines that represent a stack trace (by looking for the diff --git a/tests/unit/helpers.ts b/tests/unit/helpers.ts index 77ec41eb..0527b153 100644 --- a/tests/unit/helpers.ts +++ b/tests/unit/helpers.ts @@ -2,13 +2,13 @@ import fs from 'fs'; import path from 'path'; import { SemVer } from 'semver'; import { isPlainObject } from '@metamask/utils'; -import type { Package } from '../../src/package'; +import type { Package } from '../../src/package.js'; import { PackageManifestDependenciesFieldNames, PackageManifestFieldNames, -} from '../../src/package-manifest'; -import type { ValidatedPackageManifest } from '../../src/package-manifest'; -import type { Project } from '../../src/project'; +} from '../../src/package-manifest.js'; +import type { ValidatedPackageManifest } from '../../src/package-manifest.js'; +import type { Project } from '../../src/project.js'; /** * Returns a version of the given record type where optionality is removed from diff --git a/tsconfig.json b/tsconfig.json index 3035e708..ba8dbd7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,9 @@ "esModuleInterop": true, "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, - "lib": ["ES2020"], + "lib": ["ES2022"], "module": "ES2022", - "moduleResolution": "node", + "moduleResolution": "NodeNext", "noEmit": true, "noErrorTruncation": true, "skipLibCheck": true, From e5eb67fceaaf730242c85b68c75cc3f5d773ea4c Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 20:49:08 -0800 Subject: [PATCH 06/11] Tests passing --- jest.config.js | 6 +++- package.json | 2 +- tsconfig.json | 3 +- yarn.lock | 90 ++++++++++++++++---------------------------------- 4 files changed, 37 insertions(+), 64 deletions(-) diff --git a/jest.config.js b/jest.config.js index 733c2cac..f31ac5d9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -88,7 +88,11 @@ export default { // ], // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // moduleNameMapper: {}, + moduleNameMapper: { + // Strip the file extension from imports, so that e.g. `import { foo } from './foo.js'` + // becomes `import { foo } from './foo'`. This is for compatibility with ESM. + '^(\\.\\.?\\/.+)\\.js$': '$1', + }, // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader // modulePathIgnorePatterns: [], diff --git a/package.json b/package.json index 3b3cd946..0c10c48c 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "@metamask/action-utils": "^1.0.0", - "@metamask/utils": "^8.1.0", + "@metamask/utils": "^8.2.1", "debug": "^4.3.4", "execa": "^5.1.1", "pony-cause": "^2.1.9", diff --git a/tsconfig.json b/tsconfig.json index ba8dbd7f..b5293324 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,6 @@ "strict": true, "target": "ES2022" }, - "exclude": ["./dist/**/*", "node_modules"] + "exclude": ["./dist/**/*", "node_modules"], + "ts-node": { "esm": true } } diff --git a/yarn.lock b/yarn.lock index c6f96316..4424cdb1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -410,33 +410,6 @@ __metadata: languageName: node linkType: hard -"@chainsafe/as-sha256@npm:^0.4.1": - version: 0.4.1 - resolution: "@chainsafe/as-sha256@npm:0.4.1" - checksum: 6d86975e648ecdafd366802278ac15b392b252e967f3681412ec48b5a3518b936cc5e977517499882b084991446d25787d98f8f585891943688cc81549a44e9a - languageName: node - linkType: hard - -"@chainsafe/persistent-merkle-tree@npm:^0.6.1": - version: 0.6.1 - resolution: "@chainsafe/persistent-merkle-tree@npm:0.6.1" - dependencies: - "@chainsafe/as-sha256": ^0.4.1 - "@noble/hashes": ^1.3.0 - checksum: 74614b8d40970dc930d5bf741619498b0bbbde5ff24ce45fce6ad122143aa77bf57249a28175b1b972cf56bff57d529a4258b7222ab4e60c1261119b5986c51b - languageName: node - linkType: hard - -"@chainsafe/ssz@npm:^0.11.1": - version: 0.11.1 - resolution: "@chainsafe/ssz@npm:0.11.1" - dependencies: - "@chainsafe/as-sha256": ^0.4.1 - "@chainsafe/persistent-merkle-tree": ^0.6.1 - checksum: e3c2928f9ab4a0544e645f0302b9535046d1e6e1d4b3bd1c3dd6bc8e6302fddad6036d65e7900d1446f285f496051da05fa14c1bde590b511d03033907175c8f - languageName: node - linkType: hard - "@cspotcode/source-map-support@npm:^0.8.0": version: 0.8.1 resolution: "@cspotcode/source-map-support@npm:0.8.1" @@ -499,13 +472,13 @@ __metadata: languageName: node linkType: hard -"@ethereumjs/common@npm:^3.1.2": - version: 3.1.2 - resolution: "@ethereumjs/common@npm:3.1.2" +"@ethereumjs/common@npm:^3.2.0": + version: 3.2.0 + resolution: "@ethereumjs/common@npm:3.2.0" dependencies: - "@ethereumjs/util": ^8.0.6 + "@ethereumjs/util": ^8.1.0 crc-32: ^1.2.0 - checksum: e80a8bc86476f1ce878bacb1915d91681671bb5303291cdcece26e456ac13a6158f0f59625cb02a1cfbdd7c9a7dc8b175f8d8f0fee596b3eb9dfb965465ad43d + checksum: cb9cc11f5c868cb577ba611cebf55046e509218bbb89b47ccce010776dafe8256d70f8f43fab238aec74cf71f62601cd5842bc03a83261200802de365732a14b languageName: node linkType: hard @@ -518,33 +491,26 @@ __metadata: languageName: node linkType: hard -"@ethereumjs/tx@npm:^4.1.2": - version: 4.1.2 - resolution: "@ethereumjs/tx@npm:4.1.2" +"@ethereumjs/tx@npm:^4.2.0": + version: 4.2.0 + resolution: "@ethereumjs/tx@npm:4.2.0" dependencies: - "@chainsafe/ssz": ^0.11.1 - "@ethereumjs/common": ^3.1.2 + "@ethereumjs/common": ^3.2.0 "@ethereumjs/rlp": ^4.0.1 - "@ethereumjs/util": ^8.0.6 + "@ethereumjs/util": ^8.1.0 ethereum-cryptography: ^2.0.0 - peerDependencies: - c-kzg: ^1.0.8 - peerDependenciesMeta: - c-kzg: - optional: true - checksum: ad2fb692c3746cd5935b01c98b6b54046ae2a1fccff57ad2209e10446f3b279a204d7477accf05b27078445b14379314077769662142ac07117c45a5a1ea427f + checksum: 87a3f5f2452cfbf6712f8847525a80c213210ed453c211c793c5df801fe35ecef28bae17fadd222fcbdd94277478a47e52d2b916a90a6b30cda21f1e0cdaee42 languageName: node linkType: hard -"@ethereumjs/util@npm:^8.0.6": - version: 8.0.6 - resolution: "@ethereumjs/util@npm:8.0.6" +"@ethereumjs/util@npm:^8.1.0": + version: 8.1.0 + resolution: "@ethereumjs/util@npm:8.1.0" dependencies: - "@chainsafe/ssz": ^0.11.1 "@ethereumjs/rlp": ^4.0.1 ethereum-cryptography: ^2.0.0 micro-ftch: ^0.3.1 - checksum: 034e06cddec27417318434a1a7cd7a9dc0f0b447c1f54423c515d8809c9697386eee6429d0a1c13517a85c696e6fdba570b243d882e65764c274859606027015 + checksum: 9ae5dee8f12b0faf81cd83f06a41560e79b0ba96a48262771d897a510ecae605eb6d84f687da001ab8ccffd50f612ae50f988ef76e6312c752897f462f3ac08d languageName: node linkType: hard @@ -992,7 +958,7 @@ __metadata: "@metamask/eslint-config-jest": ^10.0.0 "@metamask/eslint-config-nodejs": ^10.0.0 "@metamask/eslint-config-typescript": ^10.0.0 - "@metamask/utils": ^8.1.0 + "@metamask/utils": ^8.2.1 "@types/debug": ^4.1.7 "@types/jest": ^29.5.1 "@types/jest-when": ^3.5.2 @@ -1082,17 +1048,19 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^8.1.0": - version: 8.1.0 - resolution: "@metamask/utils@npm:8.1.0" +"@metamask/utils@npm:^8.2.1": + version: 8.2.1 + resolution: "@metamask/utils@npm:8.2.1" dependencies: - "@ethereumjs/tx": ^4.1.2 + "@ethereumjs/tx": ^4.2.0 "@noble/hashes": ^1.3.1 + "@scure/base": ^1.1.3 "@types/debug": ^4.1.7 debug: ^4.3.4 + pony-cause: ^2.1.10 semver: ^7.5.4 superstruct: ^1.0.3 - checksum: 4cbee36d0c227f3e528930e83f75a0c6b71b55b332c3e162f0e87f3dd86ae017d0b20405d76ea054ab99e4d924d3d9b8b896ed12a12aae57b090350e5a625999 + checksum: 36a714a17e4949d2040bedb28d4373a22e7e86bb797aa2d59223f9799fd76e662443bcede113719c4e200f5e9d90a9d62feafad5028fff8b9a7a85fface097ca languageName: node linkType: hard @@ -1112,7 +1080,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:^1.3.0, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:~1.3.0, @noble/hashes@npm:~1.3.1": +"@noble/hashes@npm:^1.3.1, @noble/hashes@npm:~1.3.0, @noble/hashes@npm:~1.3.1": version: 1.3.2 resolution: "@noble/hashes@npm:1.3.2" checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474 @@ -1202,7 +1170,7 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.1.0": +"@scure/base@npm:^1.1.3, @scure/base@npm:~1.1.0": version: 1.1.3 resolution: "@scure/base@npm:1.1.3" checksum: 1606ab8a4db898cb3a1ada16c15437c3bce4e25854fadc8eb03ae93cbbbac1ed90655af4b0be3da37e12056fef11c0374499f69b9e658c9e5b7b3e06353c630c @@ -5016,10 +4984,10 @@ __metadata: languageName: node linkType: hard -"pony-cause@npm:^2.1.9": - version: 2.1.9 - resolution: "pony-cause@npm:2.1.9" - checksum: 9e549dd126145bfed472b07e9d3eb24231033878c105813b3512d1cc99be16b84dfe4694e49b869e236a0e89c33a3b5244fdfde36355ad0c0c1a8c2b19b28f45 +"pony-cause@npm:^2.1.10, pony-cause@npm:^2.1.9": + version: 2.1.10 + resolution: "pony-cause@npm:2.1.10" + checksum: 8b61378f213e61056312dc274a1c79980154e9d864f6ad86e0c8b91a50d3ce900d430995ee24147c9f3caa440dfe7d51c274b488d7f033b65b206522536d7217 languageName: node linkType: hard From 1a9824e12af478500d8ac6a139ffa3dfac1cb5cb Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 21:06:01 -0800 Subject: [PATCH 07/11] Fix jest-it-up compatibility --- jest.config.js => jest.config.cjs | 4 +- package.json | 4 +- yarn.lock | 186 +++++++++++++++++++----------- 3 files changed, 124 insertions(+), 70 deletions(-) rename jest.config.js => jest.config.cjs (98%) diff --git a/jest.config.js b/jest.config.cjs similarity index 98% rename from jest.config.js rename to jest.config.cjs index f31ac5d9..8ebe25de 100644 --- a/jest.config.js +++ b/jest.config.cjs @@ -3,8 +3,8 @@ * https://jestjs.io/docs/configuration */ -// eslint-disable-next-line import/no-anonymous-default-export -export default { +// This file needs to be .cjs for compatibility with jest-it-up. +module.exports = { // All imported modules in your tests should be mocked automatically // automock: false, diff --git a/package.json b/package.json index 0c10c48c..199d87de 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern", "prepack": "./scripts/prepack.sh", - "test": "jest && jest-it-up", + "test": "jest && jest-it-up --config jest.config.cjs", "test:watch": "jest --watch" }, "dependencies": { @@ -60,7 +60,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.5.0", - "jest-it-up": "^2.0.2", + "jest-it-up": "^3.0.0", "jest-when": "^3.5.2", "nanoid": "^3.3.4", "prettier": "^2.2.1", diff --git a/yarn.lock b/yarn.lock index 4424cdb1..f342404a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -546,41 +546,43 @@ __metadata: languageName: node linkType: hard -"@inquirer/confirm@npm:^0.0.14-alpha.0": - version: 0.0.14-alpha.0 - resolution: "@inquirer/confirm@npm:0.0.14-alpha.0" +"@inquirer/confirm@npm:^2.0.0": + version: 2.0.15 + resolution: "@inquirer/confirm@npm:2.0.15" dependencies: - "@inquirer/core": ^0.0.15-alpha.0 - "@inquirer/input": ^0.0.15-alpha.0 - chalk: ^4.1.1 - checksum: 84daf47030318e0adf6eeef85388e341f6f68c0c06c0d1d329cb6185f6d21abf74c3124102bf62f4f42145c8dc9193d719209e3759987a1bdbcfb88139b9936c + "@inquirer/core": ^5.1.1 + "@inquirer/type": ^1.1.5 + chalk: ^4.1.2 + checksum: 82b56d843196c0337ab198eaaa0cdedb2b0fb581f6fcdc18e82f9028d78742d68133c0f315cbd50204047098224f20ea1981486c370a183a005a08f49fd3a7f8 languageName: node linkType: hard -"@inquirer/core@npm:^0.0.15-alpha.0": - version: 0.0.15-alpha.0 - resolution: "@inquirer/core@npm:0.0.15-alpha.0" - dependencies: - ansi-escapes: ^4.2.1 - chalk: ^4.1.1 - cli-spinners: ^2.6.0 - cli-width: ^3.0.0 - lodash: ^4.17.21 - mute-stream: ^0.0.8 - run-async: ^2.3.0 - string-width: ^4.1.0 - strip-ansi: ^6.0.0 - checksum: 26a94a8db80e57f926c889b5730c6c9a0f18d6bf1e6dbfb68eaa6bcda33550db66118ce6afd9e91130ea2e4da42b6d7236b94c16fbab931ed04b4f442b9a5c78 +"@inquirer/core@npm:^5.1.1": + version: 5.1.1 + resolution: "@inquirer/core@npm:5.1.1" + dependencies: + "@inquirer/type": ^1.1.5 + "@types/mute-stream": ^0.0.4 + "@types/node": ^20.9.0 + "@types/wrap-ansi": ^3.0.0 + ansi-escapes: ^4.3.2 + chalk: ^4.1.2 + cli-spinners: ^2.9.1 + cli-width: ^4.1.0 + figures: ^3.2.0 + mute-stream: ^1.0.0 + run-async: ^3.0.0 + signal-exit: ^4.1.0 + strip-ansi: ^6.0.1 + wrap-ansi: ^6.2.0 + checksum: 4fde57d39e7e9822d638eb15d8444192b58fb63a54230892acbe7b8816a0d519b782fa3b38d19747b58da84a243345645d9c5c2442ffdd5478b9f0f5b91c3d84 languageName: node linkType: hard -"@inquirer/input@npm:^0.0.15-alpha.0": - version: 0.0.15-alpha.0 - resolution: "@inquirer/input@npm:0.0.15-alpha.0" - dependencies: - "@inquirer/core": ^0.0.15-alpha.0 - chalk: ^4.1.1 - checksum: c294b2fa100e2955e271b1b0590b5f360c65c560d653f39554cd381f145fdf13be9ea2c3c069d39a71f84fc3c8ba20d9d78a0b210f8cb5533d138567029e28ee +"@inquirer/type@npm:^1.1.5": + version: 1.1.5 + resolution: "@inquirer/type@npm:1.1.5" + checksum: 5417e10978b7fbbb691c64259261d220ab12b95d05a7092dba228ce71e830385e6da26669e45916993b367177f3d99157a95ff09a0ad7075f0545ef9c1a0c81b languageName: node linkType: hard @@ -979,7 +981,7 @@ __metadata: eslint-plugin-prettier: ^4.2.1 execa: ^5.1.1 jest: ^29.5.0 - jest-it-up: ^2.0.2 + jest-it-up: ^3.0.0 jest-when: ^3.5.2 nanoid: ^3.3.4 pony-cause: ^2.1.9 @@ -1399,6 +1401,15 @@ __metadata: languageName: node linkType: hard +"@types/mute-stream@npm:^0.0.4": + version: 0.0.4 + resolution: "@types/mute-stream@npm:0.0.4" + dependencies: + "@types/node": "*" + checksum: af8d83ad7b68ea05d9357985daf81b6c9b73af4feacb2f5c2693c7fd3e13e5135ef1bd083ce8d5bdc8e97acd28563b61bb32dec4e4508a8067fcd31b8a098632 + languageName: node + linkType: hard + "@types/node@npm:*": version: 18.0.3 resolution: "@types/node@npm:18.0.3" @@ -1413,6 +1424,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^20.9.0": + version: 20.10.2 + resolution: "@types/node@npm:20.10.2" + dependencies: + undici-types: ~5.26.4 + checksum: c0c84e8270cdf7a47a18c0230c0321537cc59506adb0e3cba51949b6f1ad4879f2e2ec3a29161f2f5321ebb6415460712d9f0a25ac5c02be0f5435464fe77c23 + languageName: node + linkType: hard + "@types/prettier@npm:^2.1.5": version: 2.6.3 resolution: "@types/prettier@npm:2.6.3" @@ -1450,6 +1470,13 @@ __metadata: languageName: node linkType: hard +"@types/wrap-ansi@npm:^3.0.0": + version: 3.0.0 + resolution: "@types/wrap-ansi@npm:3.0.0" + checksum: 492f0610093b5802f45ca292777679bb9b381f1f32ae939956dd9e00bf81dba7cc99979687620a2817d9a7d8b59928207698166c47a0861c6a2e5c30d4aaf1e9 + languageName: node + linkType: hard + "@types/yargs-parser@npm:*": version: 21.0.0 resolution: "@types/yargs-parser@npm:21.0.0" @@ -1661,14 +1688,14 @@ __metadata: languageName: node linkType: hard -"ansi-colors@npm:^4.1.0": +"ansi-colors@npm:^4.0.0": version: 4.1.3 resolution: "ansi-colors@npm:4.1.3" checksum: a9c2ec842038a1fabc7db9ece7d3177e2fe1c5dc6f0c51ecfbf5f39911427b89c00b5dc6b8bd95f82a26e9b16aaae2e83d45f060e98070ce4d1333038edceb0e languageName: node linkType: hard -"ansi-escapes@npm:^4.2.1": +"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.2": version: 4.3.2 resolution: "ansi-escapes@npm:4.3.2" dependencies: @@ -2028,7 +2055,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^4.0.0, chalk@npm:^4.1.1": +"chalk@npm:^4.0.0, chalk@npm:^4.1.2": version: 4.1.2 resolution: "chalk@npm:4.1.2" dependencies: @@ -2073,17 +2100,17 @@ __metadata: languageName: node linkType: hard -"cli-spinners@npm:^2.6.0": - version: 2.6.1 - resolution: "cli-spinners@npm:2.6.1" - checksum: 423409baaa7a58e5104b46ca1745fbfc5888bbd0b0c5a626e052ae1387060839c8efd512fb127e25769b3dc9562db1dc1b5add6e0b93b7ef64f477feb6416a45 +"cli-spinners@npm:^2.9.1": + version: 2.9.2 + resolution: "cli-spinners@npm:2.9.2" + checksum: 1bd588289b28432e4676cb5d40505cfe3e53f2e4e10fbe05c8a710a154d6fe0ce7836844b00d6858f740f2ffe67cdc36e0fce9c7b6a8430e80e6388d5aa4956c languageName: node linkType: hard -"cli-width@npm:^3.0.0": - version: 3.0.0 - resolution: "cli-width@npm:3.0.0" - checksum: 4c94af3769367a70e11ed69aa6095f1c600c0ff510f3921ab4045af961820d57c0233acfa8b6396037391f31b4c397e1f614d234294f979ff61430a6c166c3f6 +"cli-width@npm:^4.1.0": + version: 4.1.0 + resolution: "cli-width@npm:4.1.0" + checksum: 0a79cff2dbf89ef530bcd54c713703ba94461457b11e5634bd024c78796ed21401e32349c004995954e06f442d82609287e7aabf6a5f02c919a1cf3b9b6854ff languageName: node linkType: hard @@ -2171,10 +2198,10 @@ __metadata: languageName: node linkType: hard -"commander@npm:^9.0.0": - version: 9.3.0 - resolution: "commander@npm:9.3.0" - checksum: d421ce66fee25792a1470c69aa8d1b86434bf873a96483aa92c8267f81a6f20c6f7c426f5e82f88ac50a8ec4855d3f2787aebcdef8aa559e1080a2337a95a217 +"commander@npm:^11.0.0": + version: 11.1.0 + resolution: "commander@npm:11.1.0" + checksum: fd1a8557c6b5b622c89ecdfde703242ab7db3b628ea5d1755784c79b8e7cb0d74d65b4a262289b533359cd58e1bfc0bf50245dfbcd2954682a6f367c828b79ef languageName: node linkType: hard @@ -2903,6 +2930,15 @@ __metadata: languageName: node linkType: hard +"figures@npm:^3.2.0": + version: 3.2.0 + resolution: "figures@npm:3.2.0" + dependencies: + escape-string-regexp: ^1.0.5 + checksum: 85a6ad29e9aca80b49b817e7c89ecc4716ff14e3779d9835af554db91bac41c0f289c418923519392a1e582b4d10482ad282021330cd045bb7b80c84152f2a2b + languageName: node + linkType: hard + "file-entry-cache@npm:^6.0.1": version: 6.0.1 resolution: "file-entry-cache@npm:6.0.1" @@ -3887,16 +3923,16 @@ __metadata: languageName: node linkType: hard -"jest-it-up@npm:^2.0.2": - version: 2.0.2 - resolution: "jest-it-up@npm:2.0.2" +"jest-it-up@npm:^3.0.0": + version: 3.0.0 + resolution: "jest-it-up@npm:3.0.0" dependencies: - "@inquirer/confirm": ^0.0.14-alpha.0 - ansi-colors: ^4.1.0 - commander: ^9.0.0 + "@inquirer/confirm": ^2.0.0 + ansi-colors: ^4.0.0 + commander: ^11.0.0 bin: jest-it-up: bin/jest-it-up - checksum: 1482d8b9862331b6cc7d858fd1c05d95fb1bc2adbc37e243c20e6e10f259fecf600d3b1023dadf11acadb158ea171677f8f375969e058dff46002be81a49079b + checksum: c17ecabe97e7877af77c5a484c9b2e146dd1acf793726c4a3a644f2f1dff04a5e194e27ba54dd2c1249fd981e347db45ee8c11a517cfd264ef9e3b9bea7989cb languageName: node linkType: hard @@ -4344,13 +4380,6 @@ __metadata: languageName: node linkType: hard -"lodash@npm:^4.17.21": - version: 4.17.21 - resolution: "lodash@npm:4.17.21" - checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 - languageName: node - linkType: hard - "lru-cache@npm:^6.0.0": version: 6.0.0 resolution: "lru-cache@npm:6.0.0" @@ -4618,10 +4647,10 @@ __metadata: languageName: node linkType: hard -"mute-stream@npm:^0.0.8": - version: 0.0.8 - resolution: "mute-stream@npm:0.0.8" - checksum: ff48d251fc3f827e5b1206cda0ffdaec885e56057ee86a3155e1951bc940fd5f33531774b1cc8414d7668c10a8907f863f6561875ee6e8768931a62121a531a1 +"mute-stream@npm:^1.0.0": + version: 1.0.0 + resolution: "mute-stream@npm:1.0.0" + checksum: 36fc968b0e9c9c63029d4f9dc63911950a3bdf55c9a87f58d3a266289b67180201cade911e7699f8b2fa596b34c9db43dad37649e3f7fdd13c3bb9edb0017ee7 languageName: node linkType: hard @@ -5252,10 +5281,10 @@ __metadata: languageName: node linkType: hard -"run-async@npm:^2.3.0": - version: 2.4.1 - resolution: "run-async@npm:2.4.1" - checksum: a2c88aa15df176f091a2878eb840e68d0bdee319d8d97bbb89112223259cebecb94bc0defd735662b83c2f7a30bed8cddb7d1674eb48ae7322dc602b22d03797 +"run-async@npm:^3.0.0": + version: 3.0.0 + resolution: "run-async@npm:3.0.0" + checksum: 280c03d5a88603f48103fc6fd69f07fb0c392a1e0d319c34ec96a2516030e07ba06f79231a563c78698b882649c2fc1fda601bc84705f57d50efcd1fa506cfc0 languageName: node linkType: hard @@ -5357,6 +5386,13 @@ __metadata: languageName: node linkType: hard +"signal-exit@npm:^4.1.0": + version: 4.1.0 + resolution: "signal-exit@npm:4.1.0" + checksum: 64c757b498cb8629ffa5f75485340594d2f8189e9b08700e69199069c8e3070fb3e255f7ab873c05dc0b3cec412aea7402e10a5990cb6a050bd33ba062a6c549 + languageName: node + linkType: hard + "sisteransi@npm:^1.0.5": version: 1.0.5 resolution: "sisteransi@npm:1.0.5" @@ -5843,6 +5879,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 + languageName: node + linkType: hard + "unique-filename@npm:^1.1.1": version: 1.1.1 resolution: "unique-filename@npm:1.1.1" @@ -5969,6 +6012,17 @@ __metadata: languageName: node linkType: hard +"wrap-ansi@npm:^6.2.0": + version: 6.2.0 + resolution: "wrap-ansi@npm:6.2.0" + dependencies: + ansi-styles: ^4.0.0 + string-width: ^4.1.0 + strip-ansi: ^6.0.0 + checksum: 6cd96a410161ff617b63581a08376f0cb9162375adeb7956e10c8cd397821f7eb2a6de24eb22a0b28401300bf228c86e50617cd568209b5f6775b93c97d2fe3a + languageName: node + linkType: hard + "wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" From 412407439da9a42f45a3730006bc79aee299c573 Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Fri, 1 Dec 2023 22:51:00 -0800 Subject: [PATCH 08/11] Replace ts-node with tsx --- package.json | 5 +- tests/functional/helpers/constants.ts | 8 +- .../helpers/monorepo-environment.ts | 5 +- tsconfig.json | 3 +- yarn.lock | 417 ++++++++++++------ 5 files changed, 294 insertions(+), 144 deletions(-) diff --git a/package.json b/package.json index 199d87de..cc2a7106 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "rimraf": "^4.0.5", "stdio-mock": "^1.2.0", "ts-jest": "^29.1.0", - "ts-node": "^10.7.0", + "tsx": "^4.6.1", "typescript": "~5.1.6" }, "packageManager": "yarn@3.2.1", @@ -81,7 +81,8 @@ }, "lavamoat": { "allowScripts": { - "@lavamoat/preinstall-always-fail": false + "@lavamoat/preinstall-always-fail": false, + "tsx>esbuild": false } } } diff --git a/tests/functional/helpers/constants.ts b/tests/functional/helpers/constants.ts index ecfd1125..7fd1bee2 100644 --- a/tests/functional/helpers/constants.ts +++ b/tests/functional/helpers/constants.ts @@ -2,9 +2,5 @@ import path from 'path'; const ROOT_DIR = path.resolve(__dirname, '../../..'); export const TOOL_EXECUTABLE_PATH = path.join(ROOT_DIR, 'src', 'cli.ts'); -export const TS_NODE_PATH = path.join( - ROOT_DIR, - 'node_modules', - '.bin', - 'ts-node', -); + +export const TSX_PATH = path.join(ROOT_DIR, 'node_modules', '.bin', 'tsx'); diff --git a/tests/functional/helpers/monorepo-environment.ts b/tests/functional/helpers/monorepo-environment.ts index b39e422d..63ea3027 100644 --- a/tests/functional/helpers/monorepo-environment.ts +++ b/tests/functional/helpers/monorepo-environment.ts @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; import { ExecaReturnValue } from 'execa'; import YAML from 'yaml'; -import { TOOL_EXECUTABLE_PATH, TS_NODE_PATH } from './constants.js'; +import { TOOL_EXECUTABLE_PATH, TSX_PATH } from './constants.js'; import Environment, { EnvironmentOptions, PackageSpecification, @@ -126,7 +126,6 @@ cat "${releaseSpecificationPath}" > "$1" await fs.promises.chmod(releaseSpecificationEditorPath, 0o777); const args = [ - '--transpileOnly', TOOL_EXECUTABLE_PATH, '--project-directory', this.localRepo.getWorkingDirectoryPath(), @@ -137,7 +136,7 @@ cat "${releaseSpecificationPath}" > "$1" const env = { EDITOR: releaseSpecificationEditorPath, }; - const result = await this.localRepo.runCommand(TS_NODE_PATH, args, { env }); + const result = await this.localRepo.runCommand(TSX_PATH, args, { env }); debug( ['---- START OUTPUT -----', result.all, '---- END OUTPUT -----'].join( diff --git a/tsconfig.json b/tsconfig.json index b5293324..ba8dbd7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,5 @@ "strict": true, "target": "ES2022" }, - "exclude": ["./dist/**/*", "node_modules"], - "ts-node": { "esm": true } + "exclude": ["./dist/**/*", "node_modules"] } diff --git a/yarn.lock b/yarn.lock index f342404a..4485565f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -410,15 +410,6 @@ __metadata: languageName: node linkType: hard -"@cspotcode/source-map-support@npm:^0.8.0": - version: 0.8.1 - resolution: "@cspotcode/source-map-support@npm:0.8.1" - dependencies: - "@jridgewell/trace-mapping": 0.3.9 - checksum: 5718f267085ed8edb3e7ef210137241775e607ee18b77d95aa5bd7514f47f5019aa2d82d96b3bf342ef7aa890a346fa1044532ff7cc3009e7d24fce3ce6200fa - languageName: node - linkType: hard - "@es-joy/jsdoccomment@npm:~0.36.0": version: 0.36.0 resolution: "@es-joy/jsdoccomment@npm:0.36.0" @@ -430,6 +421,160 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/android-arm64@npm:0.18.20" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/android-arm@npm:0.18.20" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/android-x64@npm:0.18.20" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/darwin-arm64@npm:0.18.20" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/darwin-x64@npm:0.18.20" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/freebsd-arm64@npm:0.18.20" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/freebsd-x64@npm:0.18.20" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-arm64@npm:0.18.20" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-arm@npm:0.18.20" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-ia32@npm:0.18.20" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-loong64@npm:0.18.20" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-mips64el@npm:0.18.20" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-ppc64@npm:0.18.20" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-riscv64@npm:0.18.20" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-s390x@npm:0.18.20" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-x64@npm:0.18.20" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/netbsd-x64@npm:0.18.20" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/openbsd-x64@npm:0.18.20" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/sunos-x64@npm:0.18.20" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/win32-arm64@npm:0.18.20" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/win32-ia32@npm:0.18.20" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/win32-x64@npm:0.18.20" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" @@ -857,7 +1002,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:^3.0.3, @jridgewell/resolve-uri@npm:^3.1.0": +"@jridgewell/resolve-uri@npm:^3.1.0": version: 3.1.1 resolution: "@jridgewell/resolve-uri@npm:3.1.1" checksum: f5b441fe7900eab4f9155b3b93f9800a916257f4e8563afbcd3b5a5337b55e52bd8ae6735453b1b745457d9f6cdb16d74cd6220bbdd98cf153239e13f6cbb653 @@ -878,16 +1023,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:0.3.9": - version: 0.3.9 - resolution: "@jridgewell/trace-mapping@npm:0.3.9" - dependencies: - "@jridgewell/resolve-uri": ^3.0.3 - "@jridgewell/sourcemap-codec": ^1.4.10 - checksum: d89597752fd88d3f3480845691a05a44bd21faac18e2185b6f436c3b0fd0c5a859fbbd9aaa92050c4052caf325ad3e10e2e1d1b64327517471b7d51babc0ddef - languageName: node - linkType: hard - "@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.15, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.20 resolution: "@jridgewell/trace-mapping@npm:0.3.20" @@ -991,7 +1126,7 @@ __metadata: semver: ^7.5.4 stdio-mock: ^1.2.0 ts-jest: ^29.1.0 - ts-node: ^10.7.0 + tsx: ^4.6.1 typescript: ~5.1.6 which: ^3.0.0 yaml: ^2.2.2 @@ -1232,34 +1367,6 @@ __metadata: languageName: node linkType: hard -"@tsconfig/node10@npm:^1.0.7": - version: 1.0.9 - resolution: "@tsconfig/node10@npm:1.0.9" - checksum: a33ae4dc2a621c0678ac8ac4bceb8e512ae75dac65417a2ad9b022d9b5411e863c4c198b6ba9ef659e14b9fb609bbec680841a2e84c1172df7a5ffcf076539df - languageName: node - linkType: hard - -"@tsconfig/node12@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node12@npm:1.0.11" - checksum: 5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a - languageName: node - linkType: hard - -"@tsconfig/node14@npm:^1.0.0": - version: 1.0.3 - resolution: "@tsconfig/node14@npm:1.0.3" - checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d - languageName: node - linkType: hard - -"@tsconfig/node16@npm:^1.0.2": - version: 1.0.3 - resolution: "@tsconfig/node16@npm:1.0.3" - checksum: 3a8b657dd047495b7ad23437d6afd20297ce90380ff0bdee93fc7d39a900dbd8d9e26e53ff6b465e7967ce2adf0b218782590ce9013285121e6a5928fbd6819f - languageName: node - linkType: hard - "@types/babel__core@npm:^7.1.14": version: 7.1.19 resolution: "@types/babel__core@npm:7.1.19" @@ -1630,14 +1737,7 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^8.1.1": - version: 8.2.0 - resolution: "acorn-walk@npm:8.2.0" - checksum: 1715e76c01dd7b2d4ca472f9c58968516a4899378a63ad5b6c2d668bba8da21a71976c14ec5f5b75f887b6317c4ae0b897ab141c831d741dc76024d8745f1ad1 - languageName: node - linkType: hard - -"acorn@npm:^8.4.1, acorn@npm:^8.8.0": +"acorn@npm:^8.8.0": version: 8.8.1 resolution: "acorn@npm:8.8.1" bin: @@ -1763,13 +1863,6 @@ __metadata: languageName: node linkType: hard -"arg@npm:^4.1.0": - version: 4.1.3 - resolution: "arg@npm:4.1.3" - checksum: 544af8dd3f60546d3e4aff084d451b96961d2267d668670199692f8d054f0415d86fc5497d0e641e91546f0aa920e7c29e5250e99fc89f5552a34b5d93b77f43 - languageName: node - linkType: hard - "argparse@npm:^1.0.7": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -2251,13 +2344,6 @@ __metadata: languageName: node linkType: hard -"create-require@npm:^1.1.0": - version: 1.1.1 - resolution: "create-require@npm:1.1.1" - checksum: a9a1503d4390d8b59ad86f4607de7870b39cad43d929813599a23714831e81c520bddf61bcdd1f8e30f05fd3a2b71ae8538e946eb2786dc65c2bbc520f692eff - languageName: node - linkType: hard - "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -2365,13 +2451,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^4.0.1": - version: 4.0.2 - resolution: "diff@npm:4.0.2" - checksum: f2c09b0ce4e6b301c221addd83bf3f454c0bc00caa3dd837cf6c127d6edf7223aa2bbe3b688feea110b7f262adbfc845b757c44c8a9f8c0c5b15d8fa9ce9d20d - languageName: node - linkType: hard - "diff@npm:^5.0.0": version: 5.1.0 resolution: "diff@npm:5.1.0" @@ -2510,6 +2589,83 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:~0.18.20": + version: 0.18.20 + resolution: "esbuild@npm:0.18.20" + dependencies: + "@esbuild/android-arm": 0.18.20 + "@esbuild/android-arm64": 0.18.20 + "@esbuild/android-x64": 0.18.20 + "@esbuild/darwin-arm64": 0.18.20 + "@esbuild/darwin-x64": 0.18.20 + "@esbuild/freebsd-arm64": 0.18.20 + "@esbuild/freebsd-x64": 0.18.20 + "@esbuild/linux-arm": 0.18.20 + "@esbuild/linux-arm64": 0.18.20 + "@esbuild/linux-ia32": 0.18.20 + "@esbuild/linux-loong64": 0.18.20 + "@esbuild/linux-mips64el": 0.18.20 + "@esbuild/linux-ppc64": 0.18.20 + "@esbuild/linux-riscv64": 0.18.20 + "@esbuild/linux-s390x": 0.18.20 + "@esbuild/linux-x64": 0.18.20 + "@esbuild/netbsd-x64": 0.18.20 + "@esbuild/openbsd-x64": 0.18.20 + "@esbuild/sunos-x64": 0.18.20 + "@esbuild/win32-arm64": 0.18.20 + "@esbuild/win32-ia32": 0.18.20 + "@esbuild/win32-x64": 0.18.20 + dependenciesMeta: + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 5d253614e50cdb6ec22095afd0c414f15688e7278a7eb4f3720a6dd1306b0909cf431e7b9437a90d065a31b1c57be60130f63fe3e8d0083b588571f31ee6ec7b + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -3039,6 +3195,16 @@ __metadata: languageName: node linkType: hard +"fsevents@npm:~2.3.3": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: latest + checksum: 11e6ea6fea15e42461fc55b4b0e4a0a3c654faa567f1877dbd353f39156f69def97a69936d1746619d656c4b93de2238bf731f6085a03a50cabf287c9d024317 + conditions: os=darwin + languageName: node + linkType: hard + "fsevents@patch:fsevents@^2.3.2#~builtin": version: 2.3.2 resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7" @@ -3048,6 +3214,15 @@ __metadata: languageName: node linkType: hard +"fsevents@patch:fsevents@~2.3.3#~builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#~builtin::version=2.3.3&hash=18f3a7" + dependencies: + node-gyp: latest + conditions: os=darwin + languageName: node + linkType: hard + "function-bind@npm:^1.1.1": version: 1.1.1 resolution: "function-bind@npm:1.1.1" @@ -3139,6 +3314,15 @@ __metadata: languageName: node linkType: hard +"get-tsconfig@npm:^4.7.2": + version: 4.7.2 + resolution: "get-tsconfig@npm:4.7.2" + dependencies: + resolve-pkg-maps: ^1.0.0 + checksum: 172358903250eff0103943f816e8a4e51d29b8e5449058bdf7266714a908a48239f6884308bd3a6ff28b09f692b9533dbebfd183ab63e4e14f073cda91f1bca9 + languageName: node + linkType: hard + "git-hooks-list@npm:1.0.3": version: 1.0.3 resolution: "git-hooks-list@npm:1.0.3" @@ -4412,7 +4596,7 @@ __metadata: languageName: node linkType: hard -"make-error@npm:1.x, make-error@npm:^1.1.1": +"make-error@npm:1.x": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 @@ -5201,6 +5385,13 @@ __metadata: languageName: node linkType: hard +"resolve-pkg-maps@npm:^1.0.0": + version: 1.0.0 + resolution: "resolve-pkg-maps@npm:1.0.0" + checksum: 1012afc566b3fdb190a6309cc37ef3b2dcc35dff5fa6683a9d00cd25c3247edfbc4691b91078c97adc82a29b77a2660c30d791d65dab4fc78bfc473f60289977 + languageName: node + linkType: hard + "resolve.exports@npm:^2.0.0": version: 2.0.2 resolution: "resolve.exports@npm:2.0.2" @@ -5749,44 +5940,6 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:^10.7.0": - version: 10.8.2 - resolution: "ts-node@npm:10.8.2" - dependencies: - "@cspotcode/source-map-support": ^0.8.0 - "@tsconfig/node10": ^1.0.7 - "@tsconfig/node12": ^1.0.7 - "@tsconfig/node14": ^1.0.0 - "@tsconfig/node16": ^1.0.2 - acorn: ^8.4.1 - acorn-walk: ^8.1.1 - arg: ^4.1.0 - create-require: ^1.1.0 - diff: ^4.0.1 - make-error: ^1.1.1 - v8-compile-cache-lib: ^3.0.1 - yn: 3.1.1 - peerDependencies: - "@swc/core": ">=1.2.50" - "@swc/wasm": ">=1.2.50" - "@types/node": "*" - typescript: ">=2.7" - peerDependenciesMeta: - "@swc/core": - optional: true - "@swc/wasm": - optional: true - bin: - ts-node: dist/bin.js - ts-node-cwd: dist/bin-cwd.js - ts-node-esm: dist/bin-esm.js - ts-node-script: dist/bin-script.js - ts-node-transpile-only: dist/bin-transpile.js - ts-script: dist/bin-script-deprecated.js - checksum: 1eede939beed9f4db35bcc88d78ef803815b99dcdbed1ecac728d861d74dc694918a7f0f437aa08d026193743a31e7e00e2ee34f875f909b5879981c1808e2a7 - languageName: node - linkType: hard - "tsconfig-paths@npm:^3.14.1": version: 3.14.1 resolution: "tsconfig-paths@npm:3.14.1" @@ -5817,6 +5970,22 @@ __metadata: languageName: node linkType: hard +"tsx@npm:^4.6.1": + version: 4.6.1 + resolution: "tsx@npm:4.6.1" + dependencies: + esbuild: ~0.18.20 + fsevents: ~2.3.3 + get-tsconfig: ^4.7.2 + dependenciesMeta: + fsevents: + optional: true + bin: + tsx: dist/cli.mjs + checksum: a039c69cd6ee6ca719f04d55f8a528c9712409f8f9e559b78435f088956c7e46e4c58d893e97e13a197c3bab0b09877113beb281266f3725448b69357b624d69 + languageName: node + linkType: hard + "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -5934,13 +6103,6 @@ __metadata: languageName: node linkType: hard -"v8-compile-cache-lib@npm:^3.0.1": - version: 3.0.1 - resolution: "v8-compile-cache-lib@npm:3.0.1" - checksum: 78089ad549e21bcdbfca10c08850022b22024cdcc2da9b168bcf5a73a6ed7bf01a9cebb9eac28e03cd23a684d81e0502797e88f3ccd27a32aeab1cfc44c39da0 - languageName: node - linkType: hard - "v8-to-istanbul@npm:^9.0.1": version: 9.0.1 resolution: "v8-to-istanbul@npm:9.0.1" @@ -6126,13 +6288,6 @@ __metadata: languageName: node linkType: hard -"yn@npm:3.1.1": - version: 3.1.1 - resolution: "yn@npm:3.1.1" - checksum: 2c487b0e149e746ef48cda9f8bad10fc83693cd69d7f9dcd8be4214e985de33a29c9e24f3c0d6bcf2288427040a8947406ab27f7af67ee9456e6b84854f02dd6 - languageName: node - linkType: hard - "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0" From 86398ec3ceb43166ca06e162a7ae452a0aa2400f Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Sun, 3 Dec 2023 15:47:09 -0800 Subject: [PATCH 09/11] Revert ES version changes --- .eslintrc.cjs | 10 ---------- tsconfig.json | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 1c303b73..c8b462f5 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -3,17 +3,7 @@ module.exports = { extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'], - env: { - // See parserOptions comment - es2022: true, - }, - parserOptions: { - // We've had issues with the corresponding env setting being overriden. - // As for the specific choice, at the time of writing most of our codebase - // is on Node 16, and ES2022 is the latest version that's mostly compatible - // with Node 16 per https://node.green/. - ecmaVersion: '2022', sourceType: 'module', }, diff --git a/tsconfig.json b/tsconfig.json index ba8dbd7f..48819d88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,14 +3,14 @@ "esModuleInterop": true, "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, - "lib": ["ES2022"], - "module": "ES2022", + "lib": ["ES2020"], + "module": "NodeNext", "moduleResolution": "NodeNext", "noEmit": true, "noErrorTruncation": true, "skipLibCheck": true, "strict": true, - "target": "ES2022" + "target": "ES2017" }, "exclude": ["./dist/**/*", "node_modules"] } From 918428a4a324e101b1597c6e261bd12053a1879b Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Sun, 3 Dec 2023 18:07:32 -0800 Subject: [PATCH 10/11] Revert gpg sign change --- tests/functional/helpers/repo.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/functional/helpers/repo.ts b/tests/functional/helpers/repo.ts index ea632ea0..e7eff0c1 100644 --- a/tests/functional/helpers/repo.ts +++ b/tests/functional/helpers/repo.ts @@ -218,14 +218,12 @@ export default abstract class Repo { /** * Custom logic with which to further initialize the repo after it is created. - * By default, this configures Git to use an email and name for commits, and - * disables GPG signing, which may cause problems in local environments. + * By default, this configures Git to use an email and name for commits. * Can be overridden in subclasses. */ protected async afterCreate(): Promise { await this.runCommand('git', ['config', 'user.email', 'test@example.com']); await this.runCommand('git', ['config', 'user.name', 'Test User']); - await this.runCommand('git', ['config', 'commit.gpgsign', 'false']); } /** From fa1bf1c1cd9d7b2a3ddd3d972dd6983e71fe9ddb Mon Sep 17 00:00:00 2001 From: Erik Marks Date: Sun, 3 Dec 2023 23:13:05 -0800 Subject: [PATCH 11/11] Use Node16 module & moduleResolution --- tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 48819d88..3ea98918 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,8 @@ "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, "lib": ["ES2020"], - "module": "NodeNext", - "moduleResolution": "NodeNext", + "module": "Node16", + "moduleResolution": "Node16", "noEmit": true, "noErrorTruncation": true, "skipLibCheck": true,