From cdcc2eef4d94b55e5cb429cc0d2ec4298c8f0111 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 3 Nov 2023 13:30:57 -0700 Subject: [PATCH] feat: Node types --- buildTestImages.ts | 3 +-- common.ts | 3 +-- makeDockerfile.ts | 3 +-- package.json | 8 ++++++++ proposals/34:upgrade-10/performActions.ts | 1 - proposals/43:upgrade-11/performActions.ts | 1 - runTestImages.ts | 3 +-- tsconfig.json | 10 ++++++++++ yarn.lock | 15 +++++++++++++++ 9 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 package.json create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/buildTestImages.ts b/buildTestImages.ts index 29b07fc6..02d367c7 100755 --- a/buildTestImages.ts +++ b/buildTestImages.ts @@ -1,5 +1,4 @@ #!/usr/bin/env tsx -// @ts-check import { parseArgs } from 'node:util'; import { execSync } from 'node:child_process'; @@ -11,7 +10,7 @@ refreshDockerfile(); const options = { match: { short: 'm', type: 'string' }, dry: { type: 'boolean' }, -}; +} as const; const { values } = parseArgs({ options }); const { match, dry } = values; diff --git a/common.ts b/common.ts index 7bf3e3e4..abd21db9 100644 --- a/common.ts +++ b/common.ts @@ -1,7 +1,6 @@ #!/usr/bin/env tsx -// @ts-check -import fs from 'node:fs'; +import * as fs from 'node:fs'; import * as path from 'node:path'; export const repository = 'ghcr.io/agoric/agoric-3-proposals'; diff --git a/makeDockerfile.ts b/makeDockerfile.ts index 75a20f3f..04562998 100755 --- a/makeDockerfile.ts +++ b/makeDockerfile.ts @@ -1,8 +1,7 @@ #!/usr/bin/env tsx // @ts-check -import assert from 'node:assert'; -import fs from 'node:fs'; +import * as fs from 'node:fs'; import { readProposals } from './common'; import type { ProposalInfo, diff --git a/package.json b/package.json new file mode 100644 index 00000000..f3402d6b --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "engines": { + "node": ">=18.0.0" + }, + "devDependencies": { + "@types/node": "^18.0.0" + } +} diff --git a/proposals/34:upgrade-10/performActions.ts b/proposals/34:upgrade-10/performActions.ts index cb83bd52..6da39728 100644 --- a/proposals/34:upgrade-10/performActions.ts +++ b/proposals/34:upgrade-10/performActions.ts @@ -1,6 +1,5 @@ #!/usr/bin/env tsx -// FIXME get TypeScript to resolve these, probably with lib:ES2022 import assert from 'node:assert/strict'; import { provisionWallet, diff --git a/proposals/43:upgrade-11/performActions.ts b/proposals/43:upgrade-11/performActions.ts index b3cd8d19..a3c23563 100644 --- a/proposals/43:upgrade-11/performActions.ts +++ b/proposals/43:upgrade-11/performActions.ts @@ -1,6 +1,5 @@ #!/usr/bin/env tsx -// FIXME get TypeScript to resolve these, probably with lib:ES2022 import assert from 'node:assert/strict'; import { agoric, agops } from '../../upgrade-test-scripts/lib/cliHelper.js'; diff --git a/runTestImages.ts b/runTestImages.ts index f1722c13..c2bdb268 100755 --- a/runTestImages.ts +++ b/runTestImages.ts @@ -1,5 +1,4 @@ #!/usr/bin/env tsx -// @ts-check import { parseArgs } from 'node:util'; import { execSync } from 'node:child_process'; @@ -7,7 +6,7 @@ import { imageNameForProposalTest, readProposals } from './common'; const options = { match: { short: 'm', type: 'string' }, -}; +} as const; const { values } = parseArgs({ options }); const { match } = values; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..c63594a9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "lib": [ + "ES2022" + ], + "module": "nodenext", + // ES2022 per Node 18 in https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping + "target": "ES2022" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000..df93d632 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,15 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/node@^20.8.10": + version "20.8.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.10.tgz#a5448b895c753ae929c26ce85cab557c6d4a365e" + integrity sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w== + dependencies: + undici-types "~5.26.4" + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==