-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinitConfigFolder.js
More file actions
40 lines (33 loc) · 1.33 KB
/
initConfigFolder.js
File metadata and controls
40 lines (33 loc) · 1.33 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
const fs = require('fs-extra')
const path = require('path');
function initConfigFolder() {
const configFolderExist = fs.existsSync('./use-generated-config/')
if (!configFolderExist) {
fs.copy(path.join(__dirname,'./code-for-copy/use-generated-config/'), './use-generated-config/')
.then(() => console.log('success!'))
.catch(err => console.error(err));
}
const prismaFolderExists = fs.existsSync('./prisma/')
if(!prismaFolderExists) {
fs.copy(path.join(__dirname,'./code-for-copy/prisma-init/'), './prisma/')
.then(() => console.log('success!'))
.catch(err => console.error(err));
}
const computedFolderExists = fs.existsSync('./src/computed-props/')
if(!computedFolderExists) {
fs.copy(path.join(__dirname,'./code-for-copy/computed-props/'), './src/computed-props/')
.then(() => console.log('success!'))
.catch(err => console.error(err));
}
const initialAppModuleContents = fs.readFileSync(path.join(__dirname,'./code-for-copy/app.module.ts')).toString();
fs.writeFileSync(
"./src/app.module.ts",
initialAppModuleContents,
{ flag: 'w' });
const initialAppServiceContents = fs.readFileSync(path.join(__dirname,'./code-for-copy/app.service.ts')).toString();
fs.writeFileSync(
"./src/app.service.ts",
initialAppServiceContents,
{ flag: 'w' });
}
initConfigFolder()