From e27cb09e4564865abdf0f9b5b1f166de90b9b877 Mon Sep 17 00:00:00 2001 From: daffl Date: Wed, 29 May 2024 14:57:59 -0600 Subject: [PATCH 1/2] fix(generators): Fix migrate:make script in generated app --- .../generators/src/connection/templates/knex.tpl.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/generators/src/connection/templates/knex.tpl.ts b/packages/generators/src/connection/templates/knex.tpl.ts index 96ff13a18a..1164311f0e 100644 --- a/packages/generators/src/connection/templates/knex.tpl.ts +++ b/packages/generators/src/connection/templates/knex.tpl.ts @@ -54,16 +54,15 @@ export const generate = (ctx: ConnectionGeneratorContext) => ) .then(renderSource(knexfile, toFile('knexfile'))) .then( - mergeJSON( - (ctx) => ({ + mergeJSON((ctx) => { + return { scripts: { migrate: 'knex migrate:latest', - 'migrate:make': 'knex migrate:make' + ctx.language === 'js' ? ' -x mjs' : '', + 'migrate:make': 'knex migrate:make' + (ctx.language === 'js' ? ' -x mjs' : ''), test: 'cross-env NODE_ENV=test npm run migrate && npm run mocha' } - }), - toFile('package.json') - ) + } + }, toFile('package.json')) ) .then(injectSource(importTemplate, before('import { services } from'), toAppFile)) .then(injectSource(configureTemplate, before('app.configure(services)'), toAppFile)) From 04748eec5f1b789d59c3be7cd2011a64006ea85e Mon Sep 17 00:00:00 2001 From: daffl Date: Wed, 29 May 2024 15:08:03 -0600 Subject: [PATCH 2/2] Styling --- packages/generators/src/connection/templates/knex.tpl.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/generators/src/connection/templates/knex.tpl.ts b/packages/generators/src/connection/templates/knex.tpl.ts index 1164311f0e..afa6ef6d79 100644 --- a/packages/generators/src/connection/templates/knex.tpl.ts +++ b/packages/generators/src/connection/templates/knex.tpl.ts @@ -54,15 +54,16 @@ export const generate = (ctx: ConnectionGeneratorContext) => ) .then(renderSource(knexfile, toFile('knexfile'))) .then( - mergeJSON((ctx) => { - return { + mergeJSON( + (ctx) => ({ scripts: { migrate: 'knex migrate:latest', 'migrate:make': 'knex migrate:make' + (ctx.language === 'js' ? ' -x mjs' : ''), test: 'cross-env NODE_ENV=test npm run migrate && npm run mocha' } - } - }, toFile('package.json')) + }), + toFile('package.json') + ) ) .then(injectSource(importTemplate, before('import { services } from'), toAppFile)) .then(injectSource(configureTemplate, before('app.configure(services)'), toAppFile))