-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpostinstall.js
More file actions
34 lines (28 loc) · 937 Bytes
/
postinstall.js
File metadata and controls
34 lines (28 loc) · 937 Bytes
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
var hook = require("nativescript-hook")(__dirname);
hook.postinstall();
var fs = require("fs");
var path = require("path");
var upgrader = require("./tsconfig-upgrader");
var projectDir = hook.findProjectDir();
if (projectDir) {
const tsconfigPath = path.join(projectDir, "tsconfig.json");
if (fs.existsSync(tsconfigPath)) {
upgrader.migrateTsConfig(tsconfigPath, projectDir);
} else {
createTsconfig(tsconfigPath);
}
}
function createTsconfig(tsconfigPath) {
var tsconfig = {};
tsconfig.compilerOptions = {
module: "commonjs",
target: "es5",
experimentalDecorators: true,
emitDecoratorMetadata: true,
noEmitHelpers: true,
noEmitOnError: true,
};
upgrader.migrateProject(tsconfig, tsconfigPath, projectDir);
tsconfig.exclude = ["node_modules", "platforms"];
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
}