lakebed 0.0.7 → 0.0.8
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 +5 -3
- package/package.json +1 -1
- package/src/cli.js +21 -7
- package/src/version.js +1 -1
package/README.md
CHANGED
|
@@ -8,14 +8,16 @@ This package is an early public prototype. It includes the `lakebed` CLI, a loca
|
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
npm install -g lakebed
|
|
11
|
-
lakebed new
|
|
11
|
+
lakebed new
|
|
12
12
|
lakebed dev my-app
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Enter `my-app` when `lakebed new` asks for a capsule name.
|
|
16
|
+
|
|
15
17
|
Or run it without a global install:
|
|
16
18
|
|
|
17
19
|
```sh
|
|
18
|
-
|
|
20
|
+
npx lakebed new
|
|
19
21
|
npm exec --package lakebed -- lakebed dev my-app
|
|
20
22
|
```
|
|
21
23
|
|
|
@@ -109,7 +111,7 @@ queries: {
|
|
|
109
111
|
## Commands
|
|
110
112
|
|
|
111
113
|
```sh
|
|
112
|
-
lakebed new
|
|
114
|
+
lakebed new [name] [--template todo]
|
|
113
115
|
lakebed dev <capsule-dir> [--port 3000]
|
|
114
116
|
lakebed build <capsule-dir> --target anonymous [--out .lakebed/artifacts/app.json] [--json]
|
|
115
117
|
lakebed deploy [capsule-dir] [--ttl 7d] [--api <url>] [--json]
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createServer } from "node:http";
|
|
|
3
3
|
import { existsSync, realpathSync } from "node:fs";
|
|
4
4
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
6
|
+
import { createInterface } from "node:readline/promises";
|
|
6
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
8
|
import * as esbuild from "esbuild";
|
|
8
9
|
import { WebSocketServer } from "ws";
|
|
@@ -32,7 +33,7 @@ function usage() {
|
|
|
32
33
|
console.log(`lakebed
|
|
33
34
|
|
|
34
35
|
Usage:
|
|
35
|
-
lakebed new
|
|
36
|
+
lakebed new [name] [--template todo]
|
|
36
37
|
lakebed dev <capsule-dir> [--port 3000]
|
|
37
38
|
lakebed build <capsule-dir> --target anonymous [--out .lakebed/artifacts/app.json] [--json]
|
|
38
39
|
lakebed deploy [capsule-dir] [--ttl 7d] [--api <url>] [--json]
|
|
@@ -1307,18 +1308,18 @@ pnpm lakebed dev ${name}
|
|
|
1307
1308
|
}
|
|
1308
1309
|
|
|
1309
1310
|
async function newCommand(args) {
|
|
1310
|
-
const [
|
|
1311
|
+
const [nameArg] = positionals(args);
|
|
1311
1312
|
const template = readArg(args, "--template", "todo");
|
|
1312
1313
|
|
|
1313
|
-
if (!name) {
|
|
1314
|
-
usage();
|
|
1315
|
-
return;
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
1314
|
if (template !== "todo") {
|
|
1319
1315
|
throw new Error(`Unknown template: ${template}`);
|
|
1320
1316
|
}
|
|
1321
1317
|
|
|
1318
|
+
const name = nameArg ?? (await promptForCapsuleName());
|
|
1319
|
+
if (!name) {
|
|
1320
|
+
throw new Error("Capsule name is required.");
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1322
1323
|
const targetDir = resolveCapsuleDir(name);
|
|
1323
1324
|
if (existsSync(targetDir)) {
|
|
1324
1325
|
throw new Error(`Target already exists: ${targetDir}`);
|
|
@@ -1334,6 +1335,19 @@ async function newCommand(args) {
|
|
|
1334
1335
|
console.log(`Created Lakebed capsule at ${targetDir}`);
|
|
1335
1336
|
}
|
|
1336
1337
|
|
|
1338
|
+
async function promptForCapsuleName() {
|
|
1339
|
+
const rl = createInterface({
|
|
1340
|
+
input: process.stdin,
|
|
1341
|
+
output: process.stdout
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
try {
|
|
1345
|
+
return (await rl.question("Capsule name: ")).trim();
|
|
1346
|
+
} finally {
|
|
1347
|
+
rl.close();
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1337
1351
|
async function runMany(args) {
|
|
1338
1352
|
const [capsuleArg] = positionals(args);
|
|
1339
1353
|
const capsuleDir = resolveCapsuleDir(capsuleArg);
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LAKEBED_VERSION = "0.0.
|
|
1
|
+
export const LAKEBED_VERSION = "0.0.8";
|