mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 03:23:11 +00:00
a256ae2e6c
* working on getting actions to run * running all tests * run on CHROME only * Update test.yml * ignoring node_modules * updating typedocs * trying to ignore compiler errors * Update tsconfig.json * running doc tests in parallel * speeding up docs example tests * Update test.yml * testing README * 2 spaces instead of 4 * codecov * remove travis ci * adding token * updating codecov
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
/* eslint-disable no-console */
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
const fs = require("fs");
|
|
const semver = require("semver");
|
|
const { resolve } = require("path");
|
|
const { execSync } = require("child_process");
|
|
|
|
const tsVersion = execSync("npm show tone@next version").toString();
|
|
const mainVersion = execSync("npm show tone version").toString();
|
|
|
|
// go with whichever is the latest version
|
|
let version = mainVersion;
|
|
if (tsVersion && semver.gt(tsVersion, mainVersion)) {
|
|
version = tsVersion;
|
|
}
|
|
|
|
// increment the patch
|
|
version = semver.inc(version, "patch");
|
|
|
|
// write it to the package.json
|
|
const packageFile = resolve(__dirname, "../package.json");
|
|
const packageObj = JSON.parse(fs.readFileSync(packageFile, "utf-8"));
|
|
|
|
// if the package version if the latest, go with that one
|
|
if (semver.gt(packageObj.version, version)) {
|
|
version = packageObj.version;
|
|
}
|
|
|
|
console.log(`incrementing to version ${version}`);
|
|
packageObj.version = version;
|
|
// only if it's travis, update the package.json
|
|
if (process.env.GITHUB_CI) {
|
|
fs.writeFileSync(packageFile, JSON.stringify(packageObj, undefined, " "));
|
|
|
|
// write a version file
|
|
const versionFile = `export const version: string = ${JSON.stringify(version)};\n`;
|
|
fs.writeFileSync(resolve(__dirname, "../Tone/version.ts"), versionFile);
|
|
}
|
|
|