Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpostinstall.js
More file actions
Latest commit
34 lines (28 loc) · 937 Bytes
/
Copy pathpostinstall.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
varhook=require("nativescript-hook")(__dirname);
hook.postinstall();
varfs=require("fs");
varpath=require("path");
varupgrader=require("./tsconfig-upgrader");
varprojectDir=hook.findProjectDir();
if(projectDir){
consttsconfigPath=path.join(projectDir,"tsconfig.json");
if(fs.existsSync(tsconfigPath)){
upgrader.migrateTsConfig(tsconfigPath,projectDir);
}else{
createTsconfig(tsconfigPath);
}
}
functioncreateTsconfig(tsconfigPath){
vartsconfig={};
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));
}