safelaunch 1.0.28 → 1.0.30

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": "safelaunch",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Backend Reliability Infrastructure - catch what breaks production before it breaks",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
11
- "postinstall": "node ./bin/safelaunch.js hook install --silent || true"
11
+ "postinstall": "node ./src/postinstall.js || true"
12
12
  },
13
13
  "keywords": [
14
14
  "deployment",
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ const c = {
4
+ reset: "\x1b[0m", bold: "\x1b[1m",
5
+ green: "\x1b[32m", cyan: "\x1b[36m", gray: "\x1b[90m",
6
+ };
7
+ const green = (s) => `${c.green}${c.bold}${s}${c.reset}`;
8
+ const cyan = (s) => `${c.cyan}${s}${c.reset}`;
9
+ const gray = (s) => `${c.gray}${s}${c.reset}`;
10
+ const bold = (s) => `${c.bold}${s}${c.reset}`;
11
+
12
+ const box = `
13
+ ┌─────────────────────────────────────────────────┐
14
+ │ │
15
+ │ ${bold("safelaunch installed")} │
16
+ │ │
17
+ │ Run this in your project to get protected: │
18
+ │ │
19
+ │ ${cyan("npx safelaunch setup")} │
20
+ │ │
21
+ │ Scans your project and blocks bad pushes │
22
+ │ automatically before they reach production. │
23
+ │ │
24
+ └─────────────────────────────────────────────────┘
25
+ `;
26
+
27
+ process.stdout.write(box);
package/src/setup.js CHANGED
@@ -4,6 +4,14 @@ const { runScan } = require("./scan");
4
4
  const { installHook } = require("./hook");
5
5
  const init = require("./init");
6
6
 
7
+ let _track = async () => {};
8
+ let _shutdown = async () => {};
9
+ try {
10
+ const t = require('./telemetry');
11
+ _track = t.track || _track;
12
+ _shutdown = t.shutdown || _shutdown;
13
+ } catch {}
14
+
7
15
  const c = {
8
16
  reset: "\x1b[0m", bold: "\x1b[1m", dim: "\x1b[2m",
9
17
  red: "\x1b[31m", green: "\x1b[32m", yellow: "\x1b[33m",
@@ -19,7 +27,7 @@ const cyan = (s) => `${c.cyan}${s}${c.reset}`;
19
27
 
20
28
  const HR = gray("─".repeat(49));
21
29
 
22
- let version = "1.0.27";
30
+ let version = "1.0.28";
23
31
  try { version = require("../package.json").version; } catch {}
24
32
 
25
33
  async function run(options = {}) {
@@ -98,6 +106,17 @@ async function run(options = {}) {
98
106
  }
99
107
 
100
108
  console.log("");
109
+
110
+ try {
111
+ await _track("safelaunch_setup_run", {
112
+ blockers: blockers.length,
113
+ warnings: warnings.length,
114
+ hook_ok: hookOk,
115
+ vars_found: manifestResult ? manifestResult.count : 0,
116
+ elapsed,
117
+ });
118
+ await _shutdown();
119
+ } catch {}
101
120
  }
102
121
 
103
- module.exports = { run };
122
+ module.exports = { run };