portless 0.2.1 → 0.2.2

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 +15 -4
  2. package/package.json +18 -15
package/dist/cli.js CHANGED
@@ -367,6 +367,13 @@ portless
367
367
  }
368
368
  async function main() {
369
369
  const args = process.argv.slice(2);
370
+ const isNpx = process.env.npm_command === "exec" && !process.env.npm_lifecycle_event;
371
+ const isPnpmDlx = !!process.env.PNPM_SCRIPT_SRC_DIR && !process.env.npm_lifecycle_event;
372
+ if (isNpx || isPnpmDlx) {
373
+ console.error(chalk.red("Error: portless should not be run via npx or pnpm dlx."));
374
+ console.log(chalk.blue("Install globally: npm install -g portless"));
375
+ process.exit(1);
376
+ }
370
377
  const skipPortless = process.env.PORTLESS === "0" || process.env.PORTLESS === "skip";
371
378
  if (skipPortless && args.length >= 2 && args[0] !== "proxy") {
372
379
  spawnCommand(args.slice(1));
@@ -379,6 +386,10 @@ ${chalk.bold("portless")} - Replace port numbers with stable, named .localhost U
379
386
  Eliminates port conflicts, memorizing port numbers, and cookie/storage
380
387
  clashes by giving each dev server a stable .localhost URL.
381
388
 
389
+ ${chalk.bold("Install:")}
390
+ ${chalk.cyan("npm install -g portless")}
391
+ Do NOT add portless as a project dependency.
392
+
382
393
  ${chalk.bold("Usage:")}
383
394
  ${chalk.cyan("sudo portless proxy")} Start the proxy (run once, keep open)
384
395
  ${chalk.cyan("sudo portless proxy --port 8080")} Start the proxy on a custom port
@@ -387,9 +398,9 @@ ${chalk.bold("Usage:")}
387
398
  ${chalk.cyan("portless list")} Show active routes
388
399
 
389
400
  ${chalk.bold("Examples:")}
390
- sudo portless proxy # Start proxy in terminal 1
391
- portless myapp next dev # Terminal 2 -> http://myapp.localhost
392
- portless api.myapp pnpm start # Terminal 3 -> http://api.myapp.localhost
401
+ sudo portless proxy # Start proxy in terminal 1
402
+ portless myapp next dev # Terminal 2 -> http://myapp.localhost
403
+ portless api.myapp pnpm start # Terminal 3 -> http://api.myapp.localhost
393
404
 
394
405
  ${chalk.bold("In package.json:")}
395
406
  {
@@ -415,7 +426,7 @@ ${chalk.bold("Skip portless:")}
415
426
  process.exit(0);
416
427
  }
417
428
  if (args[0] === "--version" || args[0] === "-v") {
418
- console.log("0.2.1");
429
+ console.log("0.2.2");
419
430
  process.exit(0);
420
431
  }
421
432
  if (args[0] === "list") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portless",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Replace port numbers with stable, named .localhost URLs. For humans and agents.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,6 +17,7 @@
17
17
  "files": [
18
18
  "dist"
19
19
  ],
20
+ "packageManager": "pnpm@9.15.4",
20
21
  "engines": {
21
22
  "node": ">=20"
22
23
  },
@@ -24,6 +25,21 @@
24
25
  "darwin",
25
26
  "linux"
26
27
  ],
28
+ "scripts": {
29
+ "build": "tsup",
30
+ "dev": "tsup --watch",
31
+ "format": "prettier --write .",
32
+ "format:check": "prettier --check .",
33
+ "lint": "eslint src/",
34
+ "lint:fix": "eslint src/ --fix",
35
+ "prepublishOnly": "pnpm build",
36
+ "pretest": "pnpm build",
37
+ "test": "vitest run",
38
+ "test:coverage": "vitest run --coverage",
39
+ "test:watch": "vitest",
40
+ "typecheck": "tsc --noEmit",
41
+ "prepare": "husky"
42
+ },
27
43
  "keywords": [
28
44
  "local",
29
45
  "development",
@@ -65,18 +81,5 @@
65
81
  "prettier --write"
66
82
  ],
67
83
  "*.{json,md,yml,yaml}": "prettier --write"
68
- },
69
- "scripts": {
70
- "build": "tsup",
71
- "dev": "tsup --watch",
72
- "format": "prettier --write .",
73
- "format:check": "prettier --check .",
74
- "lint": "eslint src/",
75
- "lint:fix": "eslint src/ --fix",
76
- "pretest": "pnpm build",
77
- "test": "vitest run",
78
- "test:coverage": "vitest run --coverage",
79
- "test:watch": "vitest",
80
- "typecheck": "tsc --noEmit"
81
84
  }
82
- }
85
+ }