From a67bd5a764f9dd2aeec099013da1f827245a8bb8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 1 May 2021 10:32:07 -0600 Subject: [PATCH] Fix the next-dev-version.js script --- tasks/next-dev-version.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tasks/next-dev-version.js b/tasks/next-dev-version.js index 35bc42d5f1..f576a647b2 100644 --- a/tasks/next-dev-version.js +++ b/tasks/next-dev-version.js @@ -1,11 +1,15 @@ import esMain from 'es-main'; +import fse from 'fs-extra'; import process from 'process'; import semver from 'semver'; -import {promises as fs} from 'fs'; +import {dirname, join} from 'path'; +import {fileURLToPath} from 'url'; + +const baseDir = dirname(fileURLToPath(import.meta.url)); async function nextVersion() { - const pkg = await fs.readFile('../package.json', {encoding: 'utf8'}); - const version = JSON.parse(pkg).version; + const pkg = await fse.readJSON(join(baseDir, '../package.json')); + const version = pkg.version; const s = semver.parse(version); if (!s) { throw new Error(`Invalid version ${version}`);