Skip to content

Commit d997ae8

Browse files
committed
chore: add script to deploy preview frontend
1 parent 1d3abf3 commit d997ae8

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

frontend/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
"madge": " madge --circular --extensions ts ./src",
1616
"start": "vite preview --port 3000",
1717
"dev": "vite dev",
18-
"deploy-live": "npm run check-assets && npm run build && firebase deploy -P live --only hosting",
19-
"deploy-preview": "npm run check-assets && npm run build && firebase hosting:channel:deploy preview -P live --expires 2h",
2018
"test": "vitest run",
2119
"test-coverage": "vitest run --coverage",
2220
"dev-test": "concurrently --kill-others \"vite dev\" \"vitest\"",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"start-fe": "turbo run start --filter @monkeytype/frontend",
3535
"docker": "cd backend && npm run docker",
3636
"audit-fe": "cd frontend && npm run audit",
37+
"preview-fe": "monkeytype-release --preview-fe",
3738
"release": "monkeytype-release",
3839
"release-fe": "monkeytype-release --fe",
3940
"release-be": "monkeytype-release --be",

packages/release/src/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const isBackend = args.has("--be");
2020
const isDryRun = args.has("--dry");
2121
const noSyncCheck = args.has("--no-sync-check");
2222
const hotfix = args.has("--hotfix");
23+
const previewFe = args.has("--preview-fe");
2324

2425
const PROJECT_ROOT = path.resolve(__dirname, "../../../");
2526

@@ -252,6 +253,35 @@ const createGithubRelease = async (version, changelogContent) => {
252253
};
253254

254255
const main = async () => {
256+
if (previewFe) {
257+
console.log(`Starting frontend preview deployment process...`);
258+
checkUncommittedChanges();
259+
installDependencies();
260+
runProjectRootCommand(
261+
"NODE_ENV=production npx turbo lint test check-assets build --filter @monkeytype/frontend --force",
262+
);
263+
264+
const name = readlineSync.question(
265+
"Enter preview channel name (default: preview): ",
266+
);
267+
const channelName = name.trim() || "preview";
268+
269+
const expirationTime = readlineSync.question(
270+
"Enter expiration time (e.g., 2h, default: 1d): ",
271+
);
272+
const expires = expirationTime.trim() || "1d";
273+
274+
console.log(
275+
`Deploying frontend preview to channel "${channelName}" with expiration "${expires}"...`,
276+
);
277+
const result = runProjectRootCommand(
278+
`cd frontend && npx firebase hosting:channel:deploy ${channelName} -P live --expires ${expires}`,
279+
);
280+
console.log(result);
281+
console.log("Frontend preview deployed successfully.");
282+
process.exit(0);
283+
}
284+
255285
console.log(`Starting ${hotfix ? "hotfix" : "release"} process...`);
256286

257287
if (!hotfix) checkBranchSync();

0 commit comments

Comments
 (0)