chore: use createRequire instead of directly importing json (#2418)

pull/2423/head
烽宁 2 years ago committed by GitHub
parent daa6fd8620
commit 86a3c24d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,15 @@
import { readFileSync, writeFileSync } from 'fs'
import { resolve } from 'path'
import { fileURLToPath } from 'url'
import { createRequire } from 'module'
import c from 'picocolors'
import prompts from 'prompts'
import { execa } from 'execa'
import semver from 'semver'
import pkg from '../package.json' assert { type: 'json' }
const { version: currentVersion } = pkg
const { version: currentVersion } = createRequire(import.meta.url)(
'../package.json'
)
const { inc: _inc, valid } = semver
const versionIncrements = ['patch', 'minor', 'major']

Loading…
Cancel
Save