neon 3.1.1 → 3.2.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 +14 -0
- package/dist/commands/auth.js +1 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/open.js +33 -0
- package/dist/index.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -352,6 +352,19 @@ How today's `set-context` uses map onto `link`:
|
|
|
352
352
|
|
|
353
353
|
The key difference: `link` resolves and **verifies** before writing (so you never get a half-written or stale `.neon`), whereas `set-context` writes whatever you give it verbatim. The closest like-for-like replacement for the old raw write is `link --no-checks`.
|
|
354
354
|
|
|
355
|
+
### open
|
|
356
|
+
|
|
357
|
+
`open` launches the linked project's page in the Neon Console. It reads the closest `.neon` file without authenticating or calling the Neon API, so it works from any sub-directory of a linked project.
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
neon open
|
|
361
|
+
|
|
362
|
+
# Open a project without changing the linked context
|
|
363
|
+
neon open --project-id polished-snowflake-12345678
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
A branch pinned in `.neon` does not change the destination. `.neon` stores the branch as a name, while the Console route requires its ID; resolving it would turn this local command into an authenticated API call.
|
|
367
|
+
|
|
355
368
|
### checkout
|
|
356
369
|
|
|
357
370
|
`checkout [id|name]` pins a branch in the local context so subsequent commands target it — it's the focused companion to `link` for the common "switch the branch I'm working on" case (`link` resolves org + project; `checkout` pins the branch). It resolves the branch (by name or id) against the project, then **heals** the `.neon` file: it always (re)writes `projectId`, `branch`, and `orgId` (when the project has one), so a `.neon` that was missing fields or drifted ends up complete and consistent. The branch is stored as its **name** when known (matching `link`). When `orgId` isn't already known (from `--org-id` or the existing `.neon`), it's looked up from the project itself.
|
|
@@ -1044,6 +1057,7 @@ API keys in org-7
|
|
|
1044
1057
|
| checkout | | Pin a branch in `.neon` |
|
|
1045
1058
|
| diff | | Git-style schema diff vs a branch |
|
|
1046
1059
|
| [link](https://neon.com/docs/reference/cli-link) | | Link a directory to a project |
|
|
1060
|
+
| open | | Open the linked project in Console |
|
|
1047
1061
|
| config | `init`, `status`, `plan`, `apply` | Drive a branch from `neon.ts` |
|
|
1048
1062
|
| deploy | | Alias for `config apply` |
|
|
1049
1063
|
| bootstrap | | Scaffold a project from a template |
|
package/dist/commands/auth.js
CHANGED
|
@@ -174,6 +174,7 @@ const ensureAuth = async (props) => {
|
|
|
174
174
|
if (isCurrentBranchProbe(props)) return;
|
|
175
175
|
if (isConfigInit(props)) return;
|
|
176
176
|
if (isProfileCommand(props)) return;
|
|
177
|
+
if (props._[0] === "open") return;
|
|
177
178
|
const isLocalDev = props._[0] === "dev";
|
|
178
179
|
const isBootstrap = props._[0] === "bootstrap";
|
|
179
180
|
const isInit = props._[0] === "init";
|
package/dist/commands/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { t as inspect_exports } from "./inspect.js";
|
|
|
21
21
|
import { t as ip_allow_exports } from "./ip_allow.js";
|
|
22
22
|
import { t as logs_exports } from "./logs.js";
|
|
23
23
|
import { t as neon_auth_exports } from "./neon_auth.js";
|
|
24
|
+
import { t as open_exports } from "./open.js";
|
|
24
25
|
import { t as operations_exports } from "./operations.js";
|
|
25
26
|
import { t as orgs_exports } from "./orgs.js";
|
|
26
27
|
import { t as profile_exports } from "./profile.js";
|
|
@@ -55,6 +56,7 @@ var commands_default = [
|
|
|
55
56
|
set_context_exports,
|
|
56
57
|
checkout_exports,
|
|
57
58
|
link_exports,
|
|
59
|
+
open_exports,
|
|
58
60
|
init_exports,
|
|
59
61
|
data_api_exports,
|
|
60
62
|
functions_exports,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { log } from "../log.js";
|
|
3
|
+
import { getCliName } from "../utils/cli_name.js";
|
|
4
|
+
import open from "open";
|
|
5
|
+
//#region src/commands/open.ts
|
|
6
|
+
var open_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
builder: () => builder,
|
|
8
|
+
command: () => command,
|
|
9
|
+
describe: () => describe,
|
|
10
|
+
handler: () => handler,
|
|
11
|
+
projectConsoleUrl: () => projectConsoleUrl
|
|
12
|
+
});
|
|
13
|
+
const command = "open";
|
|
14
|
+
const describe = "Open the linked project in the Neon Console";
|
|
15
|
+
const builder = (argv) => argv.usage("$0 open [options]").option("project-id", {
|
|
16
|
+
describe: "Project ID (defaults to the project linked in .neon)",
|
|
17
|
+
type: "string"
|
|
18
|
+
}).example("$0 open", describe);
|
|
19
|
+
const projectConsoleUrl = (projectId) => `https://console.neon.tech/app/projects/${encodeURIComponent(projectId)}`;
|
|
20
|
+
const handler = async (props) => {
|
|
21
|
+
if (!props.projectId) throw new Error(`No Neon project linked. Run \`${getCliName()} link\` to link this directory to a project.`);
|
|
22
|
+
const url = projectConsoleUrl(props.projectId);
|
|
23
|
+
log.info("Opening %s in your browser.", url);
|
|
24
|
+
const subprocess = await open(url);
|
|
25
|
+
await new Promise((resolve, reject) => {
|
|
26
|
+
subprocess.once("spawn", resolve);
|
|
27
|
+
subprocess.once("error", (error) => {
|
|
28
|
+
reject(/* @__PURE__ */ new Error(`Failed to open the Neon Console in your browser. Open ${url} manually. ${error.message}`));
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { builder, command, describe, handler, projectConsoleUrl, open_exports as t };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"typescript": "^5.9.0",
|
|
98
98
|
"vitest": "^3.0.9",
|
|
99
99
|
"@neon-internals/cli-core": "0.0.0",
|
|
100
|
-
"@neon
|
|
101
|
-
"@neon/
|
|
100
|
+
"@neon/e2e-harness": "0.0.0",
|
|
101
|
+
"@neon-internals/env-core": "0.0.0"
|
|
102
102
|
},
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public",
|