create-init-mtv-app 1.0.1 → 1.0.2
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.mjs +28 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -382,6 +382,30 @@ const config: Config = {
|
|
|
382
382
|
export default config;
|
|
383
383
|
`.trimStart();
|
|
384
384
|
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/setups/docker_postges.ts
|
|
387
|
+
async function setupDockerPostgres(projectName) {
|
|
388
|
+
const dockerComposePath = path.join(projectName, "docker-compose.yml");
|
|
389
|
+
await fs.ensureFile(dockerComposePath);
|
|
390
|
+
await fs.writeFile(dockerComposePath, dockerComposeTemplate);
|
|
391
|
+
}
|
|
392
|
+
const dockerComposeTemplate = `
|
|
393
|
+
version: '3'
|
|
394
|
+
services:
|
|
395
|
+
postgres:
|
|
396
|
+
image: postgres:17
|
|
397
|
+
ports:
|
|
398
|
+
- 5432:5432
|
|
399
|
+
environment:
|
|
400
|
+
- POSTGRES_USER=postgres
|
|
401
|
+
- POSTGRES_PASSWORD=postgres
|
|
402
|
+
- POSTGRES_DB=postgres
|
|
403
|
+
volumes:
|
|
404
|
+
- postgres_data:/var/lib/postgresql/data
|
|
405
|
+
volumes:
|
|
406
|
+
postgres_data:
|
|
407
|
+
`;
|
|
408
|
+
|
|
385
409
|
//#endregion
|
|
386
410
|
//#region src/create.ts
|
|
387
411
|
async function createProject(answers) {
|
|
@@ -389,7 +413,6 @@ async function createProject(answers) {
|
|
|
389
413
|
switch (framework) {
|
|
390
414
|
case FRAMEWORKS.NEXT: {
|
|
391
415
|
await createNextApp(projectName);
|
|
392
|
-
const isSupabase = dbProvider === DB_PROVIDERS.SUPABASE;
|
|
393
416
|
const dependencies = [
|
|
394
417
|
"react-hook-form",
|
|
395
418
|
"@hookform/resolvers",
|
|
@@ -403,7 +426,7 @@ async function createProject(answers) {
|
|
|
403
426
|
"@types/jest",
|
|
404
427
|
"ts-jest"
|
|
405
428
|
];
|
|
406
|
-
if (
|
|
429
|
+
if (dbProvider === DB_PROVIDERS.SUPABASE) dependencies.push("@supabase/ssr", "@supabase/supabase-js");
|
|
407
430
|
if (dbTool === DB_TOOLS.DRIZZLE_ORM) {
|
|
408
431
|
dependencies.push("drizzle-orm", "postgres");
|
|
409
432
|
devDependencies.push("drizzle-kit");
|
|
@@ -411,8 +434,9 @@ async function createProject(answers) {
|
|
|
411
434
|
await installDependencies(projectName, dependencies);
|
|
412
435
|
await installDevDependencies(projectName, devDependencies);
|
|
413
436
|
await setupHuskyLintStaged(projectName);
|
|
414
|
-
await setupNextEnv(projectName,
|
|
415
|
-
if (
|
|
437
|
+
await setupNextEnv(projectName, dbProvider === DB_PROVIDERS.SUPABASE);
|
|
438
|
+
if (dbProvider === DB_PROVIDERS.SUPABASE) await setupNextSupabaseClient(projectName);
|
|
439
|
+
if (dbProvider === DB_PROVIDERS.DOCKER) await setupDockerPostgres(projectName);
|
|
416
440
|
if (dbTool === DB_TOOLS.SUPABASE_JS_SDK) await setupNextSupabaseLocal(projectName);
|
|
417
441
|
if (dbTool === DB_TOOLS.DRIZZLE_ORM) await setupDrizzle(projectName);
|
|
418
442
|
if (uiLibrary === UI_LIB.SHADCN) await setupShadcn(projectName);
|