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 +1 -1
- package/scripts/postinstall.cjs +11 -9
package/package.json
CHANGED
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Print a quick-start banner after `npm install -g layero`.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
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
|
|
11
|
-
//
|
|
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
|
-
|
|
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.
|
|
40
|
+
process.stderr.write(lines.join("\n"));
|