adminforth 2.54.0-next.2 → 2.54.0-next.4

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.
@@ -11,9 +11,11 @@
11
11
  "dev": "{{packageManagerEnvDev}} tsx watch index.ts",
12
12
  "prod": "{{packageManagerEnvProd}} tsx index.ts",
13
13
  "start": "{{packageManagerRun}} dev",
14
+ {{#if includePrismaMigrations}}
14
15
  "makemigration": "{{packageManagerEnvDev}} npx --yes prisma migrate dev --create-only",
15
16
  "migrate:local": "{{packageManagerEnvDev}} npx --yes prisma migrate deploy",
16
17
  "migrate:prod": "{{packageManagerEnvProd}} npx --yes prisma migrate deploy",
18
+ {{/if}}
17
19
  "_env:dev": "dotenvx run -f .env -f .env.local --",
18
20
  "_env:prod": "dotenvx run -f .env.prod --"
19
21
  },
@@ -27,7 +29,7 @@
27
29
  "zod": "^4.3.6"
28
30
  },
29
31
  "devDependencies": {
30
- "typescript": "5.4.5",
32
+ "typescript": "6.0.3",
31
33
  "tsx": "4.11.2",
32
34
  "@types/express": "^4.17.21",
33
35
  "@types/node": "latest",
@@ -56,6 +56,7 @@ export function parseArgumentsIntoOptions(rawArgs) {
56
56
  appName: args['--app-name'],
57
57
  db: args['--db'],
58
58
  useNpm: args['--use-npm'],
59
+ includePrismaMigrations: args['--include-prisma-migrations'],
59
60
  };
60
61
  }
61
62
 
@@ -93,12 +94,27 @@ export async function promptForMissingOptions(options) {
93
94
  });
94
95
  }
95
96
 
97
+ if (!options.includePrismaMigrations) {
98
+ questions.push({
99
+ type: 'select',
100
+ name: 'includePrismaMigrations',
101
+ message: 'Include Prisma migrations? >',
102
+ choices: [
103
+ { name: 'Yes', value: true },
104
+ { name: 'No', value: false },
105
+ ],
106
+ default: true,
107
+ });
108
+
109
+ }
110
+
96
111
  const answers = await inquirer.prompt(questions);
97
112
  return {
98
113
  ...options,
99
114
  appName: options.appName || answers.appName,
100
115
  db: options.db || answers.db,
101
116
  useNpm: options.useNpm || answers.useNpm,
117
+ includePrismaMigrations: options.includePrismaMigrations || answers.includePrismaMigrations,
102
118
  };
103
119
  }
104
120
 
@@ -246,7 +262,7 @@ async function scaffoldProject(ctx, options, cwd) {
246
262
  await fse.copy(sourceAssetsDir, targetAssetsDir);
247
263
 
248
264
  // Write templated files
249
- await writeTemplateFiles(dirname, projectDir, options.useNpm, {
265
+ await writeTemplateFiles(dirname, projectDir, options.useNpm, options.includePrismaMigrations, {
250
266
  dbUrl: connectionString.toString(),
251
267
  dbUrlProd: connectionStringProd,
252
268
  prismaDbUrl,
@@ -274,7 +290,7 @@ function getPackageManagerTemplateData(useNpm, nodeMajor) {
274
290
  };
275
291
  }
276
292
 
277
- async function writeTemplateFiles(dirname, cwd, useNpm, options) {
293
+ async function writeTemplateFiles(dirname, cwd, useNpm, includePrismaMigrations, options) {
278
294
  const {
279
295
  dbUrl, prismaDbUrl, appName, provider, nodeMajor,
280
296
  dbUrlProd, prismaDbUrlProd, sqliteFile
@@ -288,17 +304,6 @@ async function writeTemplateFiles(dirname, cwd, useNpm, options) {
288
304
  dest: 'tsconfig.json',
289
305
  data: {},
290
306
  },
291
- {
292
- src: 'schema.prisma.hbs',
293
- dest: 'schema.prisma',
294
- data: { provider },
295
- condition: Boolean(prismaDbUrl), // only create if prismaDbUrl is truthy
296
- },
297
- {
298
- src: 'prisma.config.ts.hbs',
299
- dest: 'prisma.config.ts',
300
- data: {},
301
- },
302
307
  {
303
308
  src: 'index.ts.hbs',
304
309
  dest: 'index.ts',
@@ -393,6 +398,7 @@ async function writeTemplateFiles(dirname, cwd, useNpm, options) {
393
398
  data: {
394
399
  appName,
395
400
  adminforthVersion: adminforthVersion,
401
+ includePrismaMigrations,
396
402
  },
397
403
  },
398
404
  {
@@ -417,6 +423,22 @@ async function writeTemplateFiles(dirname, cwd, useNpm, options) {
417
423
  )
418
424
  }
419
425
 
426
+ if (includePrismaMigrations) {
427
+ templateTasks.push(
428
+ {
429
+ src: 'schema.prisma.hbs',
430
+ dest: 'schema.prisma',
431
+ data: { provider },
432
+ condition: Boolean(prismaDbUrl), // only create if prismaDbUrl is truthy
433
+ },
434
+ {
435
+ src: 'prisma.config.ts.hbs',
436
+ dest: 'prisma.config.ts',
437
+ data: {},
438
+ },
439
+ )
440
+ }
441
+
420
442
  for (const task of templateTasks) {
421
443
  // If a condition is specified and false, skip this file
422
444
  if (task.condition === false) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.54.0-next.2",
3
+ "version": "2.54.0-next.4",
4
4
  "description": "OpenSource Agent-Native forth-generation admin panel",
5
5
  "keywords": [
6
6
  "adminforth",