@infomiho/buzz-cli 0.1.0 → 0.2.0

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 (2) hide show
  1. package/dist/cli.js +12 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -59,10 +59,16 @@ async function deploy(directory, subdomain) {
59
59
  console.error(`Error: '${directory}' is not a directory`);
60
60
  process.exit(1);
61
61
  }
62
- // Check for CNAME file if no subdomain specified
63
- const cnamePath = join(directory, "CNAME");
64
- if (!subdomain && existsSync(cnamePath)) {
65
- subdomain = readFileSync(cnamePath, "utf-8").trim();
62
+ // Check for CNAME file if no subdomain specified (check cwd first, then directory)
63
+ const cwdCnamePath = join(process.cwd(), "CNAME");
64
+ if (!subdomain && existsSync(cwdCnamePath)) {
65
+ subdomain = readFileSync(cwdCnamePath, "utf-8").trim();
66
+ }
67
+ else if (!subdomain) {
68
+ const dirCnamePath = join(directory, "CNAME");
69
+ if (existsSync(dirCnamePath)) {
70
+ subdomain = readFileSync(dirCnamePath, "utf-8").trim();
71
+ }
66
72
  }
67
73
  console.log(`Zipping ${directory}...`);
68
74
  const zipBuffer = await createZipBuffer(directory);
@@ -90,9 +96,9 @@ async function deploy(directory, subdomain) {
90
96
  const data = await response.json();
91
97
  if (response.ok) {
92
98
  console.log(`Deployed to ${data.url}`);
93
- // Save subdomain to CNAME file
99
+ // Save subdomain to CNAME file in cwd
94
100
  const deployedSubdomain = new URL(data.url).hostname.split(".")[0];
95
- writeFileSync(cnamePath, deployedSubdomain + "\n");
101
+ writeFileSync(cwdCnamePath, deployedSubdomain + "\n");
96
102
  }
97
103
  else {
98
104
  console.error(`Error: ${data.error || "Unknown error"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomiho/buzz-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI for deploying static sites to Buzz hosting",
5
5
  "type": "module",
6
6
  "bin": {