@vlandoss/localproxy 0.1.0 → 0.1.1-git-f48b7a0.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
@@ -298,6 +298,9 @@ var FileService = class {
298
298
  };
299
299
  //#endregion
300
300
  //#region src/commands/setup.ts
301
+ async function exists(p) {
302
+ return fs$1.access(p).then(() => true).catch(() => false);
303
+ }
301
304
  const debug = logger.subdebug("setup");
302
305
  async function checkInternalTools() {
303
306
  const { $ } = quietShell;
@@ -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-f48b7a0.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/clibuddy": "0.1.1-git-f48b7a0.0",
37
+ "@vlandoss/loggy": "0.1.1-git-f48b7a0.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"
@@ -1,5 +1,13 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import path from "node:path";
3
+
4
+ async function exists(p: string): Promise<boolean> {
5
+ return fs
6
+ .access(p)
7
+ .then(() => true)
8
+ .catch(() => false);
9
+ }
10
+
3
11
  import { editor as editorPrompt } from "@inquirer/prompts";
4
12
  import { createCommand } from "commander";
5
13
  import { CaddyService } from "#/services/caddy";
@@ -51,12 +59,12 @@ export function createSetupCommand({ binDir, installDir, caddyfilePath }: Contex
51
59
 
52
60
  await checkInternalTools();
53
61
 
54
- if (!(await fs.exists(installDir))) {
62
+ if (!(await exists(installDir))) {
55
63
  await fs.mkdir(installDir);
56
64
  }
57
65
 
58
66
  const exampleCaddyFilePath = path.join(binDir, "config", "Caddyfile.example");
59
- const defaultContent = (await fs.exists(caddyfilePath))
67
+ const defaultContent = (await exists(caddyfilePath))
60
68
  ? await fs.readFile(caddyfilePath, "utf-8")
61
69
  : await fs.readFile(exampleCaddyFilePath, "utf-8");
62
70