@bedrock-rbx/core 0.1.0-beta.1 → 0.1.0-beta.3

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.
package/dist/cli/run.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { T as serializeStateFile, a as buildStatePort, d as resolveStateConfig, f as flattenConfig, h as diff, i as loadConfig, l as validatePlan, n as serializeConfig, o as buildDesired, r as deploy, t as migrateMantleState, u as selectEnvironment } from "../migrate-mantle-state-DqbJ1TLq.mjs";
2
+ import { T as serializeStateFile, a as buildStatePort, d as resolveStateConfig, f as flattenConfig, h as diff, i as loadConfig, l as validatePlan, n as serializeConfig, o as buildDesired, r as deploy, t as migrateMantleState, u as selectEnvironment } from "../migrate-mantle-state-_7Tkn0hG.mjs";
3
3
  import { PermissionError } from "@bedrock-rbx/ocale";
4
4
  import process from "node:process";
5
5
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -7,7 +7,21 @@ import { dirname, join } from "node:path";
7
7
  import sade from "sade";
8
8
  import { cancel, intro, isCancel, log, outro, path, select, text } from "@clack/prompts";
9
9
  //#region package.json
10
- var version = "0.1.0-beta.1";
10
+ var version = "0.1.0-beta.2";
11
+ //#endregion
12
+ //#region src/cli/credential-environment-overrides.ts
13
+ /**
14
+ * Map CLI credential flags to their corresponding env-var names, omitting
15
+ * entries whose flag is `undefined`.
16
+ * @param flags - CLI credential flag values to translate.
17
+ * @returns An immutable record of env-var names to their override values.
18
+ */
19
+ function buildCredentialOverrides(flags) {
20
+ const overrides = {};
21
+ if (flags.apiKey !== void 0) overrides["BEDROCK_API_KEY"] = flags.apiKey;
22
+ if (flags.githubToken !== void 0) overrides["GITHUB_TOKEN"] = flags.githubToken;
23
+ return overrides;
24
+ }
11
25
  //#endregion
12
26
  //#region src/cli/parse-options.ts
13
27
  const RECOGNIZED_FLAGS$1 = new Set([
@@ -347,11 +361,8 @@ async function dispatchEnvironments$1(inputs) {
347
361
  return failed;
348
362
  }
349
363
  function buildGetEnvironment$1(parsed) {
350
- return (name) => {
351
- if (name === "ROBLOX_API_KEY" && parsed.apiKey !== void 0) return parsed.apiKey;
352
- if (name === "GITHUB_TOKEN" && parsed.githubToken !== void 0) return parsed.githubToken;
353
- return process.env[name];
354
- };
364
+ const overrides = buildCredentialOverrides(parsed);
365
+ return (name) => overrides[name] ?? process.env[name];
355
366
  }
356
367
  function cancelAsFailed$1(clack) {
357
368
  clack.cancel("deploy failed");
@@ -530,11 +541,8 @@ function loadOptionsFor(parsed) {
530
541
  return parsed.configFile === void 0 ? void 0 : { configFile: parsed.configFile };
531
542
  }
532
543
  function buildGetEnvironment(parsed) {
533
- return (name) => {
534
- if (name === "ROBLOX_API_KEY" && parsed.apiKey !== void 0) return parsed.apiKey;
535
- if (name === "GITHUB_TOKEN" && parsed.githubToken !== void 0) return parsed.githubToken;
536
- return process.env[name];
537
- };
544
+ const overrides = buildCredentialOverrides(parsed);
545
+ return (name) => overrides[name] ?? process.env[name];
538
546
  }
539
547
  function cancelAsFailed(clack) {
540
548
  clack.cancel("diff failed");
@@ -1462,8 +1470,8 @@ const PROGRAM_DESCRIBE = "Infrastructure-as-Code deployment tool for Roblox";
1462
1470
  */
1463
1471
  function createProg(deps = {}) {
1464
1472
  const prog = sade(PROGRAM_NAME).describe(PROGRAM_DESCRIBE).version(version);
1465
- prog.command("deploy").describe("Reconcile a project's resources against the configured environment(s)").option("--env", "Target environment (repeat for multiple)").option("--config", "Config file path (overrides discovery)").option("--api-key", "Override the ROBLOX_API_KEY environment variable").option("--github-token", "Override the GITHUB_TOKEN environment variable").action(deployCommand(deps));
1466
- prog.command("diff").describe("Preview the operations a deploy would apply, without writing state").option("--env", "Target environment (repeat for multiple)").option("--config", "Config file path (overrides discovery)").option("--api-key", "Override the ROBLOX_API_KEY environment variable").option("--github-token", "Override the GITHUB_TOKEN environment variable").action(diffCommand(deps));
1473
+ prog.command("deploy").describe("Reconcile a project's resources against the configured environment(s)").option("--env", "Target environment (repeat for multiple)").option("--config", "Config file path (overrides discovery)").option("--api-key", "Override the BEDROCK_API_KEY environment variable").option("--github-token", "Override the GITHUB_TOKEN environment variable").action(deployCommand(deps));
1474
+ prog.command("diff").describe("Preview the operations a deploy would apply, without writing state").option("--env", "Target environment (repeat for multiple)").option("--config", "Config file path (overrides discovery)").option("--api-key", "Override the BEDROCK_API_KEY environment variable").option("--github-token", "Override the GITHUB_TOKEN environment variable").action(diffCommand(deps));
1467
1475
  prog.command("migrate [stateFilePath]").describe("Translate a state file from another tool into a bedrock project").option("--from", "Source format to migrate from (mantle; prompted if omitted)").action(migrateCommand(deps));
1468
1476
  return prog;
1469
1477
  }