nextjs-cms 0.9.12 → 0.9.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.
@@ -1 +1 @@
1
- {"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update-sections.ts"],"names":[],"mappings":"AAGA,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,iBAsBnD"}
1
+ {"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update-sections.ts"],"names":[],"mappings":"AAGA,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,iBAuBnD"}
@@ -15,7 +15,8 @@ export async function runUpdateSections(dev) {
15
15
  }
16
16
  catch (error) {
17
17
  p.log.error(chalk.red('✗ Error updating sections:'));
18
- console.error(error);
18
+ console.error(chalk.red(error.message ?? error));
19
+ console.log(''); // Add a new line for better readability
19
20
  exitCode = 1;
20
21
  }
21
22
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/update-sections.ts"],"names":[],"mappings":"AAkyCA,wBAAsB,cAAc,CAAC,SAAS,UAAQ,iBAoBrD"}
1
+ {"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/update-sections.ts"],"names":[],"mappings":"AA4wCA,wBAAsB,cAAc,CAAC,SAAS,UAAQ,iBAoBrD"}
@@ -31,10 +31,7 @@ function generateFieldSQL(input) {
31
31
  if (is(input, DateRangeField)) {
32
32
  const colType = input.format === 'datetime' ? 'DATETIME' : 'DATE';
33
33
  const nullable = ' DEFAULT NULL';
34
- return [
35
- `\`${input.startName}\` ${colType}${nullable}`,
36
- `\`${input.endName}\` ${colType}${nullable}`,
37
- ];
34
+ return [`\`${input.startName}\` ${colType}${nullable}`, `\`${input.endName}\` ${colType}${nullable}`];
38
35
  }
39
36
  let fieldSQL = `\`${input.name}\` `;
40
37
  /**
@@ -198,6 +195,57 @@ function generateFieldSQL(input) {
198
195
  }
199
196
  return fieldSQL;
200
197
  }
198
+ function resolveCreateTableOptions(sectionType) {
199
+ switch (sectionType) {
200
+ case 'simple':
201
+ return {
202
+ createdAt: false,
203
+ updatedAt: true,
204
+ createdBy: false,
205
+ updatedBy: true,
206
+ };
207
+ case 'gallery':
208
+ return {
209
+ updatedBy: false,
210
+ updatedAt: false,
211
+ createdBy: true,
212
+ createdAt: true,
213
+ };
214
+ case 'destinationDb':
215
+ case 'locales':
216
+ return {
217
+ createdAt: true,
218
+ updatedAt: true,
219
+ createdBy: false,
220
+ updatedBy: false,
221
+ };
222
+ default:
223
+ return {
224
+ createdAt: true,
225
+ updatedAt: true,
226
+ createdBy: true,
227
+ updatedBy: true,
228
+ };
229
+ }
230
+ }
231
+ async function ensureTableRegistryEntry(tableName, sectionName) {
232
+ await db
233
+ .insert(NextJsCmsTablesTable)
234
+ .values({
235
+ tableName,
236
+ sectionName,
237
+ })
238
+ .catch((error) => {
239
+ const isDuplicateEntry = typeof error === 'object' &&
240
+ error !== null &&
241
+ 'code' in error &&
242
+ error.code === 'ER_DUP_ENTRY';
243
+ if (isDuplicateEntry) {
244
+ return;
245
+ }
246
+ console.error('Error inserting into __nextjs_cms_tables table:', error);
247
+ });
248
+ }
201
249
  async function createTable(table, options) {
202
250
  /**
203
251
  * Generate the CREATE TABLE SQL
@@ -268,15 +316,7 @@ async function createTable(table, options) {
268
316
  /**
269
317
  * Insert the table name into the `__nextjs_cms_tables` table
270
318
  */
271
- await db
272
- .insert(NextJsCmsTablesTable)
273
- .values({
274
- tableName: table.name,
275
- sectionName: table.sectionName,
276
- })
277
- .catch((error) => {
278
- console.error('Error inserting into __nextjs_cms_tables table:', error);
279
- });
319
+ await ensureTableRegistryEntry(table.name, table.sectionName);
280
320
  }
