@better-t-stack/template-generator 3.19.3 → 3.19.4
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.d.mts.map +1 -1
- package/dist/index.mjs +89 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/virtual-fs.ts","../src/core/template-processor.ts","../src/template-handlers/utils.ts","../src/template-handlers/addons.ts","../src/generator.ts","../src/processors/addons-deps.ts","../src/bts-config.ts","../src/templates.generated.ts","../src/utils/add-deps.ts","../src/utils/reproducible-command.ts"],"sourcesContent":[],"mappings":";;;;;;;cAOa,iBAAA;;;;;;EAAA,QAAA,CAAA,QAAA,EAAA,MAAiB,CAAA,EAAA,MAAA,GAAA,SAAA;EA6Ea,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAkCX,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAgB,eAcrC,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAA,KAGJ,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAA,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;2CAnDoC;;ECzE3B,WAAA,CAAA,CAAA,EAAA,MAAA,EAAA;EAIA,iBAAY,CAAA,CAAA,EAAA,MAAA,EAAA;EAIZ,YAAA,CAAA,CAAA,EAAA,MAAiB;EAUjB,iBAAA,CAAA,CAAA,EAAkB,MAAA;6BDyFF;;eAAgB,MAAA,CAcrC;EE9HC,KAAA,CAAA,CAAA,EF8HD,MAAA,CAGJ,GEjIoB;;;;ECAL,QAAA,aAAA;;;;iBFKN,qBAAA,2BAAgD;iBAIhD,YAAA;iBAIA,iBAAA;iBAUA,kBAAA,6CAGL;;;KC1BC,YAAA,GAAe;;;iBCAL,q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AAA;;;;ECzhyBd,SAAA,EAAA,EAAA,QAAA;EA8ID,SAAA,gBAAqB,EAAA,QAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/virtual-fs.ts","../src/core/template-processor.ts","../src/template-handlers/utils.ts","../src/template-handlers/addons.ts","../src/generator.ts","../src/processors/addons-deps.ts","../src/bts-config.ts","../src/templates.generated.ts","../src/utils/add-deps.ts","../src/utils/reproducible-command.ts"],"sourcesContent":[],"mappings":";;;;;;;cAOa,iBAAA;;;;;;EAAA,QAAA,CAAA,QAAA,EAAA,MAAiB,CAAA,EAAA,MAAA,GAAA,SAAA;EA6Ea,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAkCX,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAgB,eAcrC,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAA,KAGJ,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAA,UAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;2CAnDoC;;ECzE3B,WAAA,CAAA,CAAA,EAAA,MAAA,EAAA;EAIA,iBAAY,CAAA,CAAA,EAAA,MAAA,EAAA;EAIZ,YAAA,CAAA,CAAA,EAAA,MAAiB;EAUjB,iBAAA,CAAA,CAAA,EAAkB,MAAA;6BDyFF;;eAAgB,MAAA,CAcrC;EE9HC,KAAA,CAAA,CAAA,EF8HD,MAAA,CAGJ,GEjIoB;;;;ECAL,QAAA,aAAA;;;;iBFKN,qBAAA,2BAAgD;iBAIhD,YAAA;iBAIA,iBAAA;iBAUA,kBAAA,6CAGL;;;KC1BC,YAAA,GAAe;;;iBCAL,qBAAA,MACf,8BACM,sBACH,gBACP;;;;;AHHH;;;;;;;;;ACIA;AAIA;AAIgB,iBG8BM,QAAA,CH9BW,OAAA,EG+BtB,gBH/BsB,CAAA,EGgC9B,OHhC8B,CGgCtB,MHhCsB,CGgCf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;;;;;;;;KD4I/B,qBAAA,gBAAqC;;;iBC5IjC,2BAAA,SAAoC"}
|
package/dist/index.mjs
CHANGED
|
@@ -380,6 +380,28 @@ function updatePackageJsonsWithCatalogs(vfs, packagesInfo, catalog) {
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/utils/db-scripts.ts
|
|
385
|
+
function getDbScriptSupport(config) {
|
|
386
|
+
const isD1Alchemy = config.dbSetup === "d1" && config.serverDeploy === "cloudflare";
|
|
387
|
+
if (!(config.backend !== "convex" && config.backend !== "none" && config.database !== "none" && config.orm !== "none" && config.orm !== "mongoose")) return {
|
|
388
|
+
hasDbScripts: false,
|
|
389
|
+
hasDbPush: false,
|
|
390
|
+
hasDbGenerate: false,
|
|
391
|
+
hasDbMigrate: false,
|
|
392
|
+
hasDbStudio: false,
|
|
393
|
+
isD1Alchemy
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
hasDbScripts: true,
|
|
397
|
+
hasDbPush: true,
|
|
398
|
+
hasDbGenerate: true,
|
|
399
|
+
hasDbMigrate: config.orm === "prisma" || config.orm === "drizzle" && !isD1Alchemy,
|
|
400
|
+
hasDbStudio: !isD1Alchemy,
|
|
401
|
+
isD1Alchemy
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
383
405
|
//#endregion
|
|
384
406
|
//#region src/post-process/package-configs.ts
|
|
385
407
|
/**
|
|
@@ -408,12 +430,13 @@ function updateRootPackageJson(vfs, config) {
|
|
|
408
430
|
else if (pkgJson.workspaces && typeof pkgJson.workspaces === "object" && pkgJson.workspaces.packages) workspaces = pkgJson.workspaces.packages;
|
|
409
431
|
pkgJson.workspaces = workspaces;
|
|
410
432
|
const scripts = pkgJson.scripts;
|
|
411
|
-
const { projectName, packageManager, backend, database, orm, dbSetup,
|
|
433
|
+
const { projectName, packageManager, backend, database, orm, dbSetup, addons } = config;
|
|
412
434
|
const backendPackageName = backend === "convex" ? `@${projectName}/backend` : "server";
|
|
413
435
|
const dbPackageName = `@${projectName}/db`;
|
|
414
436
|
const hasTurborepo = addons.includes("turborepo");
|
|
415
|
-
const
|
|
416
|
-
const
|
|
437
|
+
const dbSupport = getDbScriptSupport(config);
|
|
438
|
+
const needsDbScripts = dbSupport.hasDbScripts;
|
|
439
|
+
const isD1Alchemy = dbSupport.isD1Alchemy;
|
|
417
440
|
const pmConfig = getPackageManagerConfig(packageManager, hasTurborepo);
|
|
418
441
|
scripts.dev = pmConfig.dev;
|
|
419
442
|
scripts.build = pmConfig.build;
|
|
@@ -490,8 +513,8 @@ function updateDbPackageJson(vfs, config) {
|
|
|
490
513
|
pkgJson.name = `@${config.projectName}/db`;
|
|
491
514
|
pkgJson.scripts = pkgJson.scripts || {};
|
|
492
515
|
const scripts = pkgJson.scripts;
|
|
493
|
-
const { database, orm, dbSetup
|
|
494
|
-
const isD1Alchemy =
|
|
516
|
+
const { database, orm, dbSetup } = config;
|
|
517
|
+
const { isD1Alchemy } = getDbScriptSupport(config);
|
|
495
518
|
if (database !== "none") {
|
|
496
519
|
if (database === "sqlite" && dbSetup !== "d1") scripts["db:local"] = "turso dev --db-file local.db";
|
|
497
520
|
if (orm === "prisma") {
|
|
@@ -2179,7 +2202,7 @@ function processReadme(vfs, config) {
|
|
|
2179
2202
|
vfs.writeFile("README.md", content);
|
|
2180
2203
|
}
|
|
2181
2204
|
function generateReadmeContent(options) {
|
|
2182
|
-
const { projectName, packageManager, database, auth, addons = [], orm = "drizzle", runtime = "bun", frontend = ["tanstack-router"], backend = "hono", api = "trpc", webDeploy, serverDeploy
|
|
2205
|
+
const { projectName, packageManager, database, auth, addons = [], orm = "drizzle", runtime = "bun", frontend = ["tanstack-router"], backend = "hono", api = "trpc", webDeploy, serverDeploy } = options;
|
|
2183
2206
|
const isConvex = backend === "convex";
|
|
2184
2207
|
const hasReactRouter = frontend.includes("react-router");
|
|
2185
2208
|
const hasNative = frontend.some((f) => [
|
|
@@ -2224,7 +2247,7 @@ ${auth === "clerk" ? `
|
|
|
2224
2247
|
|
|
2225
2248
|
- Follow the guide: [Convex + Clerk](https://docs.convex.dev/auth/clerk)
|
|
2226
2249
|
- Set \`CLERK_JWT_ISSUER_DOMAIN\` in Convex Dashboard
|
|
2227
|
-
- Set \`CLERK_PUBLISHABLE_KEY\` in \`apps/*/.env\`` : ""}` : generateDatabaseSetup(
|
|
2250
|
+
- Set \`CLERK_PUBLISHABLE_KEY\` in \`apps/*/.env\`` : ""}` : generateDatabaseSetup(options, packageManagerRunCmd)}
|
|
2228
2251
|
|
|
2229
2252
|
Then, run the development server:
|
|
2230
2253
|
|
|
@@ -2240,12 +2263,12 @@ ${generateGitHooksSection(packageManagerRunCmd, addons)}
|
|
|
2240
2263
|
## Project Structure
|
|
2241
2264
|
|
|
2242
2265
|
\`\`\`
|
|
2243
|
-
${generateProjectStructure(
|
|
2266
|
+
${generateProjectStructure(options)}
|
|
2244
2267
|
\`\`\`
|
|
2245
2268
|
|
|
2246
2269
|
## Available Scripts
|
|
2247
2270
|
|
|
2248
|
-
${generateScriptsList(packageManagerRunCmd,
|
|
2271
|
+
${generateScriptsList(packageManagerRunCmd, options, hasNative)}
|
|
2249
2272
|
`;
|
|
2250
2273
|
}
|
|
2251
2274
|
function generateStackDescription(frontend, backend, api, isConvex) {
|
|
@@ -2281,7 +2304,9 @@ function generateRunningInstructions(frontend, backend, webPort, hasNative, isCo
|
|
|
2281
2304
|
else if (backend !== "none" && !isBackendSelf) instructions.push("The API is running at [http://localhost:3000](http://localhost:3000).");
|
|
2282
2305
|
return instructions.join("\n");
|
|
2283
2306
|
}
|
|
2284
|
-
function generateProjectStructure(
|
|
2307
|
+
function generateProjectStructure(config) {
|
|
2308
|
+
const { projectName, frontend, backend, addons, api, auth, database, orm } = config;
|
|
2309
|
+
const isConvex = backend === "convex";
|
|
2285
2310
|
const structure = [`${projectName}/`, "├── apps/"];
|
|
2286
2311
|
const hasFrontend = frontend.length > 0 && !frontend.includes("none");
|
|
2287
2312
|
const isBackendSelf = backend === "self";
|
|
@@ -2290,6 +2315,7 @@ function generateProjectStructure(projectName, frontend, backend, addons, isConv
|
|
|
2290
2315
|
"native-uniwind",
|
|
2291
2316
|
"native-unistyles"
|
|
2292
2317
|
].includes(f));
|
|
2318
|
+
const hasDbPackage = !isConvex && database !== "none" && orm !== "none";
|
|
2293
2319
|
if (hasFrontend) {
|
|
2294
2320
|
const frontendTypes = {
|
|
2295
2321
|
"tanstack-router": "React + TanStack Router",
|
|
@@ -2321,9 +2347,9 @@ function generateProjectStructure(projectName, frontend, backend, addons, isConv
|
|
|
2321
2347
|
if (auth === "clerk") structure.push("│ │ ├── convex/ # Convex functions and schema", "│ │ └── .env.local # Convex environment variables");
|
|
2322
2348
|
}
|
|
2323
2349
|
if (!isConvex) {
|
|
2324
|
-
structure.push("│ ├── api/ # API layer / business logic");
|
|
2350
|
+
if (api !== "none") structure.push("│ ├── api/ # API layer / business logic");
|
|
2325
2351
|
if (auth !== "none") structure.push("│ ├── auth/ # Authentication configuration & logic");
|
|
2326
|
-
if (
|
|
2352
|
+
if (hasDbPackage) structure.push("│ └── db/ # Database schema & queries");
|
|
2327
2353
|
}
|
|
2328
2354
|
}
|
|
2329
2355
|
return structure.join("\n");
|
|
@@ -2393,11 +2419,18 @@ function generateFeaturesList(database, auth, addons, orm, runtime, frontend, ba
|
|
|
2393
2419
|
for (const addon of addons) if (addonFeatures[addon]) features.push(addonFeatures[addon]);
|
|
2394
2420
|
return features.join("\n");
|
|
2395
2421
|
}
|
|
2396
|
-
function generateDatabaseSetup(
|
|
2422
|
+
function generateDatabaseSetup(config, packageManagerRunCmd) {
|
|
2423
|
+
const { database, orm, dbSetup, backend } = config;
|
|
2397
2424
|
if (database === "none") return "";
|
|
2398
2425
|
const isBackendSelf = backend === "self";
|
|
2399
2426
|
const envPath = isBackendSelf ? "apps/web/.env" : "apps/server/.env";
|
|
2400
|
-
const ormDesc = orm === "
|
|
2427
|
+
const ormDesc = orm === "none" ? "" : ` with ${{
|
|
2428
|
+
drizzle: "Drizzle ORM",
|
|
2429
|
+
prisma: "Prisma",
|
|
2430
|
+
mongoose: "Mongoose",
|
|
2431
|
+
none: "ORM"
|
|
2432
|
+
}[orm] || orm}`;
|
|
2433
|
+
const dbSupport = getDbScriptSupport(config);
|
|
2401
2434
|
let setup = "## Database Setup\n\n";
|
|
2402
2435
|
const dbDescriptions = {
|
|
2403
2436
|
sqlite: `This project uses SQLite${ormDesc}.
|
|
@@ -2422,7 +2455,7 @@ ${packageManagerRunCmd} db:local
|
|
|
2422
2455
|
2. Update your \`${envPath}\` file with your MongoDB connection URI.`
|
|
2423
2456
|
};
|
|
2424
2457
|
setup += dbDescriptions[database] || "";
|
|
2425
|
-
setup += `
|
|
2458
|
+
if (dbSupport.hasDbPush) setup += `
|
|
2426
2459
|
|
|
2427
2460
|
3. Apply the schema to your database:
|
|
2428
2461
|
\`\`\`bash
|
|
@@ -2431,9 +2464,11 @@ ${packageManagerRunCmd} db:push
|
|
|
2431
2464
|
`;
|
|
2432
2465
|
return setup;
|
|
2433
2466
|
}
|
|
2434
|
-
function generateScriptsList(packageManagerRunCmd,
|
|
2467
|
+
function generateScriptsList(packageManagerRunCmd, config, hasNative) {
|
|
2468
|
+
const { database, addons, backend, dbSetup } = config;
|
|
2435
2469
|
const isConvex = backend === "convex";
|
|
2436
2470
|
const isBackendSelf = backend === "self";
|
|
2471
|
+
const dbSupport = getDbScriptSupport(config);
|
|
2437
2472
|
let scripts = `- \`${packageManagerRunCmd} dev\`: Start all applications in development mode
|
|
2438
2473
|
- \`${packageManagerRunCmd} build\`: Build all applications`;
|
|
2439
2474
|
if (!isBackendSelf) scripts += `\n- \`${packageManagerRunCmd} dev:web\`: Start only the web application`;
|
|
@@ -2441,11 +2476,13 @@ function generateScriptsList(packageManagerRunCmd, database, orm, hasNative, add
|
|
|
2441
2476
|
else if (backend !== "none" && !isBackendSelf) scripts += `\n- \`${packageManagerRunCmd} dev:server\`: Start only the server`;
|
|
2442
2477
|
scripts += `\n- \`${packageManagerRunCmd} check-types\`: Check TypeScript types across all apps`;
|
|
2443
2478
|
if (hasNative) scripts += `\n- \`${packageManagerRunCmd} dev:native\`: Start the React Native/Expo development server`;
|
|
2444
|
-
if (
|
|
2445
|
-
scripts += `\n- \`${packageManagerRunCmd} db:push\`: Push schema changes to database
|
|
2446
|
-
- \`${packageManagerRunCmd} db:
|
|
2447
|
-
if (
|
|
2479
|
+
if (dbSupport.hasDbScripts) {
|
|
2480
|
+
scripts += `\n- \`${packageManagerRunCmd} db:push\`: Push schema changes to database`;
|
|
2481
|
+
if (dbSupport.hasDbGenerate) scripts += `\n- \`${packageManagerRunCmd} db:generate\`: Generate database client/types`;
|
|
2482
|
+
if (dbSupport.hasDbMigrate) scripts += `\n- \`${packageManagerRunCmd} db:migrate\`: Run database migrations`;
|
|
2483
|
+
if (dbSupport.hasDbStudio) scripts += `\n- \`${packageManagerRunCmd} db:studio\`: Open database studio UI`;
|
|
2448
2484
|
}
|
|
2485
|
+
if (database === "sqlite" && dbSetup !== "d1" && dbSupport.hasDbScripts) scripts += `\n- \`${packageManagerRunCmd} db:local\`: Start the local SQLite database`;
|
|
2449
2486
|
if (addons.includes("biome")) scripts += `\n- \`${packageManagerRunCmd} check\`: Run Biome formatting and linting`;
|
|
2450
2487
|
if (addons.includes("oxlint")) scripts += `\n- \`${packageManagerRunCmd} check\`: Run Oxlint and Oxfmt`;
|
|
2451
2488
|
if (addons.includes("pwa")) scripts += `\n- \`cd apps/web && ${packageManagerRunCmd} generate-pwa-assets\`: Generate PWA assets`;
|
|
@@ -2522,11 +2559,12 @@ function processTurboConfig(vfs, config) {
|
|
|
2522
2559
|
vfs.writeFile("turbo.json", JSON.stringify(turboConfig, null, " "));
|
|
2523
2560
|
}
|
|
2524
2561
|
function generateTurboConfig(config) {
|
|
2525
|
-
const { backend, database,
|
|
2562
|
+
const { backend, database, dbSetup, webDeploy, serverDeploy, frontend } = config;
|
|
2526
2563
|
const isConvex = backend === "convex";
|
|
2527
|
-
const
|
|
2564
|
+
const dbSupport = getDbScriptSupport(config);
|
|
2565
|
+
const hasDatabase = dbSupport.hasDbScripts;
|
|
2528
2566
|
const isDocker = dbSetup === "docker";
|
|
2529
|
-
const isSqliteLocal = database === "sqlite" && dbSetup !== "d1";
|
|
2567
|
+
const isSqliteLocal = database === "sqlite" && dbSetup !== "d1" && hasDatabase;
|
|
2530
2568
|
const hasCloudflare = webDeploy === "cloudflare" || serverDeploy === "cloudflare";
|
|
2531
2569
|
return {
|
|
2532
2570
|
$schema: "https://turbo.build/schema.json",
|
|
@@ -2534,7 +2572,7 @@ function generateTurboConfig(config) {
|
|
|
2534
2572
|
tasks: {
|
|
2535
2573
|
...getBaseTasks(frontend),
|
|
2536
2574
|
...isConvex ? getConvexTasks() : {},
|
|
2537
|
-
...!isConvex && hasDatabase ? getDatabaseTasks() : {},
|
|
2575
|
+
...!isConvex && hasDatabase ? getDatabaseTasks(dbSupport) : {},
|
|
2538
2576
|
...isDocker ? getDockerTasks() : {},
|
|
2539
2577
|
...isSqliteLocal ? getSqliteLocalTask() : {},
|
|
2540
2578
|
...hasCloudflare ? getDeployTasks() : {}
|
|
@@ -2567,19 +2605,19 @@ function getConvexTasks() {
|
|
|
2567
2605
|
persistent: true
|
|
2568
2606
|
} };
|
|
2569
2607
|
}
|
|
2570
|
-
function getDatabaseTasks() {
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
"db:migrate": {
|
|
2578
|
-
cache: false,
|
|
2579
|
-
persistent: true
|
|
2580
|
-
},
|
|
2581
|
-
"db:generate": { cache: false }
|
|
2608
|
+
function getDatabaseTasks(dbSupport) {
|
|
2609
|
+
const tasks = {};
|
|
2610
|
+
if (dbSupport.hasDbPush) tasks["db:push"] = { cache: false };
|
|
2611
|
+
if (dbSupport.hasDbGenerate) tasks["db:generate"] = { cache: false };
|
|
2612
|
+
if (dbSupport.hasDbMigrate) tasks["db:migrate"] = {
|
|
2613
|
+
cache: false,
|
|
2614
|
+
persistent: true
|
|
2582
2615
|
};
|
|
2616
|
+
if (dbSupport.hasDbStudio) tasks["db:studio"] = {
|
|
2617
|
+
cache: false,
|
|
2618
|
+
persistent: true
|
|
2619
|
+
};
|
|
2620
|
+
return tasks;
|
|
2583
2621
|
}
|
|
2584
2622
|
function getDockerTasks() {
|
|
2585
2623
|
return {
|
|
@@ -3167,10 +3205,21 @@ async function processDeployTemplates(vfs, templates, config) {
|
|
|
3167
3205
|
|
|
3168
3206
|
//#endregion
|
|
3169
3207
|
//#region src/utils/reproducible-command.ts
|
|
3208
|
+
function normalizeMultiValues(values) {
|
|
3209
|
+
if (!values || values.length === 0) return [];
|
|
3210
|
+
const filtered = values.filter((value) => value !== "none");
|
|
3211
|
+
return Array.from(new Set(filtered));
|
|
3212
|
+
}
|
|
3213
|
+
function formatMultiFlag(flag, values) {
|
|
3214
|
+
if (values.length === 0) return `${flag} none`;
|
|
3215
|
+
return `${flag} ${values.join(" ")}`;
|
|
3216
|
+
}
|
|
3170
3217
|
function generateReproducibleCommand(config) {
|
|
3171
3218
|
const flags = [];
|
|
3172
|
-
|
|
3173
|
-
|
|
3219
|
+
const frontend = normalizeMultiValues(config.frontend);
|
|
3220
|
+
const addons = normalizeMultiValues(config.addons);
|
|
3221
|
+
const examples = normalizeMultiValues(config.examples);
|
|
3222
|
+
flags.push(formatMultiFlag("--frontend", frontend));
|
|
3174
3223
|
flags.push(`--backend ${config.backend}`);
|
|
3175
3224
|
flags.push(`--runtime ${config.runtime}`);
|
|
3176
3225
|
flags.push(`--database ${config.database}`);
|
|
@@ -3178,10 +3227,8 @@ function generateReproducibleCommand(config) {
|
|
|
3178
3227
|
flags.push(`--api ${config.api}`);
|
|
3179
3228
|
flags.push(`--auth ${config.auth}`);
|
|
3180
3229
|
flags.push(`--payments ${config.payments}`);
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
if (config.examples && config.examples.length > 0) flags.push(`--examples ${config.examples.join(" ")}`);
|
|
3184
|
-
else flags.push("--examples none");
|
|
3230
|
+
flags.push(formatMultiFlag("--addons", addons));
|
|
3231
|
+
flags.push(formatMultiFlag("--examples", examples));
|
|
3185
3232
|
flags.push(`--db-setup ${config.dbSetup}`);
|
|
3186
3233
|
flags.push(`--web-deploy ${config.webDeploy}`);
|
|
3187
3234
|
flags.push(`--server-deploy ${config.serverDeploy}`);
|