viza 1.5.49 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,8 @@
1
1
  import { bootstrapGatewayConfigFromGitHub } from "@vizamodo/viza-dispatcher";
2
- export async function bootstrapCommand() {
3
- await bootstrapGatewayConfigFromGitHub();
4
- console.log(" Bootstrap completed.");
2
+ export async function vizaBootstrapCommand(runtimeEnv) {
3
+ if (!runtimeEnv) {
4
+ throw new Error("Missing runtimeEnv. Use --dev or --prod.");
5
+ }
6
+ await bootstrapGatewayConfigFromGitHub(runtimeEnv);
7
+ console.log(`✅ Bootstrap completed for environment: ${runtimeEnv}`);
5
8
  }
@@ -1,16 +1,20 @@
1
- import { bootstrapCommand } from "./index.js";
1
+ import { vizaBootstrapCommand } from "./index.js";
2
2
  /**
3
3
  * Register `viza bootstrap` commands
4
4
  */
5
5
  export function registerBootstrapCommand(program) {
6
6
  const cmd = program
7
7
  .command("bootstrap")
8
- .description("Bootstrap infrastructure or system components");
8
+ .description("Bootstrap infrastructure or system components")
9
+ .option("--prod", "Use production environment")
10
+ .option("--dev", "Use development environment");
9
11
  // Default bootstrap
10
- cmd.action(async (_opts, command) => {
11
- await bootstrapCommand();
12
+ cmd.action(async (opts) => {
13
+ const { prod, dev } = opts;
14
+ if ((prod && dev) || (!prod && !dev)) {
15
+ throw new Error("You must specify exactly one environment: --dev or --prod");
16
+ }
17
+ const runtimeEnv = prod ? "prod" : "dev";
18
+ await vizaBootstrapCommand(runtimeEnv);
12
19
  });
13
- // ⬇️ Sau này mở rộng rất dễ:
14
- // registerBootstrapAwsCommand(cmd);
15
- // registerBootstrapCloudflareCommand(cmd);
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.5.49",
3
+ "version": "1.6.2",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "release:prod": "rm -rf dist && npx npm-check-updates -u && npm install && git add package.json package-lock.json && git commit -m 'chore(deps): auto update dependencies before release' || echo 'No changes' && node versioning.js && npm login && npm publish --tag latest --access public && git push"
17
17
  },
18
18
  "dependencies": {
19
- "@vizamodo/viza-dispatcher": "^1.4.85",
19
+ "@vizamodo/viza-dispatcher": "^1.4.92",
20
20
  "adm-zip": "^0.5.16",
21
21
  "chalk": "^5.6.2",
22
22
  "clipboardy": "^5.3.0",