281
321
  catch (error) {
282
322
  console.log(chalk.red(` - Error creating table \`${table.name}\`:`, error));
@@ -533,8 +573,8 @@ async function updateTable(table, s) {
533
573
  else {
534
574
  log.info(chalk.yellow(`- Field ${chalk.underline.italic(field)} not removed.`));
535
575
  }
536
- s.start();
537
576
  }
577
+ s.start();
538
578
  }
539
579
  /**
540
580
  * Execute ALTER TABLE statements
@@ -574,20 +614,10 @@ const main = async (s) => {
574
614
  const schemaFileName = cmsConfig.schemaGeneration.drizzle.fileName;
575
615
  const schemaFilePath = path.join(schemaOutDir, schemaFileName);
576
616
  /**
577
- * Remove the existing schema file
617
+ * Prepare schema generation.
618
+ * We intentionally keep the existing schema file in place until we are ready to write the new one.
578
619
  */
579
620
  if (schemaGenerationEnabled) {
580
- console.log(chalk.white(`Removing existing schema file...`));
581
- s.start();
582
- try {
583
- if (fs.existsSync(schemaFilePath)) {
584
- fs.unlinkSync(schemaFilePath);
585
- }
586
- }
587
- catch (error) {
588
- console.error('Error removing schema file:', error);
589
- }
590
- s.stop();
591
621
  console.log(chalk.white(`Generating Drizzle schema...`));
592
622
  s.start();
593
623
  }
@@ -605,10 +635,15 @@ const main = async (s) => {
605
635
  console.log(chalk.gray(sections.map((s) => s.name).join(', ')));
606
636
  /**
607
637
  * Let's see if the table `__nextjs_cms_tables` exists in the database.
608
- * If it doesn't, we'll create it.
609
- * It has two fields: `name` and `created_at`.
638
+ * If it doesn't, we'll create it using the same schema as `NextJsCmsTablesTable`.
610
639
  */
611
- await db.execute(sql ` CREATE TABLE IF NOT EXISTS __nextjs_cms_tables ( name VARCHAR(100) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) `);
640
+ await db.execute(sql `
641
+ CREATE TABLE IF NOT EXISTS __nextjs_cms_tables (
642
+ name VARCHAR(100) NOT NULL PRIMARY KEY,
643
+ section VARCHAR(200),
644
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
645
+ )
646
+ `);
612
647
  /**
613
648
  * Get the existing tables from the database
614
649
  */
@@ -856,13 +891,13 @@ const main = async (s) => {
856
891
  fs.mkdirSync(schemaOutDir, { recursive: true });
857
892
  }
858
893
  /**
859
- * Append the Drizzle imports to the schema file
860
- */
861
- fs.appendFileSync(schemaFilePath, 'import {' + [...drizzleImports].join(',') + "} from 'drizzle-orm/mysql-core'\n\n");
862
- /**
863
- * Append the Drizzle table schemas to the schema file
894
+ * Overwrite the schema only when generation is ready, so failed runs do not delete the previous schema.
864
895
  */
865
- fs.appendFileSync(schemaFilePath, drizzleTableSchemas.join('\n'));
896
+ const schemaFileContent = 'import {' +
897
+ [...drizzleImports].join(',') +
898
+ "} from 'drizzle-orm/mysql-core'\n\n" +
899
+ drizzleTableSchemas.join('\n');
900
+ fs.writeFileSync(schemaFilePath, schemaFileContent, 'utf8');
866
901
  s.stop();
867
902
  }
868
903
  console.log(chalk.white('Finding tables to create, update or remove...'));
