@dartix-software-solutions/create-fullstack-app 2.0.13 → 2.0.14
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/bin/create-fullstack-app.js +1 -1
- package/dist/{chunk-Z7MIDMEN.js → chunk-JQDTKR4K.js} +16 -10
- package/dist/index.js +1 -1
- package/dist/orms/prisma/file-map.js +1 -0
- package/dist/orms/prisma/meta.js +5 -2
- package/dist/orms/prisma/templates/db-client.ts.hbs +10 -1
- package/dist/orms/prisma/templates/prisma.config.ts.hbs +12 -0
- package/dist/orms/prisma/templates/prisma.service.ts.hbs +11 -0
- package/dist/orms/prisma/templates/schema.prisma.hbs +0 -1
- package/package.json +1 -1
|
@@ -1970,9 +1970,12 @@ var SingleAppLayout = class {
|
|
|
1970
1970
|
if (isFullstack) {
|
|
1971
1971
|
const feDir = context.hasMobile ? "mobile" : "client";
|
|
1972
1972
|
const scripts = {
|
|
1973
|
-
dev:
|
|
1974
|
-
|
|
1975
|
-
|
|
1973
|
+
"dev:client": `npm run dev --prefix ${feDir}`,
|
|
1974
|
+
"dev:server": "npm run dev --prefix server",
|
|
1975
|
+
"build:client": `npm run build --prefix ${feDir}`,
|
|
1976
|
+
"build:server": "npm run build --prefix server",
|
|
1977
|
+
"lint:client": `npm run lint --prefix ${feDir}`,
|
|
1978
|
+
"lint:server": "npm run lint --prefix server"
|
|
1976
1979
|
};
|
|
1977
1980
|
if (context.hasHusky) {
|
|
1978
1981
|
scripts.prepare = "husky";
|
|
@@ -1984,7 +1987,6 @@ var SingleAppLayout = class {
|
|
|
1984
1987
|
name: context.projectName,
|
|
1985
1988
|
version: "0.1.0",
|
|
1986
1989
|
private: true,
|
|
1987
|
-
workspaces: [feDir, "server"],
|
|
1988
1990
|
scripts
|
|
1989
1991
|
},
|
|
1990
1992
|
null,
|
|
@@ -2001,7 +2003,6 @@ var SingleAppLayout = class {
|
|
|
2001
2003
|
const isFullstack = hasFE && hasBE;
|
|
2002
2004
|
if (isFullstack) {
|
|
2003
2005
|
const feDir = context.hasMobile ? "mobile" : "client";
|
|
2004
|
-
targets.push({ path: "package.json", target: TARGETS.ROOT, name: context.projectName });
|
|
2005
2006
|
targets.push({
|
|
2006
2007
|
path: `${feDir}/package.json`,
|
|
2007
2008
|
target: TARGETS.FRONTEND,
|
|
@@ -3720,6 +3721,7 @@ async function runPostGenerate(outputDir, context, options) {
|
|
|
3720
3721
|
const [cmd, ...args] = installCmd.split(" ");
|
|
3721
3722
|
const installTargets = await getInstallTargets(outputDir, context);
|
|
3722
3723
|
try {
|
|
3724
|
+
let installCount = 0;
|
|
3723
3725
|
for (const target of installTargets) {
|
|
3724
3726
|
await withSpinner(
|
|
3725
3727
|
`Installing ${target.label} dependencies with ${context.packageManager}...`,
|
|
@@ -3731,8 +3733,9 @@ async function runPostGenerate(outputDir, context, options) {
|
|
|
3731
3733
|
},
|
|
3732
3734
|
`${target.label} dependencies installed`
|
|
3733
3735
|
);
|
|
3736
|
+
installCount += 1;
|
|
3734
3737
|
}
|
|
3735
|
-
installed =
|
|
3738
|
+
installed = installCount > 0;
|
|
3736
3739
|
} catch (error) {
|
|
3737
3740
|
logger.warn(`Failed to install dependencies: ${error.message}`);
|
|
3738
3741
|
logger.info(`You can run "${installCmd}" manually`);
|
|
@@ -3765,7 +3768,13 @@ function buildNextSteps(context, installed) {
|
|
|
3765
3768
|
steps.push(`Set up database: ${pm} run db:migrate && ${pm} run db:seed`);
|
|
3766
3769
|
}
|
|
3767
3770
|
}
|
|
3768
|
-
|
|
3771
|
+
if (context.isFullstack) {
|
|
3772
|
+
const feDir = context.hasMobile ? "mobile" : "client";
|
|
3773
|
+
steps.push(`Start frontend: ${pm} run dev --prefix ${feDir}`);
|
|
3774
|
+
steps.push(`Start backend: ${pm} run dev --prefix server`);
|
|
3775
|
+
} else {
|
|
3776
|
+
steps.push(`Start development: ${pm} run dev`);
|
|
3777
|
+
}
|
|
3769
3778
|
if (context.hasMobile) {
|
|
3770
3779
|
steps.push("Run on device: Press 'i' for iOS, 'a' for Android, or scan QR code");
|
|
3771
3780
|
}
|
|
@@ -3781,9 +3790,6 @@ async function getInstallTargets(outputDir, context) {
|
|
|
3781
3790
|
cwd: dir
|
|
3782
3791
|
});
|
|
3783
3792
|
}
|
|
3784
|
-
if (targets.length === 0) {
|
|
3785
|
-
targets.push({ label: "project", cwd: outputDir });
|
|
3786
|
-
}
|
|
3787
3793
|
return targets;
|
|
3788
3794
|
}
|
|
3789
3795
|
async function runBootstrapScripts(outputDir, context) {
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
var fileMap = {
|
|
3
3
|
files: [
|
|
4
4
|
{ template: "schema.prisma.hbs", outputPath: "prisma/schema.prisma", target: "backend" },
|
|
5
|
+
{ template: "prisma.config.ts.hbs", outputPath: "prisma.config.ts", target: "backend" },
|
|
5
6
|
{ template: "seed.ts.hbs", outputPath: "prisma/seed.ts", target: "backend" },
|
|
6
7
|
{ template: "db-client.ts.hbs", outputPath: "src/lib/db.ts", target: "backend" },
|
|
7
8
|
{ template: "models/user.ts.hbs", outputPath: "src/models/user.ts", target: "backend" },
|
package/dist/orms/prisma/meta.js
CHANGED
|
@@ -5,9 +5,12 @@ var meta = {
|
|
|
5
5
|
description: "Type-safe ORM with auto-generated client, migrations, and studio",
|
|
6
6
|
category: "orm",
|
|
7
7
|
platformSupport: "backend-only",
|
|
8
|
-
deps: [
|
|
8
|
+
deps: [
|
|
9
|
+
{ name: "@prisma/client", version: "^7.7.0" },
|
|
10
|
+
{ name: "@prisma/adapter-pg", version: "^7.7.0" }
|
|
11
|
+
],
|
|
9
12
|
devDeps: [
|
|
10
|
-
{ name: "prisma", version: "^
|
|
13
|
+
{ name: "prisma", version: "^7.7.0" },
|
|
11
14
|
{ name: "tsx", version: "^4.19.0" }
|
|
12
15
|
],
|
|
13
16
|
envVars: [],
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { PrismaClient } from '@prisma/client';
|
|
2
|
+
{{#if hasPostgres}}
|
|
3
|
+
import { PrismaPg } from '@prisma/adapter-pg';
|
|
4
|
+
{{/if}}
|
|
2
5
|
|
|
3
6
|
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined };
|
|
4
7
|
|
|
5
|
-
export const prisma =
|
|
8
|
+
export const prisma =
|
|
9
|
+
globalForPrisma.prisma ??
|
|
10
|
+
new PrismaClient({
|
|
11
|
+
{{#if hasPostgres}}
|
|
12
|
+
adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL ?? '' }),
|
|
13
|
+
{{/if}}
|
|
14
|
+
});
|
|
6
15
|
|
|
7
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
8
17
|
globalForPrisma.prisma = prisma;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
2
2
|
import { PrismaClient } from '@prisma/client';
|
|
3
|
+
{{#if hasPostgres}}
|
|
4
|
+
import { PrismaPg } from '@prisma/adapter-pg';
|
|
5
|
+
{{/if}}
|
|
3
6
|
|
|
4
7
|
@Injectable()
|
|
5
8
|
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
{{#if hasPostgres}}
|
|
12
|
+
adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL ?? '' }),
|
|
13
|
+
{{/if}}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
6
17
|
async onModuleInit(): Promise<void> {
|
|
7
18
|
await this.$connect();
|
|
8
19
|
}
|