Skip to content

Commit

Permalink
Update version script
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Apr 26, 2024
1 parent ca313db commit 53924e4
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions scripts/version.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
const path = require("path");
const fs = require("node:fs");
const { execSync } = require("child_process");
const fsp = require("fs/promises");
const chalk = require("chalk");
const semver = require("semver");

const {
ensureCleanWorkingDirectory,
invariant,
updateExamplesPackageConfig,
updatePackageConfig,
} = require("./utils");
const { EXAMPLES_DIR } = require("./constants");

async function run() {
try {
Expand All @@ -33,15 +30,10 @@ async function run() {
invariant(version != null, `Invalid version specifier: ${givenVersion}`);

// 2. Bump package versions
let packageDirNamesToBump = [
"react-router",
"react-router-dom",
"remix-dev",
"remix-express",
"remix-node",
"remix-serve",
"remix-server-runtime",
];
let packageDirNamesToBump = fs
.readdirSync("packages")
.filter((name) => fs.statSync(`packages/${name}`).isDirectory());

for (let packageDirName of packageDirNamesToBump) {
let packageName;
await updatePackageConfig(packageDirName, (pkg) => {
Expand All @@ -53,20 +45,7 @@ async function run() {
);
}

// 3. Update react-router and react-router-dom versions in the examples
let examples = await fsp.readdir(EXAMPLES_DIR);
for (const example of examples) {
let stat = await fsp.stat(path.join(EXAMPLES_DIR, example));
if (!stat.isDirectory()) continue;

await updateExamplesPackageConfig(example, (config) => {
if (config.dependencies["react-router"]) {
config.dependencies["react-router"] = version;
}
});
}

// 4. Commit and tag
// 3. Commit and tag
if (!skipGit) {
execSync(`git commit --all --message="Version ${version}"`);
execSync(`git tag -a -m "Version ${version}" v${version}`);
Expand Down

0 comments on commit 53924e4

Please sign in to comment.