create-craftjs 1.0.15 → 2.0.0

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/README.md CHANGED
@@ -63,6 +63,7 @@ npm install
63
63
  node craft key:generate
64
64
  node craft db:generate
65
65
  node craft db:migrate
66
+ node craft db:seed
66
67
  node craft dev
67
68
  ```
68
69
 
@@ -79,32 +80,37 @@ node craft help
79
80
  ```
80
81
  my-app/
81
82
  ├── craft/
83
+ ├── logs/
84
+ ├── prisma/
85
+ ├── public/
82
86
  ├── src/
83
87
  │ ├── apidocs/
84
88
  │ ├── config/
85
89
  │ ├── controllers/
90
+ │ ├── dtos/
86
91
  │ ├── middleware/
87
92
  │ ├── repositories/
88
- │ ├── dtos/
89
93
  │ ├── routes/
90
94
  │ └── services/
91
95
  │ └── types/
92
96
  │ └── utils/
93
97
  │ └── validations/
98
+ │ └── views/
94
99
  │ └── main.ts
100
+ ├── temp/
95
101
  ├── test/
96
- ├── logs/
97
- ├── docker-compose.yml
98
- ├── Dockerfile
99
102
  ├── .env
100
103
  ├── .env.example
101
- ├── prisma/
102
104
  ├── .gitignore
103
105
  ├── babel.config.json
104
106
  ├── craft.js
107
+ ├── docker-compose.yml
108
+ ├── Dockerfile
105
109
  ├── nodemon.json
106
- ├── package.json
107
110
  ├── package-lock.json
111
+ ├── package.json
112
+ ├── prisma.config.ts
113
+ ├── README.md
108
114
  └── tsconfig.json
109
115
  ```
110
116
 
@@ -122,6 +128,7 @@ my-app/
122
128
  | `craft db:generate` | Generate Prisma client |
123
129
  | `craft db:migrate` | Run Prisma migrations |
124
130
  | `craft db:reset` | Run Prisma migrations refresh |
131
+ | `craft db:seed` | Run Prisma Seeder |
125
132
  | `craft key:generate` | Generate secret keys |
126
133
  | `craft make:controller` | Make Controller File |
127
134
  | `craft make:command` | Make Command File |
package/bin/index.js CHANGED
@@ -82,12 +82,18 @@ const ask = (question) => {
82
82
 
83
83
  const envContent = `APP_NAME="${projectName}"
84
84
  APP_SECRET=
85
+ BASE_URL="http://localhost:4444"
86
+ BASE_API_URL="http://localhost:4444/api"
85
87
  NODE_ENV="development"
86
88
  TZ="Asia/Jakarta"
87
89
  DATETIME_FORMAT="dd-MM-yyyy HH:mm:ss"
88
90
  DATABASE_URL="mysql://root:@localhost:3306/${projectName}"
89
- BASE_URL="http://localhost:4444"
90
- BASE_API_URL="http://localhost:4444/api"
91
+ DATABASE_USER="root"
92
+ DATABASE_PASSWORD=""
93
+ DATABASE_NAME="${projectName}"
94
+ DATABASE_HOST="localhost"
95
+ DATABASE_PORT=3306
96
+ DATABASE_CONNECTION_LIMIT=5
91
97
  PORT=4444
92
98
  JWT_SECRET=
93
99
  COOKIE_ENCRYPTION_KEY=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-craftjs",
3
- "version": "1.0.15",
3
+ "version": "2.0.0",
4
4
  "description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
5
5
  "bin": {
6
6
  "create-craftjs": "bin/index.js"
@@ -0,0 +1,22 @@
1
+ const { spawnSync } = require("child_process");
2
+ const chalk = require("chalk");
3
+
4
+ function DbSeed() {
5
+ console.log(chalk.blue("🚀 Running prisma seeder..."));
6
+
7
+ const result = spawnSync("npx", ["prisma", "db", "seed"], {
8
+ stdio: "inherit",
9
+ shell: true,
10
+ });
11
+
12
+ if (result.status !== 0) {
13
+ console.error(chalk.red("❌ Seeder failed."));
14
+ if (result.error) {
15
+ console.error(chalk.red(`Error: ${result.error.message}`));
16
+ }
17
+ process.exit(result.status ?? 1);
18
+ } else {
19
+ console.log(chalk.green("✅ Seeding completed."));
20
+ }
21
+ }
22
+ module.exports = DbSeed;
package/template/craft.js CHANGED
@@ -22,6 +22,15 @@ yargs(hideBin(process.argv))
22
22
  dbgenerate();
23
23
  }
24
24
  )
25
+ .command(
26
+ "db:seed",
27
+ "Running prisma db seed",
28
+ () => {},
29
+ () => {
30
+ const dbgenerate = require("./craft/commands/db-seed.js");
31
+ dbgenerate();
32
+ }
33
+ )
25
34
  .command(
26
35
  "db:migrate",
27
36
  "Running prisma migration",
@@ -241,7 +250,7 @@ yargs(hideBin(process.argv))
241
250
  start();
242
251
  }
243
252
  )
244
- .command(
253
+ .command(
245
254
  "build:docker",
246
255
  "Docker build for production",
247
256
  () => {},