@@ -914,6 +949,26 @@ const main = async (s) => {
914
949
  * Loop through the tables to create
915
950
  */
916
951
  for (const table of tablesToCreate) {
952
+ const tableExistsInDatabase = (await MysqlTableChecker.getExistingTableStructure(table.name)) !== null;
953
+ if (tableExistsInDatabase) {
954
+ s.stop();
955
+ const overwriteExistingTable = await select({
956
+ message: `Table '${table.name}' already exists in your database, overwrite its fields if any?`,
957
+ options: [
958
+ { value: 'yes', label: 'Yes, overwrite fields' },
959
+ { value: 'no', label: 'No, skip for now' },
960
+ ],
961
+ initialValue: 'yes',
962
+ });
963
+ if (overwriteExistingTable === 'yes') {
964
+ await ensureTableRegistryEntry(table.name, table.sectionName);
965
+ await updateTable(table, s);
966
+ }
967
+ else {
968
+ console.log(chalk.yellow(`Skipping existing table '${table.name}'.`));
969
+ }
970
+ continue;
971
+ }
917
972
  /**
918
973
  * Check if there are tables to remove
919
974
  * If there are, ask the user if they want to create the new table or rename a removed table
@@ -931,44 +986,7 @@ const main = async (s) => {
931
986
  switch (opType) {
932
987
  case 'new': {
933
988
  console.log(chalk.blueBright(`Creating table '${table.name}' for section '${table.sectionName}'`));
934
- let options = {
935
- createdAt: true,
936
- updatedAt: true,
937
- createdBy: true,
938
- updatedBy: true,
939
- };
940
- if (table.sectionType === 'simple') {
941
- options = {
942
- createdAt: false,
943
- updatedAt: true,
944
- createdBy: false,
945
- updatedBy: true,
946
- };
947
- }
948
- if (table.sectionType === 'gallery') {
949
- options = {
950
- updatedBy: false,
951
- updatedAt: false,
952
- createdBy: true,
953
- createdAt: true,
954
- };
955
- }
956
- if (table.sectionType === 'destinationDb') {
957
- options = {
958
- createdAt: true,
959
- updatedAt: true,
960
- createdBy: false,
961
- updatedBy: false,
962
- };
963
- }
964
- if (table.sectionType === 'locales') {
965
- options = {
966
- createdAt: true,
967
- updatedAt: true,
968
- createdBy: false,
969
- updatedBy: false,
970
- };
971
- }
989
+ const options = resolveCreateTableOptions(table.sectionType);
972
990
  await createTable(table, options);
973
991
  break;
974
992
  }
@@ -980,7 +998,6 @@ const main = async (s) => {
980
998
  return { value: table.name, label: table.name };
981
999
  }),
982
1000
  });
983
- s.start();
984
1001
  if (tableToRename && typeof tableToRename === 'string') {
985
1002
  console.log(`Renaming table '${tableToRename}' to '${table.name}'`);
986
1003
  await renameTable(tableToRename, table.name);
@@ -1003,44 +1020,7 @@ const main = async (s) => {
1003
1020
  })
1004
1021
  ) {*/
1005
1022
  console.log(chalk.blueBright(`Creating table '${table.name}' for section '${table.sectionName}'`));
1006
- let options = {
1007
- createdAt: true,
1008
- updatedAt: true,
1009
- createdBy: true,
1010
- updatedBy: true,
1011
- };
1012
- if (table.sectionType === 'simple') {
1013
- options = {
1014
- createdAt: false,
1015
- updatedAt: true,
1016
- createdBy: false,
1017
- updatedBy: true,
1018
- };
1019
- }
1020
- if (table.sectionType === 'gallery') {
1021
- options = {
1022
- updatedBy: false,
1023
- updatedAt: false,
1024
- createdBy: true,
1025
- createdAt: true,
1026
- };
1027
- }
1028
- if (table.sectionType === 'destinationDb') {
1029
- options = {
1030
- createdAt: true,
1031
- updatedAt: true,
1032
- createdBy: false,
1033
- updatedBy: false,
1034
- };
1035
- }
1036
- if (table.sectionType === 'locales') {
1037
- options = {
1038
- createdAt: true,
1039
- updatedAt: true,
1040
- createdBy: false,
1041
- updatedBy: false,
1042
- };
1043
- }
1023
+ const options = resolveCreateTableOptions(table.sectionType);
1044
1024
  await createTable(table, options);
1045
1025
  /*} else {
1046
1026
  console.log('Aborting...')
@@ -1 +1 @@
1
- {"version":3,"file":"section-factory-with-esbuild.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-esbuild.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAuDrD,eAAO,MAAM,uBAAuB,cAAoC,CAAA;AAsHxE,KAAK,gBAAgB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAE3F,qBAAa,cAAc;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAwC;IACrE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAc;IAE5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAA+B;IACrE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAA+B;IACnE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAI;IAE7B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA2C;IAC5E,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAQ;IACxC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAK;mBAEZ,iBAAiB;IAsBtC;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAOhC,MAAM,CAAC,aAAa,IAAI,IAAI;IAwB5B;;;;OAIG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AAE,EAAE,MAAM,CAAA;YACV,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;SACjC,CAAA;KACJ,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKpC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,eAAe,GAAG,aAAa,GAAG,eAAe,CAAA;QAC9D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe;IAYrD;;;;;;;;;OASG;mBACkB,GAAG;IA6FxB;;;;OAIG;mBACkB,eAAe;IA4LpC,OAAO,CAAC,MAAM,CAAC,YAAY;IAqD3B,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
@@ -222,7 +222,11 @@ export class SectionFactory {
222
222
  */
223
223
  static async getSectionsSilently(type) {
224
224
  this.setIsCLI();
225
- return await this.getSections(type);
225
+ const sections = await this.getSections(type);
226
+ if (this.errorCount > 0) {
227
+ throw new Error('Section configuration errors detected. Fix section files and rerun the command.');
228
+ }
229
+ return sections;
226
230
  }
227
231
  /**
228
232
  * Get all sections
@@ -1 +1 @@
1
- {"version":3,"file":"section-factory-with-jiti.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-jiti.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAgCrD,eAAO,MAAM,uBAAuB,cAAoC,CAAA;AAqFxE,KAAK,gBAAgB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAE3F,qBAAa,cAAc;IACvB,OAAO,CAAC,MAAM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AAE;YACH,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;SACf,EAAE,CAAA;KACN,CAAC;IAwCF;;;;;OAKG;WACU,UAAU,CAAC,EACpB,IAAI,EACJ,IAAI,GACP,EAAE;QACC,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;KACvC,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKpC;;;;;;OAMG;WACU,kBAAkB,CAAC,EAC5B,IAAI,EACJ,IAAI,EACJ,KAAK,GACR,EAAE;QACC,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;QACpC,KAAK,EAAE;YACH,EAAE,EAAE,MAAM,CAAA;YACV,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;SACjC,CAAA;KACJ,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKpC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,eAAe,GAAG,aAAa,GAAG,eAAe,CAAA;QAC9D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe;IAYrD;;;;;;;;;OASG;mBACkB,GAAG;IA6FxB;;;;OAIG;mBACkB,eAAe;IA4LpC,OAAO,CAAC,MAAM,CAAC,YAAY;IA6E3B;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IA+D5C,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
1
+ {"version":3,"file":"section-factory-with-jiti.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-jiti.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,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;IA4LpC,OAAO,CAAC,MAAM,CAAC,YAAY;IA6E3B;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IA+D5C,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
@@ -172,7 +172,11 @@ export class SectionFactory {
172
172
  */
173
173
  static async getSectionsSilently(type) {
174
174
  this.setIsCLI();
175
- return await this.getSections(type);
175
+ const sections = await this.getSections(type);
176
+ if (this.errorCount > 0) {
177
+ throw new Error('Section configuration errors detected. Fix section files and rerun the command.');
178
+ }
179
+ return sections;
176
180
  }
177
181
  /**
178
182
  * Get all sections
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-cms",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -210,8 +210,8 @@
210
210
  "tsx": "^4.20.6",
211
211
  "typescript": "^5.9.2",
212
212
  "@lzcms/eslint-config": "0.3.0",
213
- "@lzcms/prettier-config": "0.1.0",
214
- "@lzcms/tsconfig": "0.1.0"
213
+ "@lzcms/tsconfig": "0.1.0",
214
+ "@lzcms/prettier-config": "0.1.0"
215
215
  },
216
216
  "license": "MIT",
217
217
  "keywords": [