Skip to content

Commit e0fd5e1

Browse files
committed
feat: add file renaming script and update build process to include it
1 parent 3fb99b1 commit e0fd5e1

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"scripts": {
66
"ng": "ng",
77
"start": "ng serve",
8-
"build": "ng build",
8+
"build": "ng build && npm run rename-files",
99
"watch": "ng build --watch --configuration development",
1010
"test": "ng test",
11-
"serve:ssr:angular-hub": "node dist/angular-hub/server/server.mjs"
11+
"serve:ssr:angular-hub": "node dist/angular-hub/server/server.mjs",
12+
"rename-files": "node scripts/rename-server-files.js"
1213
},
1314
"private": true,
1415
"prettier": {

scripts/rename-server-files.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
4+
const serverDir = "./dist/angular-hub/server";
5+
const files = fs.readdirSync(serverDir);
6+
7+
files.forEach((file) => {
8+
if (file.includes(".server.")) {
9+
const newName = file.replace(".server.", "-server.");
10+
fs.renameSync(path.join(serverDir, file), path.join(serverDir, newName));
11+
}
12+
});

0 commit comments

Comments
 (0)