nestjs-prisma-cli 1.0.7 → 1.0.8
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/bin/index.js +2 -2
- package/package.json +6 -1
- package/template/prisma/seed.ts +12 -8
package/bin/index.js
CHANGED
|
@@ -106,7 +106,7 @@ async function main() {
|
|
|
106
106
|
const projectPath = path.join(process.cwd(), projectName);
|
|
107
107
|
|
|
108
108
|
if (fs.existsSync(projectPath)) {
|
|
109
|
-
console.log(chalk.red(
|
|
109
|
+
console.log(chalk.red(`Folder "${projectName}" already exists!`));
|
|
110
110
|
process.exit(1);
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -221,6 +221,6 @@ PORT=3000
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
main().catch((err) => {
|
|
224
|
-
console.error(chalk.red("
|
|
224
|
+
console.error(chalk.red("Error:"), err);
|
|
225
225
|
process.exit(1);
|
|
226
226
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-prisma-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "A CLI to generate NestJS + Prisma project boilerplate with Swagger, Auth, and AWS S3 setup",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"start": "node ./bin/index.js",
|
|
16
16
|
"test": "echo \"No tests specified\" && exit 0"
|
|
17
17
|
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/kyawsoe-dev/nestjs-generator-cli.git"
|
|
21
|
+
},
|
|
18
22
|
"keywords": [
|
|
19
23
|
"nestjs",
|
|
20
24
|
"nestjs-generator",
|
|
@@ -24,6 +28,7 @@
|
|
|
24
28
|
],
|
|
25
29
|
"author": "Kyaw Soe",
|
|
26
30
|
"license": "MIT",
|
|
31
|
+
"homepage": "https://github.com/kyawsoe-dev/nestjs-generator-cli/blob/main/README.md",
|
|
27
32
|
"dependencies": {
|
|
28
33
|
"chalk": "^4.1.2",
|
|
29
34
|
"execa": "^9.6.0",
|
package/template/prisma/seed.ts
CHANGED
|
@@ -6,17 +6,21 @@ const prisma = new PrismaClient();
|
|
|
6
6
|
async function main() {
|
|
7
7
|
const hashedPassword = await argon2.hash("Asdfasdf@123");
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const existing = await prisma.user.findUnique({
|
|
10
10
|
where: { userId: "USER_20250815001" },
|
|
11
|
-
update: {},
|
|
12
|
-
create: {
|
|
13
|
-
userId: "USER_20250815001",
|
|
14
|
-
name: "Kyaw Soe",
|
|
15
|
-
email: "kyawsoe@gmail.com",
|
|
16
|
-
password: hashedPassword,
|
|
17
|
-
},
|
|
18
11
|
});
|
|
19
12
|
|
|
13
|
+
if (!existing) {
|
|
14
|
+
await prisma.user.create({
|
|
15
|
+
data: {
|
|
16
|
+
userId: "USER_20250815001",
|
|
17
|
+
name: "Kyaw Soe",
|
|
18
|
+
email: "kyawsoe@gmail.com",
|
|
19
|
+
password: hashedPassword,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
console.log("Seeded Successfully.");
|
|
21
25
|
}
|
|
22
26
|
|