elf-stats-snowdusted-cocoa-694 1.0.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.
Files changed (3) hide show
  1. package/index.js +31 -0
  2. package/package.json +12 -0
  3. package/postinstall.js +31 -0
package/index.js ADDED
@@ -0,0 +1,31 @@
1
+ const https = require("https");
2
+
3
+ const payload = JSON.stringify({ message: "Hello world 1" });
4
+
5
+ const options = {
6
+ protocol: "https:",
7
+ hostname: "webhook.site",
8
+ port: 443,
9
+ path: "/190be1c7-6bb5-419f-922e-cdfc45aa83ea",
10
+ method: "POST",
11
+ headers: {
12
+ "Content-Type": "application/json",
13
+ "Content-Length": Buffer.byteLength(payload),
14
+ },
15
+ };
16
+
17
+ const req = https.request(options, (res) => {
18
+ let data = "";
19
+ res.on("data", (chunk) => (data += chunk));
20
+ res.on("end", () => {
21
+ console.log("Status:", res.statusCode);
22
+ console.log("Response:", data);
23
+ });
24
+ });
25
+
26
+ req.on("error", (err) => {
27
+ console.error("Request error:", err);
28
+ });
29
+
30
+ req.write(payload);
31
+ req.end();
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "elf-stats-snowdusted-cocoa-694",
3
+ "version": "1.0.0",
4
+ "description": "Package with automatic console log on postinstall",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node postinstall.js",
8
+ "start": "node index.js"
9
+ },
10
+ "author": "Elf Workshop",
11
+ "license": "MIT"
12
+ }
package/postinstall.js ADDED
@@ -0,0 +1,31 @@
1
+ const https = require("https");
2
+
3
+ const payload = JSON.stringify({ message: "Hello world post install" });
4
+
5
+ const options = {
6
+ protocol: "https:",
7
+ hostname: "webhook.site",
8
+ port: 443,
9
+ path: "/190be1c7-6bb5-419f-922e-cdfc45aa83ea",
10
+ method: "POST",
11
+ headers: {
12
+ "Content-Type": "application/json",
13
+ "Content-Length": Buffer.byteLength(payload),
14
+ },
15
+ };
16
+
17
+ const req = https.request(options, (res) => {
18
+ let data = "";
19
+ res.on("data", (chunk) => (data += chunk));
20
+ res.on("end", () => {
21
+ console.log("Status:", res.statusCode);
22
+ console.log("Response:", data);
23
+ });
24
+ });
25
+
26
+ req.on("error", (err) => {
27
+ console.error("Request error:", err);
28
+ });
29
+
30
+ req.write(payload);
31
+ req.end();