generated from kriasoft/react-starter-kit
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostinstall.js
37 lines (32 loc) · 896 Bytes
/
postinstall.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
/* SPDX-License-Identifier: MIT */
import { execa } from "execa";
import fs from "node:fs";
import { EOL } from "node:os";
const environments = [
{ name: "local", description: "development" },
{ name: "test", description: "staging/QA" },
{ name: "prod", description: "production" },
];
// Create Git-ignored files for environment variable overrides
for (const env of environments) {
const filename = `./env/.${env.name}.override.env`;
if (!fs.existsSync(filename)) {
await fs.writeFile(
filename,
[
`# Overrides for the "${env.name}" (${env.description}) environment`,
"#",
"# CLOUDFLARE_API_TOKEN=xxxxx",
"#",
"",
].join(EOL),
"utf-8",
);
}
}
try {
await execa("yarn", ["tsc", "--build"], { stdin: "inherit" });
} catch (err) {
console.error(err);
}