refactor: use JSON import attributes instead of createRequire (#5389)

pull/5251/merge
btea 3 weeks ago committed by GitHub
parent 5ce23b3bcc
commit b0da3845f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,15 +2,12 @@ import { spawn } from 'cross-spawn'
import type { SpawnOptions } from 'node:child_process' import type { SpawnOptions } from 'node:child_process'
import { once } from 'node:events' import { once } from 'node:events'
import fs from 'node:fs' import fs from 'node:fs'
import { createRequire } from 'node:module'
import { resolve } from 'node:path' import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url' import { fileURLToPath } from 'node:url'
import * as prompts from '@clack/prompts' import * as prompts from '@clack/prompts'
import semver from 'semver' import semver from 'semver'
import { version as currentVersion } from '../package.json' with { type: 'json' }
const { version: currentVersion } = createRequire(import.meta.url)(
'../package.json'
)
const { inc: _inc, valid } = semver const { inc: _inc, valid } = semver
const versionIncrements = ['patch', 'minor', 'major'] as const const versionIncrements = ['patch', 'minor', 'major'] as const

Loading…
Cancel
Save