@launchmatic/cli 0.6.0 → 0.6.1
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/dist/index.js +44 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17834,6 +17834,11 @@ var {
|
|
|
17834
17834
|
Help
|
|
17835
17835
|
} = import_index.default;
|
|
17836
17836
|
|
|
17837
|
+
// src/index.ts
|
|
17838
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
17839
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
17840
|
+
import { dirname, join as join6 } from "path";
|
|
17841
|
+
|
|
17837
17842
|
// src/commands/login.ts
|
|
17838
17843
|
import http from "http";
|
|
17839
17844
|
import { createInterface } from "readline";
|
|
@@ -21354,14 +21359,14 @@ function detectLocal(cwd) {
|
|
|
21354
21359
|
return { runtime: "docker", port: 8080, confidence: "high" };
|
|
21355
21360
|
}
|
|
21356
21361
|
if (existsSync2(join(cwd, "bun.lockb")) || existsSync2(join(cwd, "bunfig.toml"))) {
|
|
21357
|
-
const
|
|
21358
|
-
const framework = detectFramework(
|
|
21362
|
+
const pkg2 = readPkg(cwd);
|
|
21363
|
+
const framework = detectFramework(pkg2, cwd);
|
|
21359
21364
|
const port = frameworkPort(framework) ?? 3e3;
|
|
21360
21365
|
return {
|
|
21361
21366
|
runtime: "bun",
|
|
21362
21367
|
framework,
|
|
21363
|
-
buildCmd:
|
|
21364
|
-
startCmd:
|
|
21368
|
+
buildCmd: pkg2?.scripts?.build ? "bun run build" : void 0,
|
|
21369
|
+
startCmd: pkg2?.scripts?.start ? "bun run start" : "bun index.ts",
|
|
21365
21370
|
port,
|
|
21366
21371
|
confidence: "high"
|
|
21367
21372
|
};
|
|
@@ -21382,8 +21387,8 @@ function detectLocal(cwd) {
|
|
|
21382
21387
|
};
|
|
21383
21388
|
}
|
|
21384
21389
|
if (existsSync2(join(cwd, "package.json"))) {
|
|
21385
|
-
const
|
|
21386
|
-
const deps = { ...
|
|
21390
|
+
const pkg2 = readPkg(cwd);
|
|
21391
|
+
const deps = { ...pkg2.dependencies, ...pkg2.devDependencies };
|
|
21387
21392
|
if (deps?.["stirrup-ai"]) {
|
|
21388
21393
|
return {
|
|
21389
21394
|
runtime: "nodejs",
|
|
@@ -21411,9 +21416,9 @@ function detectLocal(cwd) {
|
|
|
21411
21416
|
if (existsSync2(join(cwd, "pnpm-lock.yaml"))) pm = "pnpm";
|
|
21412
21417
|
else if (existsSync2(join(cwd, "yarn.lock"))) pm = "yarn";
|
|
21413
21418
|
const prefix = pm === "pnpm" ? "pnpm" : pm === "yarn" ? "yarn" : "npm";
|
|
21414
|
-
const buildCmd =
|
|
21415
|
-
const startCmd =
|
|
21416
|
-
const framework = detectFramework(
|
|
21419
|
+
const buildCmd = pkg2.scripts?.build ? `${prefix} run build` : void 0;
|
|
21420
|
+
const startCmd = pkg2.scripts?.start ? `${prefix} start` : "node index.js";
|
|
21421
|
+
const framework = detectFramework(pkg2, cwd);
|
|
21417
21422
|
const port = frameworkPort(framework) ?? 3e3;
|
|
21418
21423
|
return {
|
|
21419
21424
|
runtime: "nodejs",
|
|
@@ -21562,9 +21567,9 @@ function readPkg(cwd) {
|
|
|
21562
21567
|
return void 0;
|
|
21563
21568
|
}
|
|
21564
21569
|
}
|
|
21565
|
-
function detectFramework(
|
|
21566
|
-
if (!
|
|
21567
|
-
const deps = { ...
|
|
21570
|
+
function detectFramework(pkg2, cwd) {
|
|
21571
|
+
if (!pkg2) return void 0;
|
|
21572
|
+
const deps = { ...pkg2.dependencies, ...pkg2.devDependencies };
|
|
21568
21573
|
if (existsSync2(join(cwd, "next.config.js")) || existsSync2(join(cwd, "next.config.mjs")) || existsSync2(join(cwd, "next.config.ts")))
|
|
21569
21574
|
return "Next.js";
|
|
21570
21575
|
if (existsSync2(join(cwd, "nuxt.config.js")) || existsSync2(join(cwd, "nuxt.config.ts")))
|
|
@@ -24079,8 +24084,8 @@ function registerDb(program3) {
|
|
|
24079
24084
|
requireLogin2();
|
|
24080
24085
|
const spinner = ora(`Running ${file}...`).start();
|
|
24081
24086
|
try {
|
|
24082
|
-
const { readFileSync:
|
|
24083
|
-
const sql =
|
|
24087
|
+
const { readFileSync: readFileSync9 } = await import("fs");
|
|
24088
|
+
const sql = readFileSync9(file, "utf-8");
|
|
24084
24089
|
const { data } = await api(`/api/databases/${dbId}/query`, {
|
|
24085
24090
|
method: "POST",
|
|
24086
24091
|
body: JSON.stringify({ sql })
|
|
@@ -24215,9 +24220,9 @@ function validatePackageJson(files, ctx) {
|
|
|
24215
24220
|
}
|
|
24216
24221
|
return issues;
|
|
24217
24222
|
}
|
|
24218
|
-
let
|
|
24223
|
+
let pkg2;
|
|
24219
24224
|
try {
|
|
24220
|
-
|
|
24225
|
+
pkg2 = JSON.parse(pkgFile.content);
|
|
24221
24226
|
} catch (e) {
|
|
24222
24227
|
issues.push({
|
|
24223
24228
|
category: "package-json",
|
|
@@ -24228,7 +24233,7 @@ function validatePackageJson(files, ctx) {
|
|
|
24228
24233
|
});
|
|
24229
24234
|
return issues;
|
|
24230
24235
|
}
|
|
24231
|
-
if (!
|
|
24236
|
+
if (!pkg2.name || typeof pkg2.name !== "string") {
|
|
24232
24237
|
issues.push({
|
|
24233
24238
|
category: "package-json",
|
|
24234
24239
|
severity: "warning",
|
|
@@ -24238,7 +24243,7 @@ function validatePackageJson(files, ctx) {
|
|
|
24238
24243
|
});
|
|
24239
24244
|
}
|
|
24240
24245
|
for (const depKey of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
24241
|
-
const deps =
|
|
24246
|
+
const deps = pkg2[depKey];
|
|
24242
24247
|
if (!deps || typeof deps !== "object")
|
|
24243
24248
|
continue;
|
|
24244
24249
|
for (const [name, version] of Object.entries(deps)) {
|
|
@@ -24261,7 +24266,7 @@ function validatePackageJson(files, ctx) {
|
|
|
24261
24266
|
}
|
|
24262
24267
|
}
|
|
24263
24268
|
}
|
|
24264
|
-
const scripts =
|
|
24269
|
+
const scripts = pkg2.scripts;
|
|
24265
24270
|
if (ctx.startCmd) {
|
|
24266
24271
|
const scriptMatch = ctx.startCmd.match(/^(?:npm|pnpm|yarn)\s+(?:run\s+)?(\S+)/);
|
|
24267
24272
|
if (scriptMatch) {
|
|
@@ -24721,20 +24726,20 @@ function detectContext(dir) {
|
|
|
24721
24726
|
const pkgPath = resolve3(dir, "package.json");
|
|
24722
24727
|
if (existsSync5(pkgPath)) {
|
|
24723
24728
|
try {
|
|
24724
|
-
const
|
|
24725
|
-
const deps = { ...
|
|
24729
|
+
const pkg2 = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
24730
|
+
const deps = { ...pkg2.dependencies, ...pkg2.devDependencies };
|
|
24726
24731
|
if (deps.next) ctx.runtime = "nodejs";
|
|
24727
24732
|
else if (deps.express || deps.fastify || deps.koa || deps.hapi) ctx.runtime = "nodejs";
|
|
24728
24733
|
else if (deps.react || deps.vue || deps.svelte) ctx.runtime = "nodejs";
|
|
24729
|
-
else if (
|
|
24734
|
+
else if (pkg2.type === "module" || deps.typescript) ctx.runtime = "nodejs";
|
|
24730
24735
|
if (existsSync5(resolve3(dir, "pnpm-lock.yaml"))) ctx.packageManager = "pnpm";
|
|
24731
24736
|
else if (existsSync5(resolve3(dir, "yarn.lock"))) ctx.packageManager = "yarn";
|
|
24732
24737
|
else if (existsSync5(resolve3(dir, "package-lock.json"))) ctx.packageManager = "npm";
|
|
24733
|
-
const startScript =
|
|
24738
|
+
const startScript = pkg2.scripts?.start || pkg2.scripts?.dev || "";
|
|
24734
24739
|
const portMatch = startScript.match(/--port\s+(\d+)|-p\s+(\d+)/);
|
|
24735
24740
|
if (portMatch) ctx.port = parseInt(portMatch[1] || portMatch[2]);
|
|
24736
24741
|
if (deps.prisma || deps["@prisma/client"]) ctx.hasPrisma = true;
|
|
24737
|
-
if (
|
|
24742
|
+
if (pkg2.scripts?.start) ctx.startCmd = `npm run start`;
|
|
24738
24743
|
} catch {
|
|
24739
24744
|
}
|
|
24740
24745
|
}
|
|
@@ -25900,11 +25905,11 @@ function readWorkspaceGlobs(repoRoot) {
|
|
|
25900
25905
|
const pkgFile = join4(repoRoot, "package.json");
|
|
25901
25906
|
if (existsSync6(pkgFile)) {
|
|
25902
25907
|
try {
|
|
25903
|
-
const
|
|
25904
|
-
if (Array.isArray(
|
|
25905
|
-
globs.push(...
|
|
25906
|
-
} else if (
|
|
25907
|
-
globs.push(...
|
|
25908
|
+
const pkg2 = JSON.parse(readFileSync6(pkgFile, "utf-8"));
|
|
25909
|
+
if (Array.isArray(pkg2.workspaces)) {
|
|
25910
|
+
globs.push(...pkg2.workspaces.filter((g) => typeof g === "string"));
|
|
25911
|
+
} else if (pkg2.workspaces && Array.isArray(pkg2.workspaces.packages)) {
|
|
25912
|
+
globs.push(...pkg2.workspaces.packages.filter((g) => typeof g === "string"));
|
|
25908
25913
|
}
|
|
25909
25914
|
} catch {
|
|
25910
25915
|
}
|
|
@@ -25933,9 +25938,9 @@ function isLikelyDeployable(absDir) {
|
|
|
25933
25938
|
const pkgPath = join4(absDir, "package.json");
|
|
25934
25939
|
if (existsSync6(pkgPath)) {
|
|
25935
25940
|
try {
|
|
25936
|
-
const
|
|
25937
|
-
if (
|
|
25938
|
-
if (
|
|
25941
|
+
const pkg2 = JSON.parse(readFileSync6(pkgPath, "utf-8"));
|
|
25942
|
+
if (pkg2.scripts?.start || pkg2.scripts?.dev || pkg2.scripts?.serve) return true;
|
|
25943
|
+
if (pkg2.bin) return true;
|
|
25939
25944
|
} catch {
|
|
25940
25945
|
}
|
|
25941
25946
|
}
|
|
@@ -26066,8 +26071,8 @@ Discovered ${discovered.length} service${discovered.length === 1 ? "" : "s"}:`))
|
|
|
26066
26071
|
}
|
|
26067
26072
|
const projectName = opts.project || opts.name || (existsSync7(join5(repoRoot, "package.json")) ? (() => {
|
|
26068
26073
|
try {
|
|
26069
|
-
const
|
|
26070
|
-
return
|
|
26074
|
+
const pkg2 = JSON.parse(readFileSync7(join5(repoRoot, "package.json"), "utf-8"));
|
|
26075
|
+
return pkg2.name?.replace(/^@.*\//, "") || "monorepo";
|
|
26071
26076
|
} catch {
|
|
26072
26077
|
return "monorepo";
|
|
26073
26078
|
}
|
|
@@ -26422,8 +26427,12 @@ function registerTemplate(program3) {
|
|
|
26422
26427
|
}
|
|
26423
26428
|
|
|
26424
26429
|
// src/index.ts
|
|
26430
|
+
var __dirname2 = dirname(fileURLToPath2(import.meta.url));
|
|
26431
|
+
var pkg = JSON.parse(
|
|
26432
|
+
readFileSync8(join6(__dirname2, "..", "package.json"), "utf-8")
|
|
26433
|
+
);
|
|
26425
26434
|
var program2 = new Command();
|
|
26426
|
-
program2.name("lm").description("Launchmatic CLI \u2014 deploy from your terminal").version(
|
|
26435
|
+
program2.name("lm").description("Launchmatic CLI \u2014 deploy from your terminal").version(pkg.version);
|
|
26427
26436
|
registerLogin(program2);
|
|
26428
26437
|
registerInit(program2);
|
|
26429
26438
|
registerDeploy(program2);
|