Skip to content

Commit 372f496

Browse files
committed
chore: build fixes related to environment files handling
1 parent 31cb8af commit 372f496

File tree

10 files changed

+68
-49
lines changed

10 files changed

+68
-49
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@
449449
}
450450
},
451451
"engines": {
452-
"node": ">=16.20.1",
452+
"node": ">=20.11.1",
453453
"yarn": ">=1.22.19"
454454
},
455455
"prettier": {

packages/config/package.json

+20-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
"url": "https://ever.co"
99
},
1010
"license": "AGPL-3.0",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/ever-co/ever-gauzy"
14+
},
15+
"bugs": {
16+
"url": "https://github.com/ever-co/ever-gauzy/issues"
17+
},
18+
"homepage": "https://ever.co",
19+
"keywords": [
20+
"gauzy",
21+
"angular",
22+
"configuration",
23+
"environment",
24+
"settings",
25+
"library"
26+
],
1127
"private": true,
1228
"main": "dist/index.js",
1329
"types": "dist/index.d.ts",
@@ -23,10 +39,10 @@
2339
},
2440
"scripts": {
2541
"build": "rimraf dist && yarn run compile",
26-
"build:prod": "node replaceEnvFiles.js && yarn build",
27-
"compile": "tsc -p tsconfig.build.json"
42+
"build:prod": "cross-env NODE_ENV=production yarn ts-node scripts/replace-env-files.ts --environment=prod && yarn build",
43+
"compile": "tsc -p tsconfig.build.json",
44+
"clean": "rimraf dist"
2845
},
29-
"keywords": [],
3046
"dependencies": {
3147
"@nestjs/config": "^3.2.0",
3248
"dotenv": "^16.0.3",
@@ -36,6 +52,7 @@
3652
"@gauzy/common": "^0.1.0",
3753
"@types/node": "^20.14.9",
3854
"rimraf": "^3.0.2",
55+
"cross-env": "^7.0.3",
3956
"typescript": "5.1.6"
4057
}
4158
}

packages/config/replaceEnvFiles.js

-20
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as path from 'path';
2+
import * as fs from 'fs';
3+
4+
function replaceFilesForProduction() {
5+
const env = process.env['NODE_ENV'] || 'development';
6+
7+
console.log(`Current NODE_ENV: ${process.env['NODE_ENV']}`);
8+
9+
if (env === 'production') {
10+
const sourceFile = path.join(path.resolve('./src/environments'), 'environment.prod.ts');
11+
const targetFile = path.join(path.resolve('./src/environments'), 'environment.ts');
12+
13+
fs.copyFileSync(sourceFile, targetFile);
14+
console.log(`Replaced environment file with ${sourceFile}`);
15+
} else {
16+
console.log('Development build, no file replacement necessary.');
17+
}
18+
}
19+
20+
replaceFilesForProduction();

packages/config/src/environments/environment.prod.ts

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const environment: IEnvironment = {
5959
*/
6060
THROTTLE_TTL: parseInt(process.env.THROTTLE_TTL) || 60 * 1000,
6161
THROTTLE_LIMIT: parseInt(process.env.THROTTLE_LIMIT) || 60000,
62+
THROTTLE_ENABLED: process.env.THROTTLE_ENABLED == 'true',
6263

6364
/**
6465
* Jitsu Server Configuration

packages/plugins/job-search-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"job listings"
4545
],
4646
"engines": {
47-
"node": ">=16.20.1",
47+
"node": ">=20.11.1",
4848
"yarn": ">=1.22.19"
4949
},
5050
"sideEffects": false

packages/ui-auth/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"ui"
4747
],
4848
"engines": {
49-
"node": ">=16.20.1",
49+
"node": ">=20.11.1",
5050
"yarn": ">=1.22.19"
5151
},
5252
"sideEffects": false

packages/ui-config/package.json

+21-20
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
"url": "https://ever.co"
99
},
1010
"license": "AGPL-3.0",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/ever-co/ever-gauzy"
14+
},
15+
"bugs": {
16+
"url": "https://github.com/ever-co/ever-gauzy/issues"
17+
},
18+
"homepage": "https://ever.co",
19+
"keywords": [
20+
"gauzy",
21+
"angular",
22+
"configuration",
23+
"environment",
24+
"settings",
25+
"library"
26+
],
1127
"private": true,
1228
"main": "dist/fesm2022/gauzy-ui-config.mjs",
1329
"module": "dist/fesm2022/gauzy-ui-config.mjs",
@@ -28,8 +44,8 @@
2844
"access": "restricted"
2945
},
3046
"scripts": {
31-
"lib:build": "ng build ui-config --configuration development",
32-
"lib:build:prod": "yarn ts-node scripts/replace-env-files.ts && ng build ui-config --configuration production",
47+
"lib:build": "rimraf dist && ng build ui-config --configuration development",
48+
"lib:build:prod": "cross-env NODE_ENV=production yarn ts-node scripts/replace-env-files.ts --environment=prod && ng build ui-config --configuration production",
3349
"lib:watch": "ng build ui-config --watch --configuration development",
3450
"clean": "rimraf dist"
3551
},
@@ -42,26 +58,11 @@
4258
},
4359
"devDependencies": {
4460
"@types/node": "^20.14.9",
45-
"rimraf": "^3.0.2"
61+
"rimraf": "^3.0.2",
62+
"cross-env": "^7.0.3"
4663
},
47-
"repository": {
48-
"type": "git",
49-
"url": "https://github.com/ever-co/ever-gauzy"
50-
},
51-
"bugs": {
52-
"url": "https://github.com/ever-co/ever-gauzy/issues"
53-
},
54-
"homepage": "https://ever.co",
55-
"keywords": [
56-
"gauzy",
57-
"angular",
58-
"configuration",
59-
"environment",
60-
"settings",
61-
"library"
62-
],
6364
"engines": {
64-
"node": ">=16.20.1",
65+
"node": ">=20.11.1",
6566
"yarn": ">=1.22.19"
6667
},
6768
"sideEffects": false

packages/ui-config/scripts/replace-env-files.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as path from 'path';
22
import * as fs from 'fs';
33

44
function replaceFilesForProduction() {
5-
const env = process.env.NODE_ENV || 'development';
5+
const env = process.env['NODE_ENV'] || 'development';
66

7-
console.log(`Current NODE_ENV: ${process.env.NODE_ENV}`);
7+
console.log(`Current NODE_ENV: ${process.env['NODE_ENV']}`);
88

99
if (env === 'production') {
1010
const sourceFile = path.join(path.resolve(`./src/lib/environments`), 'environment.prod.ts');

packages/ui-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"ui"
118118
],
119119
"engines": {
120-
"node": ">=16.20.1",
120+
"node": ">=20.11.1",
121121
"yarn": ">=1.22.19"
122122
},
123123
"sideEffects": false,

0 commit comments

Comments
 (0)