-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmynode.js
More file actions
53 lines (49 loc) · 1.25 KB
/
mynode.js
File metadata and controls
53 lines (49 loc) · 1.25 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
49
50
51
52
53
const fs = require("fs");
const path = require("path");
const successColor = "\x1b[32m%s\x1b[0m";
const checkSign = "\u{2705}";
const dotenv = require("dotenv").config({ path: ".env" });
const envFile = `export const environment = {
production: false,
SUPABASE_URL: '${process.env.SUPABASE_URL}',
SUPABASE_KEY: '${process.env.SUPABASE_KEY}',
MAPBOX_KEY: '${process.env.MAPBOX_KEY}',
};
`;
const envFileProd = `export const environment = {
production: true,
SUPABASE_URL: '${process.env.SUPABASE_URL}',
SUPABASE_KEY: '${process.env.SUPABASE_KEY}',
MAPBOX_KEY: '${process.env.MAPBOX_KEY}',
};
`;
const targetPathDev = path.join(
__dirname,
"./src/environments/environment.development.ts"
);
fs.writeFile(targetPathDev, envFile, (err) => {
if (err) {
console.error(err);
throw err;
} else {
console.log(
successColor,
`${checkSign} Successfully generated environment.development.ts`
);
}
});
const targetPathProd = path.join(
__dirname,
"./src/environments/environment.ts"
);
fs.writeFile(targetPathProd, envFileProd, (err) => {
if (err) {
console.error(err);
throw err;
} else {
console.log(
successColor,
`${checkSign} Successfully generated environment.ts`
);
}
});