@suronai/cli 0.1.20 → 0.1.22
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 +12 -12
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.22",
|
|
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
|
@@ -154,8 +154,8 @@ function sanitiseName(name) {
|
|
|
154
154
|
* CJS: require("dotenv").config();
|
|
155
155
|
*
|
|
156
156
|
* Replaces with the correct form based on the project type:
|
|
157
|
-
* ESM: import {
|
|
158
|
-
* CJS: const {
|
|
157
|
+
* ESM: import { config } from "@suronai/sdk"; await config();
|
|
158
|
+
* CJS: const { config } = require("@suronai/sdk"); await config();
|
|
159
159
|
*
|
|
160
160
|
* @param {string} cwd
|
|
161
161
|
* @param {boolean} isEsm
|
|
@@ -205,11 +205,11 @@ async function patchEntryPoint(cwd, isEsm) {
|
|
|
205
205
|
console.log(" " + c.red("-") + " " + c.dim(match[0].replace(/\n/g, "\n - ")));
|
|
206
206
|
console.log(" " + c.dim("With:"));
|
|
207
207
|
if (isEsm) {
|
|
208
|
-
console.log(" " + c.green("+") + " " + c.cyan("import") + " {
|
|
209
|
-
console.log(" " + c.green("+") + " " + c.cyan("await") + "
|
|
208
|
+
console.log(" " + c.green("+") + " " + c.cyan("import") + " { config } from " + c.green("'@suronai/sdk'"));
|
|
209
|
+
console.log(" " + c.green("+") + " " + c.cyan("await") + " config()");
|
|
210
210
|
} else {
|
|
211
|
-
console.log(" " + c.green("+") + " const {
|
|
212
|
-
console.log(" " + c.green("+") + " " + c.cyan("await") + "
|
|
211
|
+
console.log(" " + c.green("+") + " const { config } = " + c.cyan("require") + "(" + c.green("'@suronai/sdk'") + ")");
|
|
212
|
+
console.log(" " + c.green("+") + " " + c.cyan("await") + " config()");
|
|
213
213
|
}
|
|
214
214
|
console.log();
|
|
215
215
|
|
|
@@ -224,8 +224,8 @@ async function patchEntryPoint(cwd, isEsm) {
|
|
|
224
224
|
|
|
225
225
|
// Perform the replacement
|
|
226
226
|
const replacement = isEsm
|
|
227
|
-
? `import {
|
|
228
|
-
: `const {
|
|
227
|
+
? `import { config } from '@suronai/sdk';\nawait config();`
|
|
228
|
+
: `const { config } = require('@suronai/sdk');\nawait config();`;
|
|
229
229
|
|
|
230
230
|
const patched = src.replace(pattern, replacement);
|
|
231
231
|
|
|
@@ -242,11 +242,11 @@ async function patchEntryPoint(cwd, isEsm) {
|
|
|
242
242
|
/** @param {boolean} isEsm */
|
|
243
243
|
function printSnippet(isEsm) {
|
|
244
244
|
if (isEsm) {
|
|
245
|
-
console.log(" " + c.cyan("import") + " {
|
|
246
|
-
console.log(" " + c.cyan("await") + "
|
|
245
|
+
console.log(" " + c.cyan("import") + " { config } from " + c.green("'@suronai/sdk'"));
|
|
246
|
+
console.log(" " + c.cyan("await") + " config()");
|
|
247
247
|
} else {
|
|
248
|
-
console.log(" const {
|
|
249
|
-
console.log(" " + c.cyan("await") + "
|
|
248
|
+
console.log(" const { config } = " + c.cyan("require") + "(" + c.green("'@suronai/sdk'") + ")");
|
|
249
|
+
console.log(" " + c.cyan("await") + " config()");
|
|
250
250
|
}
|
|
251
251
|
console.log();
|
|
252
252
|
}
|