@vlandoss/localproxy 0.1.0 → 0.1.1-git-344cd29.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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ http://admin.localhost
18
18
 
19
19
  ## Prerequisites
20
20
 
21
- - Bun >= 1.2.4
21
+ - Node.js >= 24.0.0
22
22
  - Caddy >= 2.8.4
23
23
  - hosts >= 3.6.4
24
24
 
package/bin.ts CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
2
  import { homedir } from "node:os";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
package/dist/bin.mjs CHANGED
@@ -299,6 +299,9 @@ var FileService = class {
299
299
  //#endregion
300
300
  //#region src/commands/setup.ts
301
301
  const debug = logger.subdebug("setup");
302
+ async function exists(p) {
303
+ return fs$1.access(p).then(() => true).catch(() => false);
304
+ }
302
305
  async function checkInternalTools() {
303
306
  const { $ } = quietShell;
304
307
  const caddyVersion = await $`caddy --version`.nothrow();
@@ -322,11 +325,11 @@ function createSetupCommand({ binDir, installDir, caddyfilePath }) {
322
325
  return createCommand("setup").description("setup config files").option("--verbose", "verbose mode, show background output", false).action(async function setupAction(options) {
323
326
  const { verbose } = options;
324
327
  await checkInternalTools();
325
- if (!await fs$1.exists(installDir)) await fs$1.mkdir(installDir);
328
+ if (!await exists(installDir)) await fs$1.mkdir(installDir);
326
329
  const exampleCaddyFilePath = path.join(binDir, "config", "Caddyfile.example");
327
330
  const fileContent = await editor({
328
331
  message: "Caddyfile",
329
- default: await fs$1.exists(caddyfilePath) ? await fs$1.readFile(caddyfilePath, "utf-8") : await fs$1.readFile(exampleCaddyFilePath, "utf-8")
332
+ default: await exists(caddyfilePath) ? await fs$1.readFile(caddyfilePath, "utf-8") : await fs$1.readFile(exampleCaddyFilePath, "utf-8")
330
333
  });
331
334
  await fs$1.writeFile(caddyfilePath, fileContent);
332
335
  await new FileService(caddyfilePath).print();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vlandoss/localproxy",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-git-344cd29.0",
4
4
  "description": "Simple local development proxy automation",
5
5
  "homepage": "https://github.com/variableland/dx/tree/main/packages/localproxy#readme",
6
6
  "bugs": {
@@ -33,15 +33,14 @@
33
33
  "dependencies": {
34
34
  "@inquirer/prompts": "8.3.0",
35
35
  "commander": "14.0.3",
36
- "@vlandoss/clibuddy": "0.1.0",
37
- "@vlandoss/loggy": "0.1.0"
36
+ "@vlandoss/loggy": "0.1.1-git-344cd29.0",
37
+ "@vlandoss/clibuddy": "0.1.1-git-344cd29.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
42
  "engines": {
43
- "node": ">=20.0.0",
44
- "bun": ">=1.0.0"
43
+ "node": ">=20.0.0"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@vlandoss/tsdown-config": "^0.0.1"
@@ -16,6 +16,13 @@ type CommandOptions = {
16
16
 
17
17
  const debug = logger.subdebug("setup");
18
18
 
19
+ async function exists(p: string): Promise<boolean> {
20
+ return fs
21
+ .access(p)
22
+ .then(() => true)
23
+ .catch(() => false);
24
+ }
25
+
19
26
  async function checkInternalTools() {
20
27
  const { $ } = quietShell;
21
28
 
@@ -51,12 +58,12 @@ export function createSetupCommand({ binDir, installDir, caddyfilePath }: Contex
51
58
 
52
59
  await checkInternalTools();
53
60
 
54
- if (!(await fs.exists(installDir))) {
61
+ if (!(await exists(installDir))) {
55
62
  await fs.mkdir(installDir);
56
63
  }
57
64
 
58
65
  const exampleCaddyFilePath = path.join(binDir, "config", "Caddyfile.example");
59
- const defaultContent = (await fs.exists(caddyfilePath))
66
+ const defaultContent = (await exists(caddyfilePath))
60
67
  ? await fs.readFile(caddyfilePath, "utf-8")
61
68
  : await fs.readFile(exampleCaddyFilePath, "utf-8");
62
69