-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (45 loc) · 1.36 KB
/
index.js
File metadata and controls
48 lines (45 loc) · 1.36 KB
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
const fs = require("fs");
const path = require("path");
module.exports = async function (prompts) {
const lib = await prompts({
name: "value",
initial: true,
type: "confirm",
message: "Create a library project?",
});
if (lib) {
return {
ts: true,
lib: true,
test: true,
dirs: ["src"],
framework: "react",
lint: ["stylelint", "commitlint", "eslint"],
files: [
["src/index.ts", fs.readFileSync(resolve("files/lib/src/index.ts"))][
("src/Button.tsx", fs.readFileSync(resolve("files/lib/src/Button.tsx")))
],
["test/button.test.tsx", fs.readFileSync(resolve("files/lib/test/button.test.tsx"))],
],
};
} else {
return {
ts: true,
lib: false,
test: true,
framework: "react",
dirs: ["src", "public"],
lint: ["stylelint", "commitlint", "eslint"],
files: [
["index.html", fs.readFileSync(resolve("files/app/index.html"))],
["src/main.tsx", fs.readFileSync(resolve("files/app/src/main.tsx"))],
["src/App.tsx", fs.readFileSync(resolve("files/app/src/App.tsx"))],
["src/App.css", fs.readFileSync(resolve("files/app/src/App.css"))],
["src/index.scss", fs.readFileSync(resolve("files/app/src/index.css"))],
],
};
}
};
function resolve(filePath) {
return path.join(__dirname, filePath);
}