@jondotsoy/envs 0.1.0 → 0.1.1
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/envs.js +9 -1
- package/package.json +1 -1
package/envs.js
CHANGED
|
@@ -372,6 +372,7 @@ async function pull(ctx) {
|
|
|
372
372
|
return 1;
|
|
373
373
|
const { path: valuesPath, values } = read;
|
|
374
374
|
const envs = values.envs ??= {};
|
|
375
|
+
const defaults = values.defaults ?? {};
|
|
375
376
|
for (const { name, path } of await listWorktrees(ctx.cwd)) {
|
|
376
377
|
const dotenv = Bun.file(join(path, ".env"));
|
|
377
378
|
if (!await dotenv.exists())
|
|
@@ -382,7 +383,14 @@ async function pull(ctx) {
|
|
|
382
383
|
delete byWorktree[name];
|
|
383
384
|
}
|
|
384
385
|
for (const [key, value] of Object.entries(parsed)) {
|
|
385
|
-
|
|
386
|
+
const parsedValue = parseValue(value);
|
|
387
|
+
const fromDefaults = key in defaults && String(defaults[key]) === String(parsedValue);
|
|
388
|
+
if (fromDefaults) {
|
|
389
|
+
if (envs[key])
|
|
390
|
+
delete envs[key][name];
|
|
391
|
+
} else {
|
|
392
|
+
(envs[key] ??= {})[name] = parsedValue;
|
|
393
|
+
}
|
|
386
394
|
}
|
|
387
395
|
ctx.log(`Pulled ${name}`);
|
|
388
396
|
}
|