This repository was archived by the owner on Sep 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.create-somod.js
84 lines (73 loc) · 1.95 KB
/
.create-somod.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* eslint-disable */
const { join } = require("path");
const { readFile } = require("fs/promises");
async function loadFile(files, file, binary = false) {
files[file] = await readFile(
join(__dirname, "template", file),
binary ? undefined : "utf8"
);
}
/**
* @type {import("./src/config").GetConfig}
*/
module.exports = async mode => {
const ignoreList = ["node_modules", "/build", "/parameters.json"];
const defaultCompilerOptions = {
allowUmdGlobalAccess: true,
outDir: "build",
declaration: true,
target: "ES5",
module: "ES6",
rootDir: "./",
lib: ["ESNext"],
moduleResolution: "Node",
esModuleInterop: true,
importHelpers: true,
skipLibCheck: true
};
const defaultInclude = ["lib"];
const defaultExclude = [];
const files = {};
await loadFile(files, "lib/index.ts");
if (mode == "ALL" || mode == "UI") {
ignoreList.push(
".next",
"tsconfig.json",
"/pages",
"/public",
"next-env.d.ts",
".env",
"next.config.js"
);
defaultCompilerOptions.jsx = "react";
defaultInclude.push("ui");
await loadFile(files, "ui/pages/_document.tsx");
await loadFile(files, "ui/pages/index.tsx");
await loadFile(files, "ui/public/favicon.ico", true);
await loadFile(files, "ui/config.yaml");
await loadFile(files, "parameters.yaml");
await loadFile(files, "tsconfig.json");
}
if (mode == "ALL" || mode == "SERVERLESS") {
ignoreList.push(".aws-sam", "samconfig.toml", "/template.yaml");
await loadFile(files, "serverless/template.yaml");
}
return {
somodName: "somod",
somodVersion: "^1.13.0",
ignorePaths: {
git: ignoreList,
prettier: [...ignoreList, "tsconfig.somod.json"],
eslint: ignoreList
},
tsConfig: {
compilerOptions: defaultCompilerOptions,
include: defaultInclude,
exclude: defaultExclude
},
files,
dependencies: {
dev: ["@types/node"]
}
};
};