|
7 | 7 | * |
8 | 8 | * Usage: |
9 | 9 | * bun run build:backend |
10 | | - * bun run build:backend --environment staging |
11 | | - * bun run build:backend --environment production |
12 | 10 | */ |
13 | 11 |
|
14 | 12 | import { |
15 | 13 | COMPASS_BUILD_DEV, |
16 | 14 | COMPASS_ROOT_DEV, |
17 | 15 | } from "@scripts/common/cli.constants"; |
18 | | -import { getEnvironmentAnswer, log } from "@scripts/common/cli.utils"; |
19 | 16 | import { $ } from "bun"; |
20 | 17 | import path from "node:path"; |
| 18 | +import { styleText } from "node:util"; |
21 | 19 |
|
22 | 20 | const BACKEND_BUILD = path.join(COMPASS_BUILD_DEV, "backend"); |
23 | 21 |
|
24 | | -// Parse --environment flag; prompt if absent |
25 | | -const envFlagIdx = process.argv.indexOf("--environment"); |
26 | | -let environment: string = |
27 | | - envFlagIdx !== -1 ? (process.argv[envFlagIdx + 1] ?? "") : ""; |
28 | | - |
29 | | -const validEnvs = ["local", "staging", "production"]; |
30 | | -if (!validEnvs.includes(environment)) { |
31 | | - environment = await getEnvironmentAnswer(); |
32 | | -} |
| 22 | +const log = { |
| 23 | + info: (msg: string) => console.log(styleText(["italic", "whiteBright"], msg)), |
| 24 | + error: (msg: string) => console.log(styleText(["bold", "red"], msg)), |
| 25 | + warning: (msg: string) => console.log(styleText("yellow", msg)), |
| 26 | + success: (msg: string) => console.log(styleText("green", msg)), |
| 27 | + tip: (msg: string) => console.log(styleText("yellowBright", msg)), |
| 28 | +}; |
33 | 29 |
|
34 | 30 | // 1. Clean old build |
35 | 31 | log.info("Removing old backend build ..."); |
|
0 commit comments