forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (44 loc) · 1.16 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
const inquirer = require("inquirer");
const fs = require("fs/promises");
const { join } = require("path");
const files = [
["README.md"],
["netlify.toml"],
["edge-server.js", "server.js"],
["remix.config-edge.js", "remix.config.js"],
["vscode.json", join(".vscode", "settings.json")],
["app/entry.server.tsx"],
["app/root.tsx"],
];
async function main({ rootDirectory }) {
if (await shouldUseEdge()) {
await fs.mkdir(join(rootDirectory, ".vscode"));
for (let [file, target] of files) {
await fs.copyFile(
join(rootDirectory, "remix.init", file),
join(rootDirectory, target || file)
);
}
}
}
async function shouldUseEdge() {
let { edge } = await inquirer.prompt([
{
name: "edge",
type: "list",
message: "Run your Remix site with:",
choices: [
{
name: "Netlify Functions - Choose this for stable support for production sites",
value: false,
},
{
name: "Netlify Edge Functions (beta) - Try this for improved performance on non-critical sites",
value: true,
},
],
},
]);
return edge;
}
module.exports = main;