layero 0.1.5 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layero",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Layero CLI — publish a local site with one command.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,20 +1,22 @@
1
1
  #!/usr/bin/env node
2
- // Print a quick-start banner after `npm install -g layero`.
3
- // Stays silent in CI, in non-TTY (piped/automated installs), and when
4
- // installed as a transitive dependency.
2
+ // Print a quick-start banner after `npm install -g layero`. We write to
3
+ // stderr because npm 10+ buffers postinstall stdout by default
4
+ // (`foreground-scripts=false`) and only surfaces it on script failure —
5
+ // stderr is passed through verbatim, which is how other CLIs (vite,
6
+ // cypress, etc.) deliver post-install messages.
5
7
 
6
8
  if (process.env.CI) return;
7
9
  if (process.env.LAYERO_SKIP_POSTINSTALL) return;
8
- if (!process.stdout.isTTY) return;
9
10
 
10
- // Only print when the user installed `layero` directly (not as a sub-dep).
11
- // npm sets npm_config_global=true for `npm install -g`; for local installs
12
- // we check that this package is the install target via npm_package_name.
11
+ // Only print when `layero` is the install target not when it's pulled
12
+ // in as a transitive dep of another package.
13
13
  const isGlobal = process.env.npm_config_global === "true";
14
14
  const isDirect = process.env.npm_package_name === "layero";
15
15
  if (!isGlobal && !isDirect) return;
16
16
 
17
- const c = process.stdout.hasColors && process.stdout.hasColors()
17
+ // Best-effort color: stderr is usually a TTY, but stay safe.
18
+ const useColor = process.stderr.isTTY && (process.stderr.hasColors?.() ?? true);
19
+ const c = useColor
18
20
  ? {
19
21
  reset: "\x1b[0m",
20
22
  bold: "\x1b[1m",
@@ -35,4 +37,4 @@ const lines = [
35
37
  ` ${c.dim}Docs: https://layero.ru${c.reset}`,
36
38
  "",
37
39
  ];
38
- process.stdout.write(lines.join("\n"));
40
+ process.stderr.write(lines.join("\n"));