wattetheria 0.1.8 → 0.1.9

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/lib/cli.js +24 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -564,7 +564,7 @@ Version commands:
564
564
  - `npx wattetheria --version` shows the current Wattetheria release version
565
565
  - `npx wattetheria version --images` prints the configured image refs for the current deployment
566
566
  - `npx wattetheria version --cli` shows the deployment CLI package version
567
- - `npx wattetheria update` resolves the latest shared published image tag across the configured release images and upgrades to it
567
+ - `npx wattetheria update` refreshes the local deployment compose asset, resolves the latest shared published image tag across the configured release images, and upgrades to it
568
568
  - `npx wattetheria update --tag <tag>` pins the deployment to a specific published image tag
569
569
  - `npx wattetheria restart` stops and recreates the local release stack from the current deployment config
570
570
 
package/lib/cli.js CHANGED
@@ -675,6 +675,29 @@ async function ensureDockerAvailable(options = {}) {
675
675
  }
676
676
  }
677
677
 
678
+ function refreshDeploymentComposeAsset(templatePath, targetPath, options) {
679
+ if (!fs.existsSync(targetPath)) {
680
+ fs.copyFileSync(templatePath, targetPath);
681
+ return;
682
+ }
683
+
684
+ const template = fs.readFileSync(templatePath, "utf8");
685
+ const current = fs.readFileSync(targetPath, "utf8");
686
+ if (!options.force && current === template) {
687
+ return;
688
+ }
689
+
690
+ if (current !== template) {
691
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
692
+ const backupPath = `${targetPath}.bak-${timestamp}`;
693
+ fs.copyFileSync(targetPath, backupPath);
694
+ console.log(`Backed up previous deployment compose: ${backupPath}`);
695
+ }
696
+
697
+ fs.copyFileSync(templatePath, targetPath);
698
+ console.log("Refreshed deployment compose from current CLI package.");
699
+ }
700
+
678
701
  function ensureDeploymentAssets(options) {
679
702
  fs.mkdirSync(options.dir, { recursive: true });
680
703
 
@@ -687,9 +710,7 @@ function ensureDeploymentAssets(options) {
687
710
  } else {
688
711
  mergeNewDefaultKeys(targetEnvPath);
689
712
  }
690
- if (options.force || !fs.existsSync(targetComposePath)) {
691
- fs.copyFileSync(templateComposePath, targetComposePath);
692
- }
713
+ refreshDeploymentComposeAsset(templateComposePath, targetComposePath, options);
693
714
 
694
715
  const envMap = readEnvFile(targetEnvPath);
695
716
  envMap.set("WATTETHERIA_RUNTIME_ENV_FILE", path.basename(targetEnvPath));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wattetheria",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Wattetheria deployment CLI",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",