This commit is contained in:
konnorrogers
2025-12-05 12:16:38 -05:00
parent 4b7c0c428d
commit 305bffa20c

View File

@@ -1,28 +1,27 @@
#!/usr/bin/env node #!/usr/bin/env node
import * as fs from "node:fs" import * as fs from 'node:fs';
import * as path from "node:path" import * as path from 'node:path';
import * as url from 'url'; import * as url from 'url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const monorepoRoot = path.resolve(__dirname, "..", "..", "..") const monorepoRoot = path.resolve(__dirname, '..', '..', '..');
const rootPackageJSONFile = path.join(monorepoRoot, "package.json") const rootPackageJSONFile = path.join(monorepoRoot, 'package.json');
const webawesomePackageJSONFile = path.join(path.resolve(__dirname, ".."), "package.json") const webawesomePackageJSONFile = path.join(path.resolve(__dirname, '..'), 'package.json');
const rootPackageJSON = JSON.parse(fs.readFileSync(rootPackageJSONFile)) const rootPackageJSON = JSON.parse(fs.readFileSync(rootPackageJSONFile));
const webawesomePackageJSON = JSON.parse(fs.readFileSync(webawesomePackageJSONFile)) const webawesomePackageJSON = JSON.parse(fs.readFileSync(webawesomePackageJSONFile));
const currentVersion = webawesomePackageJSON.version const currentVersion = webawesomePackageJSON.version;
rootPackageJSON.version = currentVersion rootPackageJSON.version = currentVersion;
fs.writeFileSync(rootPackageJSONFile, JSON.stringify(rootPackageJSON, null, 2)) fs.writeFileSync(rootPackageJSONFile, JSON.stringify(rootPackageJSON, null, 2));
const versionsFile = path.join(monorepoRoot, "VERSIONS.txt") const versionsFile = path.join(monorepoRoot, 'VERSIONS.txt');
const versions = fs.readFileSync(versions).split(/\r?\n/) const versions = fs.readFileSync(versions).split(/\r?\n/);
// TODO: Make this smart and understand semver and "insert" in the correct spot instead of appending. // TODO: Make this smart and understand semver and "insert" in the correct spot instead of appending.
if (!versions.includes(currentVersion)) { if (!versions.includes(currentVersion)) {
fs.appendFileSync(webawesomePackageJSON.version) fs.appendFileSync(webawesomePackageJSON.version);
} }