mirror of
https://github.com/ZTatman/myst.git
synced 2026-11-22 12:57:58 +00:00
fix(cli): unlink .env.temp before writing to file in case it was already
created
This commit is contained in:
parent
cd216cd660
commit
69ad95a7b2
1 changed files with 3 additions and 1 deletions
|
|
@ -115,7 +115,8 @@ async function init(opts: { output?: string }) {
|
||||||
{
|
{
|
||||||
forgejoBaseUrl: () =>
|
forgejoBaseUrl: () =>
|
||||||
p.text({
|
p.text({
|
||||||
message: "Forgejo API URL (how Myst reaches Forgejo, not your browser URL)?",
|
message:
|
||||||
|
"Forgejo API URL (how Myst reaches Forgejo, not your browser URL)?",
|
||||||
placeholder: "http://forgejo:3000",
|
placeholder: "http://forgejo:3000",
|
||||||
validate: (v) => validateHttpUrlOrHost(v, "Forgejo base URL"),
|
validate: (v) => validateHttpUrlOrHost(v, "Forgejo base URL"),
|
||||||
}),
|
}),
|
||||||
|
|
@ -148,6 +149,7 @@ async function init(opts: { output?: string }) {
|
||||||
|
|
||||||
if (envExists) {
|
if (envExists) {
|
||||||
const tempPath = envPath + ".tmp";
|
const tempPath = envPath + ".tmp";
|
||||||
|
await fs.unlink(tempPath).catch(() => {});
|
||||||
await fs.writeFile(tempPath, envContent, {
|
await fs.writeFile(tempPath, envContent, {
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
flag: "wx",
|
flag: "wx",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue