cf-envsync 0.3.2 → 0.3.4
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/index.js +6 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13476,11 +13476,6 @@ async function checkWrangler() {
|
|
|
13476
13476
|
const result = await exec(["npx", "wrangler", "--version"]);
|
|
13477
13477
|
return result.success;
|
|
13478
13478
|
}
|
|
13479
|
-
function envFlag(environment) {
|
|
13480
|
-
if (environment === "production")
|
|
13481
|
-
return [];
|
|
13482
|
-
return ["--env", environment];
|
|
13483
|
-
}
|
|
13484
13479
|
async function pushSecrets(workerName, secrets, environment, cwd) {
|
|
13485
13480
|
const json = JSON.stringify(secrets);
|
|
13486
13481
|
const args = [
|
|
@@ -13489,8 +13484,7 @@ async function pushSecrets(workerName, secrets, environment, cwd) {
|
|
|
13489
13484
|
"secret",
|
|
13490
13485
|
"bulk",
|
|
13491
13486
|
"--name",
|
|
13492
|
-
workerName
|
|
13493
|
-
...envFlag(environment)
|
|
13487
|
+
workerName
|
|
13494
13488
|
];
|
|
13495
13489
|
consola.debug(`Running: ${args.join(" ")}`);
|
|
13496
13490
|
const result = await exec(args, { cwd, stdin: json });
|
|
@@ -13502,15 +13496,14 @@ async function pushSecrets(workerName, secrets, environment, cwd) {
|
|
|
13502
13496
|
output: result.success ? result.stdout : result.stderr
|
|
13503
13497
|
};
|
|
13504
13498
|
}
|
|
13505
|
-
async function listSecrets(workerName,
|
|
13499
|
+
async function listSecrets(workerName, _environment, cwd) {
|
|
13506
13500
|
const args = [
|
|
13507
13501
|
"npx",
|
|
13508
13502
|
"wrangler",
|
|
13509
13503
|
"secret",
|
|
13510
13504
|
"list",
|
|
13511
13505
|
"--name",
|
|
13512
|
-
workerName
|
|
13513
|
-
...envFlag(environment)
|
|
13506
|
+
workerName
|
|
13514
13507
|
];
|
|
13515
13508
|
const result = await exec(args, { cwd });
|
|
13516
13509
|
if (!result.success) {
|
|
@@ -13670,7 +13663,7 @@ var init_push = __esm(() => {
|
|
|
13670
13663
|
continue;
|
|
13671
13664
|
}
|
|
13672
13665
|
}
|
|
13673
|
-
const result = await pushSecrets(workerName, secretsToPush, environment,
|
|
13666
|
+
const result = await pushSecrets(workerName, secretsToPush, environment, app.absolutePath);
|
|
13674
13667
|
if (result.success) {
|
|
13675
13668
|
consola.success(` Pushed ${keyCount} secrets to ${workerName}`);
|
|
13676
13669
|
} else {
|
|
@@ -13747,7 +13740,7 @@ var init_pull = __esm(() => {
|
|
|
13747
13740
|
continue;
|
|
13748
13741
|
}
|
|
13749
13742
|
consola.start(`Pulling secret keys for ${app.name} from ${workerName} (${environment})...`);
|
|
13750
|
-
const remoteKeys = await listSecrets(workerName, environment,
|
|
13743
|
+
const remoteKeys = await listSecrets(workerName, environment, app.absolutePath);
|
|
13751
13744
|
if (remoteKeys.length === 0) {
|
|
13752
13745
|
consola.warn(` No secrets found for ${workerName}. Skipping.`);
|
|
13753
13746
|
continue;
|
|
@@ -14083,7 +14076,7 @@ var init_diff = __esm(() => {
|
|
|
14083
14076
|
consola.start(`Diffing ${app.name}: .env vs ${workerName} (${env1})...`);
|
|
14084
14077
|
const [resolved, remoteKeys] = await Promise.all([
|
|
14085
14078
|
resolveAppEnv(config, app, env1),
|
|
14086
|
-
listSecrets(workerName, env1,
|
|
14079
|
+
listSecrets(workerName, env1, app.absolutePath)
|
|
14087
14080
|
]);
|
|
14088
14081
|
const localKeys = new Set(Object.keys(resolved.map));
|
|
14089
14082
|
const remoteKeySet = new Set(remoteKeys);
|