create-react-router 8.5.0 → 8.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cli.js +34 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# `create-react-router`
|
|
2
2
|
|
|
3
|
+
## v8.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Allow project scaffolding to complete when `git add` or the initial `git commit` fails ([#15737](https://github.com/remix-run/react-router/pull/15737))
|
|
8
|
+
- Derive the generated package name from the project directory basename ([#15698](https://github.com/remix-run/react-router/pull/15698))
|
|
9
|
+
- Handle absolute paths, trailing separators, and paths entered at the directory prompt
|
|
10
|
+
|
|
11
|
+
## v8.5.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Fix package manager command execution on Windows by handling `.cmd` shims properly ([#15565](https://github.com/remix-run/react-router/pull/15565))
|
|
16
|
+
|
|
3
17
|
## v8.5.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* create-react-router v8.5.
|
|
3
|
+
* create-react-router v8.5.2
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -1237,7 +1237,7 @@ var CopyTemplateError = class extends Error {
|
|
|
1237
1237
|
};
|
|
1238
1238
|
//#endregion
|
|
1239
1239
|
//#region package.json
|
|
1240
|
-
var version = "8.5.
|
|
1240
|
+
var version = "8.5.2";
|
|
1241
1241
|
//#endregion
|
|
1242
1242
|
//#region index.ts
|
|
1243
1243
|
const currentFileDir = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -1378,18 +1378,8 @@ async function projectNameStep(ctx) {
|
|
|
1378
1378
|
initial: "./my-react-router-app"
|
|
1379
1379
|
});
|
|
1380
1380
|
ctx.cwd = name;
|
|
1381
|
-
ctx.projectName = toValidProjectName(name);
|
|
1382
|
-
return;
|
|
1383
|
-
}
|
|
1384
|
-
let name = ctx.cwd;
|
|
1385
|
-
if (name === "." || name === "./") {
|
|
1386
|
-
let parts = process.cwd().split(path.sep);
|
|
1387
|
-
name = parts[parts.length - 1];
|
|
1388
|
-
} else if (name.startsWith("./") || name.startsWith("../")) {
|
|
1389
|
-
let parts = name.split("/");
|
|
1390
|
-
name = parts[parts.length - 1];
|
|
1391
1381
|
}
|
|
1392
|
-
ctx.projectName = toValidProjectName(
|
|
1382
|
+
ctx.projectName = toValidProjectName(path.basename(path.resolve(ctx.cwd)));
|
|
1393
1383
|
}
|
|
1394
1384
|
async function copyTemplateToTempDirStep(ctx) {
|
|
1395
1385
|
if (ctx.template) {
|
|
@@ -1595,6 +1585,11 @@ async function gitInitStep(ctx) {
|
|
|
1595
1585
|
let commitMsg = "Initial commit from create-react-router";
|
|
1596
1586
|
try {
|
|
1597
1587
|
await runCommand("git", ["init"], options);
|
|
1588
|
+
} catch (err) {
|
|
1589
|
+
error("Oh no!", "Failed to initialize git.");
|
|
1590
|
+
throw err;
|
|
1591
|
+
}
|
|
1592
|
+
try {
|
|
1598
1593
|
await runCommand("git", ["add", "."], options);
|
|
1599
1594
|
await runCommand("git", [
|
|
1600
1595
|
"commit",
|
|
@@ -1602,8 +1597,8 @@ async function gitInitStep(ctx) {
|
|
|
1602
1597
|
commitMsg
|
|
1603
1598
|
], options);
|
|
1604
1599
|
} catch (err) {
|
|
1605
|
-
error("
|
|
1606
|
-
|
|
1600
|
+
error("Git initialized, but the initial add/commit failed.", "Ensure Git user.name and user.email are configured, then create the commit manually.");
|
|
1601
|
+
if (ctx.debug) console.error(err);
|
|
1607
1602
|
}
|
|
1608
1603
|
},
|
|
1609
1604
|
ctx
|
|
@@ -1670,9 +1665,32 @@ async function installDependencies({ pkgManager, cwd, showInstallOutput }) {
|
|
|
1670
1665
|
throw err;
|
|
1671
1666
|
}
|
|
1672
1667
|
}
|
|
1668
|
+
const WINDOWS_CMD_SHIMS = new Set([
|
|
1669
|
+
"npm",
|
|
1670
|
+
"npx",
|
|
1671
|
+
"pnpm",
|
|
1672
|
+
"pnpx",
|
|
1673
|
+
"yarn",
|
|
1674
|
+
"yarnpkg"
|
|
1675
|
+
]);
|
|
1676
|
+
const WINDOWS_EXE_SHIMS = new Set(["bun", "bunx"]);
|
|
1677
|
+
function resolveWindowsCommand(command, args) {
|
|
1678
|
+
if (command.includes("/") || command.includes("\\") || command.includes(".")) return [command, args];
|
|
1679
|
+
const normalizedCommand = command.toLowerCase();
|
|
1680
|
+
if (WINDOWS_CMD_SHIMS.has(normalizedCommand)) return ["cmd.exe", [
|
|
1681
|
+
"/d",
|
|
1682
|
+
"/s",
|
|
1683
|
+
"/c",
|
|
1684
|
+
command,
|
|
1685
|
+
...args
|
|
1686
|
+
]];
|
|
1687
|
+
if (WINDOWS_EXE_SHIMS.has(normalizedCommand)) return [`${command}.exe`, args];
|
|
1688
|
+
return [command, args];
|
|
1689
|
+
}
|
|
1673
1690
|
function runCommand(command, args, options) {
|
|
1674
1691
|
return new Promise((resolve, reject) => {
|
|
1675
|
-
|
|
1692
|
+
const [resolvedCommand, resolvedArgs] = process.platform === "win32" ? resolveWindowsCommand(command, args) : [command, args];
|
|
1693
|
+
const child = spawn(resolvedCommand, resolvedArgs, options);
|
|
1676
1694
|
child.on("error", reject);
|
|
1677
1695
|
child.on("exit", (code, signal) => {
|
|
1678
1696
|
if (code === 0) resolve();
|