@philkrpp/phase-loader 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -43,6 +43,7 @@ secrets: host, app ids, paths and keyring account names only.
43
43
  | `targets.<name>.env` | Phase environment name, e.g. `Development`. |
44
44
  | `targets.<name>.account` | OS keyring account (service `phase`) holding the service token for this target. |
45
45
  | `targets.<name>.layers` | Apps (`appId` = Phase app UUID; `app` = name for messages) and paths, exported in order; later layers win. |
46
+ | `targets.<name>.require` | Optional; replaces the top-level `require` for this target (e.g. a release target without a database). |
46
47
  | `targets.<name>.personal.account` | Optional keyring account holding a personal app id or name; exported last (path `/`). |
47
48
  | `require` | Keys the merged export must contain; otherwise loading fails and lists the missing names. |
48
49
  | `allowLiteral` | Keys whose value may start with `${`. Any other value starting with `${` is an unresolved Phase reference and fails the load. |
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as KEYRING_SERVICE, c as loadConfig, l as PhaseLoaderError, n as fetchLayers, s as writeKeyring, t as run } from "./run-CkwwrycO.js";
2
+ import { a as KEYRING_SERVICE, c as loadConfig, l as PhaseLoaderError, n as fetchLayers, s as writeKeyring, t as run } from "./run-DuN8Wqw9.js";
3
3
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { execFileSync } from "node:child_process";
@@ -101,7 +101,8 @@ function trackedFiles(dir) {
101
101
  "ignore",
102
102
  "pipe",
103
103
  "ignore"
104
- ]
104
+ ],
105
+ maxBuffer: 268435456
105
106
  }).split("\0").filter(Boolean);
106
107
  } catch {
107
108
  throw new PhaseLoaderError(`"git ls-files" failed in ${dir}: check needs a git repository.`);
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ interface PhaseTarget {
16
16
  personal?: {
17
17
  account: string;
18
18
  };
19
+ /** Replaces the top-level `require` for this target (e.g. a release target without a database). */
20
+ require?: string[];
19
21
  }
20
22
  interface PhaseConfig {
21
23
  /** Directory that contains `phase.config.json`. */
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { l as PhaseLoaderError, c as loadConfig, r as loadPhaseEnv, i as loadPhaseEnvSync, o as readToken, t as run } from "./run-CkwwrycO.js";
1
+ export { l as PhaseLoaderError, c as loadConfig, r as loadPhaseEnv, i as loadPhaseEnvSync, o as readToken, t as run } from "./run-DuN8Wqw9.js";
@@ -77,6 +77,7 @@ function parseConfig(file, dir) {
77
77
  if (!isObject$1(value.personal)) return fail(`${at}: "personal" must be an object`);
78
78
  target.personal = { account: str(value.personal.account, ACCOUNT, `${at}: "personal.account" must be a keyring account name`) };
79
79
  }
80
+ if (value.require !== void 0) target.require = keys(value.require, `targets.${name}.require`);
80
81
  targets[name] = target;
81
82
  }
82
83
  return {
@@ -232,7 +233,7 @@ async function fetchLayers(target, cwd) {
232
233
  function merge(target, config, fetched, keep) {
233
234
  const exported = {};
234
235
  for (const layer of fetched) for (const [key, value] of layer.entries) exported[key] = value;
235
- const missing = config.require.filter((key) => !Object.hasOwn(exported, key));
236
+ const missing = (config.targets[target]?.require ?? config.require).filter((key) => !Object.hasOwn(exported, key));
236
237
  if (missing.length > 0) throw new PhaseLoaderError(`Phase export for "${target}" lacks required key(s): ${missing.join(", ")}. Check the token's access.`);
237
238
  const env = {};
238
239
  for (const [key, value] of Object.entries(exported)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@philkrpp/phase-loader",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Load env values from a self-hosted Phase secrets manager into a child process or the current process, with layered apps/paths and OS keyring tokens.",
5
5
  "license": "MIT",
6
6
  "repository": {