nextjs-cms 0.9.12 → 0.9.13

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":"AAywCA,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));
@@ -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
  }
@@ -856,13 +886,13 @@ const main = async (s) => {
856
886
  fs.mkdirSync(schemaOutDir, { recursive: true });
857
887
  }
858
888
  /**
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
889
+ * Overwrite the schema only when generation is ready, so failed runs do not delete the previous schema.
864
890
  */
865
- fs.appendFileSync(schemaFilePath, drizzleTableSchemas.join('\n'));
891
+ const schemaFileContent = 'import {' +
892
+ [...drizzleImports].join(',') +
893
+ "} from 'drizzle-orm/mysql-core'\n\n" +
894
+ drizzleTableSchemas.join('\n');
895
+ fs.writeFileSync(schemaFilePath, schemaFileContent, 'utf8');
866
896
  s.stop();
867
897
  }
868
898
  console.log(chalk.white('Finding tables to create, update or remove...'));
@@ -914,6 +944,27 @@ const main = async (s) => {
914
944
  * Loop through the tables to create
915
945
  */
916
946
  for (const table of tablesToCreate) {
947
+ const tableExistsInDatabase = (await MysqlTableChecker.getExistingTableStructure(table.name)) !== null;
948
+ if (tableExistsInDatabase) {
949
+ s.stop();
950
+ const overwriteExistingTable = await select({
951
+ message: `Table '${table.name}' already exists in your database, overwrite its fields if any?`,
952
+ options: [
953
+ { value: 'yes', label: 'Yes, overwrite fields' },
954
+ { value: 'no', label: 'No, skip for now' },
955
+ ],
956
+ initialValue: 'yes',
957
+ });
958
+ s.start();
959
+ if (overwriteExistingTable === 'yes') {
960
+ await ensureTableRegistryEntry(table.name, table.sectionName);
961
+ await updateTable(table, s);
962
+ }
963
+ else {
964
+ console.log(chalk.yellow(`Skipping existing table '${table.name}'.`));
965
+ }
966
+ continue;
967
+ }
917
968
  /**
918
969
  * Check if there are tables to remove
919
970
  * If there are, ask the user if they want to create the new table or rename a removed table
@@ -931,44 +982,7 @@ const main = async (s) => {
931
982
  switch (opType) {
932
983
  case 'new': {
933
984
  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
- }
985
+ const options = resolveCreateTableOptions(table.sectionType);
972
986
  await createTable(table, options);
973
987
  break;
974
988
  }
@@ -1003,44 +1017,7 @@ const main = async (s) => {
1003
1017
  })
1004
1018
  ) {*/
1005
1019
  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
- }
1020
+ const options = resolveCreateTableOptions(table.sectionType);
1044
1021
  await createTable(table, options);
1045
1022
  /*} else {
1046
1023
  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,CA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ACJ,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;IAqD3B,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
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,CA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AAE,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;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,sB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,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"}
@@ -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.13",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",