diff --git a/package.json b/package.json index ebedb37..87d8688 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "url": "https://github.com/kchung/mapkitjs-token/issues" }, "license": "MIT", + "type": "module", "publishConfig": { "access": "public" }, diff --git a/src/cli.ts b/src/cli.ts index f6e81bd..67fb625 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -2,10 +2,11 @@ import fs from 'fs'; import ms, { type StringValue } from 'ms'; -import yargs from 'yargs'; +import yargs from 'yargs/yargs'; +import { hideBin } from 'yargs/helpers'; import chalk from 'chalk'; -import generate, { type GenerateOptions } from './generate'; -import verify from './verify'; +import generate, { type GenerateOptions } from './generate.js'; +import verify from './verify.js'; type RunOptions = GenerateOptions & { verify: boolean; @@ -17,7 +18,7 @@ const DOC_URL = const now = new Date(); -const argv = yargs.options({ +const argv = yargs(hideBin(process.argv)).options({ alg: { default: 'ES256', defaultDescription: 'ES256', diff --git a/src/index.ts b/src/index.ts index 3e2bb46..b2c09b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -import generate from './generate'; -import verify from './verify'; +import generate from './generate.js'; +import verify from './verify.js'; export { generate, diff --git a/tsconfig.json b/tsconfig.json index 47e3a96..35bc7c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { "target": "ES2020", - "module": "commonjs", + "module": "es2020", "lib": ["ES2020"], - "moduleResolution": "node", + "moduleResolution": "bundler", "esModuleInterop": true, "strict": true, "skipLibCheck": true,