nestjs-with-auth 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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,13 +8,7 @@ program
|
|
|
8
8
|
.action(async (projectName) => {
|
|
9
9
|
console.log(chalk.blue(`Creating ${projectName}...\n`));
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
// const choices = await getUserChoices();
|
|
13
|
-
//
|
|
14
|
-
// if (!choices.database || !choices.orm) {
|
|
15
|
-
// console.log(chalk.red('Setup cancelled'));
|
|
16
|
-
// process.exit(1);
|
|
17
|
-
// }
|
|
11
|
+
await setupProject(projectName);
|
|
18
12
|
|
|
19
13
|
console.log(chalk.green(`\n✅ Project ${projectName} created successfully!`));
|
|
20
14
|
console.log(chalk.blue(`\nNext steps:`));
|
package/src/setup.js
CHANGED
|
@@ -12,44 +12,4 @@ async function setupProject(projectName) {
|
|
|
12
12
|
return targetPath;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async function generateOrmConfig(targetPath) {
|
|
16
|
-
// Create prisma schema
|
|
17
|
-
const prismaDir = path.join(targetPath, 'prisma');
|
|
18
|
-
await fs.ensureDir(prismaDir);
|
|
19
|
-
|
|
20
|
-
const schemaContent = `
|
|
21
|
-
datasource db {
|
|
22
|
-
provider = "postgresql"
|
|
23
|
-
url = env("DATABASE_URL")
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
generator client {
|
|
27
|
-
provider = "prisma-client-js"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
model User {
|
|
31
|
-
id Int @id @default(autoincrement())
|
|
32
|
-
email String @unique
|
|
33
|
-
password String
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const prismaConfigContent = `
|
|
38
|
-
import 'dotenv/config';
|
|
39
|
-
import { defineConfig, env } from 'prisma/config';
|
|
40
|
-
|
|
41
|
-
export default defineConfig({
|
|
42
|
-
schema: 'prisma/schema.prisma',
|
|
43
|
-
migrations: {
|
|
44
|
-
path: 'prisma/migrations',
|
|
45
|
-
},
|
|
46
|
-
engine: 'classic',
|
|
47
|
-
datasource: {
|
|
48
|
-
url: env('DATABASE_URL'),
|
|
49
|
-
},
|
|
50
|
-
});`
|
|
51
|
-
await fs.writeFile(path.join(prismaDir, 'schema.prisma'), schemaContent.trim());
|
|
52
|
-
await fs.writeFile(path.join(targetPath, 'prisma.config.ts'), prismaConfigContent.trim());
|
|
53
|
-
}
|
|
54
|
-
|
|
55
15
|
module.exports = {setupProject};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "User" (
|
|
3
|
-
"id" UUID NOT NULL,
|
|
4
|
-
"email" TEXT NOT NULL,
|
|
5
|
-
"username" TEXT,
|
|
6
|
-
"passwordHash" TEXT NOT NULL,
|
|
7
|
-
|
|
8
|
-
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
-- CreateIndex
|
|
12
|
-
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|