@suronai/cli 0.1.21 → 0.1.23
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 +16 -1
- package/package.json +3 -3
- package/src/commands/init.js +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Run inside your project directory. Does everything needed to protect your app wi
|
|
|
27
27
|
3. Installs `@suronai/sdk` into your project (detects npm / pnpm / yarn / bun)
|
|
28
28
|
4. Writes `.suron.json` with your app name and ID
|
|
29
29
|
5. Deletes `.env.keys`
|
|
30
|
+
6. Patches your entry point — replaces `dotenv` with `@suronai/sdk` (interactive, asks before changing)
|
|
30
31
|
|
|
31
32
|
```bash
|
|
32
33
|
cd my-project
|
|
@@ -38,6 +39,20 @@ suron init --name my-app
|
|
|
38
39
|
|
|
39
40
|
After `suron init`, both `.env` and `.suron.json` are safe to commit.
|
|
40
41
|
|
|
42
|
+
**What the patched entry point looks like:**
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// before
|
|
46
|
+
import { config } from 'dotenv'
|
|
47
|
+
config()
|
|
48
|
+
|
|
49
|
+
// after
|
|
50
|
+
import { config } from '@suronai/sdk'
|
|
51
|
+
await config()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If dotenv isn't detected, `suron init` prints the snippet to add manually.
|
|
55
|
+
|
|
41
56
|
### `suron whoami`
|
|
42
57
|
|
|
43
58
|
Prints the configured Convex API URL.
|
|
@@ -73,7 +88,7 @@ export SURON_API_URL=https://your-deployment.convex.site
|
|
|
73
88
|
|
|
74
89
|
| File | Commit? | Notes |
|
|
75
90
|
|---|---|---|
|
|
76
|
-
| `.suron.json` | ✅ yes | app name + id, no secrets |
|
|
91
|
+
| `.suron.json` | ✅ yes | app name + id + api_url, no secrets |
|
|
77
92
|
| `.env` | ✅ yes | encrypted by dotenvx |
|
|
78
93
|
| `.env.keys` | ⛔ no | deleted automatically by `suron init` |
|
|
79
94
|
| `~/.suron-config` | ⛔ no | CLI config — lives on developer machine only |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suronai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "CLI for Suron — suron login, init, whoami, rotate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"lint": "node --check src/index.js src/commands/login.js src/commands/init.js src/commands/rotate.js src/commands/whoami.js src/utils/config.js src/utils/dotenvx.js src/utils/colors.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@dotenvx/dotenvx": "
|
|
18
|
-
"commander": "
|
|
17
|
+
"@dotenvx/dotenvx": "latest",
|
|
18
|
+
"commander": "latest"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18.0.0"
|
package/src/commands/init.js
CHANGED
|
@@ -183,7 +183,7 @@ async function patchEntryPoint(cwd, isEsm) {
|
|
|
183
183
|
try { src = readFileSync(entryPath, "utf-8"); } catch { return; }
|
|
184
184
|
|
|
185
185
|
// Build regex patterns for both dotenv styles
|
|
186
|
-
const esmPattern = /^import\s+\{\s*config\s*\}\s+from\s+["']dotenv["']
|
|
186
|
+
const esmPattern = /^import\s+\{\s*config\s*\}\s+from\s+["']dotenv["'];?[ \t]*(?:\r?\n[ \t]*)*config\(\);?/m;
|
|
187
187
|
const cjsPattern = /^(?:const\s+)?require\(["']dotenv["']\)\.config\(\);?/m;
|
|
188
188
|
const pattern = isEsm ? esmPattern : cjsPattern;
|
|
189
189
|
|