@vlandoss/localproxy 0.1.4 → 0.1.5-git-f3c213d.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/bin.mjs +1 -9
- package/dist/{main.mjs → run.mjs} +16 -12
- package/package.json +3 -3
- package/src/{main.ts → run.ts} +14 -12
package/bin.mjs
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { main } from "./dist/main.mjs";
|
|
6
|
-
|
|
7
|
-
main({
|
|
8
|
-
binDir: path.dirname(fileURLToPath(import.meta.url)),
|
|
9
|
-
installDir: path.join(homedir(), ".localproxy"),
|
|
10
|
-
});
|
|
2
|
+
import "./dist/run.mjs";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
1
2
|
import path from "node:path";
|
|
2
|
-
import { createPkgService, createShellService, getVersion, palette } from "@vlandoss/clibuddy";
|
|
3
|
+
import { createPkgService, createShellService, dirnameOf, getVersion, palette } from "@vlandoss/clibuddy";
|
|
3
4
|
import { createCommand } from "commander";
|
|
4
5
|
import * as fs$2 from "node:fs";
|
|
5
6
|
import { createLoggy } from "@vlandoss/loggy";
|
|
@@ -380,7 +381,9 @@ const CREDITS_TEXT = `\nAcknowledgment:
|
|
|
380
381
|
- hosts: making it easier to manage host file
|
|
381
382
|
${palette.link("https://github.com/xwmx/hosts")}`;
|
|
382
383
|
//#endregion
|
|
383
|
-
//#region src/
|
|
384
|
+
//#region src/run.ts
|
|
385
|
+
const BIN_DIR = path.dirname(dirnameOf(import.meta));
|
|
386
|
+
const INSTALL_DIR = path.join(homedir(), ".localproxy");
|
|
384
387
|
async function createContext({ binDir, installDir }) {
|
|
385
388
|
const binPkg = await createPkgService(binDir);
|
|
386
389
|
if (!binPkg) throw new Error("Could not find bin package.json");
|
|
@@ -395,16 +398,17 @@ async function createProgram(options) {
|
|
|
395
398
|
const ctx = await createContext(options);
|
|
396
399
|
return createCommand("localproxy").alias("localp").version(getVersion(ctx.binPkg), "-v, --version").addHelpText("before", BANNER_TEXT).addHelpText("after", CREDITS_TEXT).addCommand(createSetupCommand(ctx)).addCommand(createStatusCommand(ctx)).addCommand(createStartCommand(ctx)).addCommand(createStopCommand(ctx)).addCommand(createCleanCommand(ctx));
|
|
397
400
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
401
|
+
try {
|
|
402
|
+
await (await createProgram({
|
|
403
|
+
binDir: BIN_DIR,
|
|
404
|
+
installDir: INSTALL_DIR
|
|
405
|
+
})).parseAsync();
|
|
406
|
+
} catch (error) {
|
|
407
|
+
if (error instanceof Error && error.name === "ExitPromptError") logger.success("👋 cancelled, until next time!");
|
|
408
|
+
else {
|
|
409
|
+
logger.error(error);
|
|
410
|
+
process.exit(1);
|
|
407
411
|
}
|
|
408
412
|
}
|
|
409
413
|
//#endregion
|
|
410
|
-
export {
|
|
414
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vlandoss/localproxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5-git-f3c213d.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,8 +33,8 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@inquirer/prompts": "8.3.0",
|
|
35
35
|
"commander": "14.0.3",
|
|
36
|
-
"@vlandoss/clibuddy": "0.2.0",
|
|
37
|
-
"@vlandoss/loggy": "0.1.
|
|
36
|
+
"@vlandoss/clibuddy": "0.2.1-git-f3c213d.0",
|
|
37
|
+
"@vlandoss/loggy": "0.1.2-git-f3c213d.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
package/src/{main.ts → run.ts}
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
1
2
|
import path from "node:path";
|
|
2
|
-
import { createPkgService, getVersion } from "@vlandoss/clibuddy";
|
|
3
|
+
import { createPkgService, dirnameOf, getVersion } from "@vlandoss/clibuddy";
|
|
3
4
|
import { createCommand } from "commander";
|
|
4
5
|
import { createCleanCommand } from "./commands/clean.ts";
|
|
5
6
|
import { createSetupCommand } from "./commands/setup.ts";
|
|
@@ -10,6 +11,9 @@ import { logger } from "./services/logger.ts";
|
|
|
10
11
|
import type { Context, ProgramOptions } from "./types.ts";
|
|
11
12
|
import { BANNER_TEXT, CREDITS_TEXT } from "./ui.ts";
|
|
12
13
|
|
|
14
|
+
const BIN_DIR = path.dirname(dirnameOf(import.meta));
|
|
15
|
+
const INSTALL_DIR = path.join(homedir(), ".localproxy");
|
|
16
|
+
|
|
13
17
|
async function createContext({ binDir, installDir }: ProgramOptions) {
|
|
14
18
|
const binPkg = await createPkgService(binDir);
|
|
15
19
|
|
|
@@ -40,16 +44,14 @@ async function createProgram(options: ProgramOptions) {
|
|
|
40
44
|
.addCommand(createCleanCommand(ctx));
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
47
|
+
try {
|
|
48
|
+
const program = await createProgram({ binDir: BIN_DIR, installDir: INSTALL_DIR });
|
|
49
|
+
await program.parseAsync();
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error instanceof Error && error.name === "ExitPromptError") {
|
|
52
|
+
logger.success("👋 cancelled, until next time!");
|
|
53
|
+
} else {
|
|
54
|
+
logger.error(error);
|
|
55
|
+
process.exit(1);
|
|
54
56
|
}
|
|
55
57
|
}
|