@moncircle/sdk 1.0.3 → 1.1.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/package.json +5 -2
- package/scripts/postinstall.js +25 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moncircle/sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Self-hosted MON loyalty reward infrastructure for e-commerce platforms. Supports SINGLE, MULTI, and HYBRID reward modes with Monad on-chain settlement.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,15 +34,18 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"cors": "^2.8.6",
|
|
36
36
|
"dotenv": "^17.3.1",
|
|
37
|
-
"
|
|
37
|
+
"ethers": "^6.16.0",
|
|
38
|
+
"express": ">=4.0.0",
|
|
38
39
|
"mongoose": "^8.0.0",
|
|
39
40
|
"uuid": "^13.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
43
|
+
"@nomicfoundation/hardhat-toolbox": "^6.1.0",
|
|
42
44
|
"@types/cors": "^2.8.19",
|
|
43
45
|
"@types/express": "^5.0.6",
|
|
44
46
|
"@types/node": "^25.3.0",
|
|
45
47
|
"@types/uuid": "^10.0.0",
|
|
48
|
+
"hardhat": "^3.1.9",
|
|
46
49
|
"ts-node-dev": "^2.0.0",
|
|
47
50
|
"typescript": "^5.9.3"
|
|
48
51
|
},
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,43 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* @moncircle/sdk postinstall hook
|
|
4
|
+
*
|
|
5
|
+
* Spawns create-moncircle with inherited stdio — this makes it visible
|
|
6
|
+
* to the dev's terminal even when run from inside npm install.
|
|
6
7
|
*/
|
|
7
8
|
|
|
9
|
+
const { spawnSync } = require("child_process")
|
|
8
10
|
const fs = require("fs")
|
|
9
11
|
const path = require("path")
|
|
10
12
|
|
|
11
|
-
const CYAN = "\x1b[36m"
|
|
12
|
-
const GREEN = "\x1b[32m"
|
|
13
|
-
const YELLOW = "\x1b[33m"
|
|
14
|
-
const BOLD = "\x1b[1m"
|
|
15
|
-
const RESET = "\x1b[0m"
|
|
16
|
-
|
|
17
13
|
const projectRoot = process.env.INIT_CWD || process.cwd()
|
|
18
14
|
const envExists = fs.existsSync(path.join(projectRoot, ".env"))
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (envExists) {
|
|
27
|
-
console.log(` ${GREEN}✓ .env found — you're already configured.${RESET}`)
|
|
28
|
-
console.log(` Run ${CYAN}npx mon-loyalty-setup${RESET} to reconfigure anytime.\n`)
|
|
29
|
-
} else {
|
|
30
|
-
console.log(` ${YELLOW}${BOLD}⚠ No .env file found.${RESET}`)
|
|
31
|
-
console.log(`
|
|
32
|
-
Run the interactive setup wizard now:
|
|
33
|
-
|
|
34
|
-
${BOLD}${CYAN} npx mon-loyalty-setup${RESET}
|
|
35
|
-
|
|
36
|
-
It will ask for your MongoDB URI, Monad wallet, and other
|
|
37
|
-
config, then write your .env file automatically.
|
|
38
|
-
|
|
39
|
-
Then start the server:
|
|
16
|
+
// Skip in CI
|
|
17
|
+
if (process.env.CI === "true" || process.env.CI === "1") {
|
|
18
|
+
console.log("\n[@moncircle/sdk] CI detected — skipping setup. Run: npx create-moncircle\n")
|
|
19
|
+
process.exit(0)
|
|
20
|
+
}
|
|
40
21
|
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
// Spawn create-moncircle with --yes to skip "Ok to proceed?" confirmation
|
|
23
|
+
// stdio: "inherit" makes all output/input flow directly to the user's terminal
|
|
24
|
+
const result = spawnSync("npx", ["--yes", "create-moncircle"], {
|
|
25
|
+
stdio: "inherit",
|
|
26
|
+
cwd: projectRoot,
|
|
27
|
+
shell: true,
|
|
28
|
+
env: {
|
|
29
|
+
...process.env,
|
|
30
|
+
MON_LOYALTY_ENV_PATH: path.join(projectRoot, ".env"),
|
|
31
|
+
MON_ENV_EXISTS: envExists ? "1" : "0"
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
if (result.error) {
|
|
36
|
+
console.warn("\n[@moncircle/sdk] Could not launch setup wizard. Run: npx create-moncircle\n")
|
|
43
37
|
}
|