Fix the next-dev-version.js script

This commit is contained in:
Tim Schaub
2021-05-01 10:32:07 -06:00
parent af68a7e0e7
commit a67bd5a764

View File

@@ -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}`);