mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
28 lines
1.0 KiB
JavaScript
Executable File
28 lines
1.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import * as fs from 'node:fs';
|
|
import * as path from 'node:path';
|
|
import * as url from 'url';
|
|
|
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
|
|
const monorepoRoot = path.resolve(__dirname, '..', '..', '..');
|
|
const rootPackageJSONFile = path.join(monorepoRoot, 'package.json');
|
|
const webawesomePackageJSONFile = path.join(path.resolve(__dirname, '..'), 'package.json');
|
|
|
|
const rootPackageJSON = JSON.parse(fs.readFileSync(rootPackageJSONFile));
|
|
const webawesomePackageJSON = JSON.parse(fs.readFileSync(webawesomePackageJSONFile));
|
|
|
|
const currentVersion = webawesomePackageJSON.version;
|
|
rootPackageJSON.version = currentVersion;
|
|
|
|
fs.writeFileSync(rootPackageJSONFile, JSON.stringify(rootPackageJSON, null, 2));
|
|
|
|
const versionsFile = path.join(monorepoRoot, 'VERSIONS.txt');
|
|
const versions = fs.readFileSync(versions).split(/\r?\n/);
|
|
|
|
// TODO: Make this smart and understand semver and "insert" in the correct spot instead of appending.
|
|
if (!versions.includes(currentVersion)) {
|
|
fs.appendFileSync(webawesomePackageJSON.version);
|
|
}
|