create-meridian-app 0.1.33 → 0.1.35
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/{chunk-274KMFCT.js → chunk-CJ3WH2PS.js} +8 -0
- package/dist/cli.js +18 -9
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ function renderPackageJson(vars) {
|
|
|
18
18
|
dev: "meridian dev",
|
|
19
19
|
build: "meridian build",
|
|
20
20
|
start: "meridian start",
|
|
21
|
+
generate: "meridian generate",
|
|
21
22
|
"db:migrate": "meridian db:migrate",
|
|
22
23
|
"db:generate": "meridian db:generate",
|
|
23
24
|
...vars.seedDemo ? { "seed:demo": "node --import tsx/esm src/scripts/seed-demo.ts" } : {}
|
|
@@ -289,6 +290,11 @@ npm run dev
|
|
|
289
290
|
|---|---|
|
|
290
291
|
| \`npm run dev\` | Start API server${vars.dashboard ? " + admin dashboard" : ""} |
|
|
291
292
|
| \`npm run build\` | Type-check the project |
|
|
293
|
+
| \`npm run generate -- module <name>\` | Scaffold a new module |
|
|
294
|
+
| \`npm run generate -- workflow <name>\` | Scaffold a new workflow |
|
|
295
|
+
| \`npm run generate -- subscriber <event>\` | Scaffold a new subscriber |
|
|
296
|
+
| \`npm run generate -- job <name>\` | Scaffold a new cron job |
|
|
297
|
+
| \`npm run generate -- route <path>\` | Scaffold a new API route |
|
|
292
298
|
| \`npm run db:migrate\` | Synchronize the database schema |
|
|
293
299
|
| \`npm run db:generate <name>\` | Generate a new migration file |${vars.dashboard ? "\n| `meridian serve-dashboard` | Serve the admin dashboard standalone |" : ""}
|
|
294
300
|
|
|
@@ -1164,6 +1170,8 @@ const c = cfg.default ?? cfg
|
|
|
1164
1170
|
process.stdout.write(JSON.stringify({
|
|
1165
1171
|
apiPort: c?.projectConfig?.httpPort ?? 9000,
|
|
1166
1172
|
dashboardPort: c?.admin?.port ?? 5174,
|
|
1173
|
+
appName: c?.admin?.appName,
|
|
1174
|
+
logoUrl: c?.admin?.logoUrl,
|
|
1167
1175
|
}))
|
|
1168
1176
|
`;
|
|
1169
1177
|
const scriptPath = path.join(rootDir, `.meridian-ports-${randomBytes(8).toString("hex")}.mjs`);
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
toKebabCase,
|
|
15
15
|
toPascalCase,
|
|
16
16
|
writeFile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CJ3WH2PS.js";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
import { Command } from "commander";
|
|
@@ -108,9 +108,12 @@ async function buildAdminExtensions(rootDir) {
|
|
|
108
108
|
throw err;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
function startDashboardServer(distDir, port, apiPort, apiHost = "localhost", adminExtensionsBuf = null, apiUrlOverride) {
|
|
111
|
+
function startDashboardServer(distDir, port, apiPort, apiHost = "localhost", adminExtensionsBuf = null, apiUrlOverride, branding) {
|
|
112
112
|
const resolvedApiUrl = apiUrlOverride ?? `http://${apiHost}:${apiPort}`;
|
|
113
|
-
const
|
|
113
|
+
const configObj = { apiUrl: resolvedApiUrl };
|
|
114
|
+
if (branding?.appName) configObj.appName = branding.appName;
|
|
115
|
+
if (branding?.logoUrl) configObj.logoUrl = branding.logoUrl;
|
|
116
|
+
const configScript = `<script>window.__MERIDIAN_CONFIG__ = ${JSON.stringify(configObj)};</script>`;
|
|
114
117
|
return new Promise((resolve, reject) => {
|
|
115
118
|
const server = http.createServer((req, res) => {
|
|
116
119
|
const urlPath = (req.url ?? "/").split("?")[0];
|
|
@@ -189,7 +192,8 @@ async function runServeDashboard(portOverride) {
|
|
|
189
192
|
console.error(chalk.dim(" Run: npm install @meridianjs/admin-dashboard"));
|
|
190
193
|
process.exit(1);
|
|
191
194
|
}
|
|
192
|
-
const
|
|
195
|
+
const projectConfig = await readProjectPorts(rootDir);
|
|
196
|
+
const { apiPort, dashboardPort } = projectConfig;
|
|
193
197
|
const port = portOverride ?? dashboardPort;
|
|
194
198
|
const apiUrl = process.env.API_URL ?? `http://localhost:${apiPort}`;
|
|
195
199
|
let adminExtensionsBuf = null;
|
|
@@ -206,7 +210,8 @@ async function runServeDashboard(portOverride) {
|
|
|
206
210
|
console.warn(chalk.yellow(" \u26A0 Admin extensions failed to compile:"), err);
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
|
-
const
|
|
213
|
+
const branding = { appName: projectConfig.appName, logoUrl: projectConfig.logoUrl };
|
|
214
|
+
const server = await startDashboardServer(distDir, port, apiPort, "localhost", adminExtensionsBuf, apiUrl, branding);
|
|
210
215
|
console.log(chalk.green(" \u2714 Admin dashboard: ") + chalk.cyan(`http://localhost:${port}`));
|
|
211
216
|
console.log(chalk.dim(` \u2192 API: ${apiUrl}`));
|
|
212
217
|
if (adminExtensionsBuf) {
|
|
@@ -235,7 +240,8 @@ async function runDev() {
|
|
|
235
240
|
}
|
|
236
241
|
const dashboardDist = path2.join(rootDir, "node_modules", "@meridianjs", "admin-dashboard", "dist");
|
|
237
242
|
const hasDashboard = existsSync2(dashboardDist);
|
|
238
|
-
const
|
|
243
|
+
const ports = await readProjectPorts(rootDir);
|
|
244
|
+
const { apiPort, dashboardPort } = ports;
|
|
239
245
|
const apiUrl = process.env.API_URL ?? `http://localhost:${apiPort}`;
|
|
240
246
|
let dashServer = null;
|
|
241
247
|
if (hasDashboard) {
|
|
@@ -249,7 +255,8 @@ async function runDev() {
|
|
|
249
255
|
console.warn(chalk2.yellow(" \u26A0 Admin extensions failed to compile:"), err);
|
|
250
256
|
}
|
|
251
257
|
}
|
|
252
|
-
|
|
258
|
+
const branding = { appName: ports.appName, logoUrl: ports.logoUrl };
|
|
259
|
+
dashServer = await startDashboardServer(dashboardDist, dashboardPort, apiPort, "localhost", adminExtensionsBuf, apiUrl, branding);
|
|
253
260
|
console.log(
|
|
254
261
|
chalk2.dim(" \u2192 API: ") + chalk2.cyan(`http://localhost:${apiPort}`) + chalk2.dim(" dashboard: ") + chalk2.cyan(`http://localhost:${dashboardPort}`)
|
|
255
262
|
);
|
|
@@ -304,7 +311,8 @@ async function runStart() {
|
|
|
304
311
|
}
|
|
305
312
|
const dashboardDist = path3.join(rootDir, "node_modules", "@meridianjs", "admin-dashboard", "dist");
|
|
306
313
|
const hasDashboard = existsSync3(dashboardDist);
|
|
307
|
-
const
|
|
314
|
+
const ports = await readProjectPorts(rootDir);
|
|
315
|
+
const { apiPort, dashboardPort } = ports;
|
|
308
316
|
const apiUrl = process.env.API_URL ?? `http://localhost:${apiPort}`;
|
|
309
317
|
let dashServer = null;
|
|
310
318
|
if (hasDashboard) {
|
|
@@ -318,7 +326,8 @@ async function runStart() {
|
|
|
318
326
|
console.warn(chalk3.yellow(" \u26A0 Admin extensions failed to compile:"), err);
|
|
319
327
|
}
|
|
320
328
|
}
|
|
321
|
-
|
|
329
|
+
const branding = { appName: ports.appName, logoUrl: ports.logoUrl };
|
|
330
|
+
dashServer = await startDashboardServer(dashboardDist, dashboardPort, apiPort, "localhost", adminExtensionsBuf, apiUrl, branding);
|
|
322
331
|
console.log(
|
|
323
332
|
chalk3.dim(" \u2192 API: ") + chalk3.cyan(`http://localhost:${apiPort}`) + chalk3.dim(" dashboard: ") + chalk3.cyan(`http://localhost:${dashboardPort}`)
|
|
324
333
|
);
|
package/dist/index.js
CHANGED