From abca72a2b3b4d341db2635914cbca14155c5e2c7 Mon Sep 17 00:00:00 2001 From: Adam G-H Date: Wed, 11 Feb 2026 22:38:15 -0500 Subject: [PATCH 1/6] Add an update to dump the autoloader --- src/main/Drupal.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/Drupal.ts b/src/main/Drupal.ts index dd7597d..05a9e09 100644 --- a/src/main/Drupal.ts +++ b/src/main/Drupal.ts @@ -46,7 +46,13 @@ export class Drupal ], - update: [], + update: [ + // The packaged PHP interpreter was updated from 8.3 to 8.4, so the autoloader needs to + // be regenerated accordingly. + [ + ['dump-autoload', '--ignore-platform-req=php'], + ], + ], } From 0e1b9f5590ba1fdf5579311fb8aff97878aef748 Mon Sep 17 00:00:00 2001 From: Adam G-H Date: Wed, 11 Feb 2026 22:40:41 -0500 Subject: [PATCH 2/6] Add a helper method to get the version --- src/main/Drupal.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/Drupal.ts b/src/main/Drupal.ts index 05a9e09..7b6cbf5 100644 --- a/src/main/Drupal.ts +++ b/src/main/Drupal.ts @@ -67,7 +67,7 @@ export class Drupal this.commands.install.splice( this.commands.install.findIndex(command => command[0] === 'install'), 0, - ['config', '--merge', '--json', 'extra.drupal-launcher', `{"version": ${this.commands.update.length + 1}}`] + ['config', 'extra.drupal-launcher.version', String(this.commands.update.length + 1), '--json'], ); if (fixture) { @@ -78,6 +78,21 @@ export class Drupal } } + private async version (): Promise + { + try { + const { stdout } = await new ComposerCommand('config', 'extra.drupal-launcher.version') + .inDirectory(this.root) + .run(); + + // If the version returned by Composer parses to NaN, default to 1. + return parseInt(stdout.toString().trim()) || 1; + } + catch { + return 1; + } + } + public async install (archive?: string | false, port?: MessagePortMain): Promise { try { From 1ff105fcd467b40944dfbf53d029f0f4ebb70d26 Mon Sep 17 00:00:00 2001 From: Adam G-H Date: Wed, 11 Feb 2026 22:45:55 -0500 Subject: [PATCH 3/6] Add a general update method --- src/main/Drupal.ts | 27 ++++++++++++++++++++++++++- src/main/main.ts | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/Drupal.ts b/src/main/Drupal.ts index 7b6cbf5..cfc91f7 100644 --- a/src/main/Drupal.ts +++ b/src/main/Drupal.ts @@ -78,6 +78,31 @@ export class Drupal } } + public async update (progress?: MessagePortMain): Promise + { + const version: number = await this.version(); + + const updates: string[][][] = this.commands.update.slice(version - 1); + updates.push([ + ['config', 'extra.drupal-launcher.version', String(version + 1), '--json'], + ]); + if (updates.length === 1) { + return; + } + + let done: number = 0; + const total: number = updates.reduce((sum: number, update: string[][]): number => sum + update.length, 0); + progress?.postMessage({ done, total }); + + for (const update of updates) { + for (const command of update) { + await new ComposerCommand(...command).inDirectory(this.root).run(); + done++; + progress?.postMessage({ done, total }); + } + } + } + private async version (): Promise { try { @@ -281,7 +306,7 @@ export class Drupal const checkForServerStart = (line: string, _: any, server: ChildProcess): void => { if (line.includes(`(${url}) started`)) { clearTimeout(timeoutId); - logger.debug(`Server started!`); + logger.debug(`Server started.`); app.on('will-quit', () => this.stop()); this.server = server; diff --git a/src/main/main.ts b/src/main/main.ts index 6195afd..213877d 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -83,6 +83,8 @@ ipcMain.handle('drupal:start', async ({ sender: win }): Promise = settings.set('useArchive', false); logger.debug('Permanently disabled pre-built archive.'); + await drupal.update(progress); + if (argv.server) { // Let the renderer know that we're going to start the server. progress.postMessage({ server: true }); From 247188e15891054c6e4453e8a3e44e78e4beb844 Mon Sep 17 00:00:00 2001 From: Adam G-H Date: Sun, 15 Feb 2026 16:36:19 -0500 Subject: [PATCH 4/6] Enable st_helper instead --- src/main/Drupal.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/Drupal.ts b/src/main/Drupal.ts index cfc91f7..ff6b861 100644 --- a/src/main/Drupal.ts +++ b/src/main/Drupal.ts @@ -47,10 +47,9 @@ export class Drupal ], update: [ - // The packaged PHP interpreter was updated from 8.3 to 8.4, so the autoloader needs to - // be regenerated accordingly. + // Enable the site template helper plugin, which was added in Drupal CMS 2.0.1. [ - ['dump-autoload', '--ignore-platform-req=php'], + ['config', 'allow-plugins.drupal/site_template_helper', 'true'], ], ], From 404f5b865aeac3dac27104db5da6df5d3f33d805 Mon Sep 17 00:00:00 2001 From: Adam G-H Date: Sun, 15 Feb 2026 16:39:53 -0500 Subject: [PATCH 5/6] Comments --- src/main/Drupal.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/Drupal.ts b/src/main/Drupal.ts index ff6b861..5755248 100644 --- a/src/main/Drupal.ts +++ b/src/main/Drupal.ts @@ -81,20 +81,23 @@ export class Drupal { const version: number = await this.version(); + // Find the subset of updates that need to be done, and always add a final "update" + // to increment to stored version number. const updates: string[][][] = this.commands.update.slice(version - 1); updates.push([ ['config', 'extra.drupal-launcher.version', String(version + 1), '--json'], ]); + // If all we're doing is incrementing the stored version, there are no updates. if (updates.length === 1) { return; } let done: number = 0; - const total: number = updates.reduce((sum: number, update: string[][]): number => sum + update.length, 0); + const total: number = updates.reduce((sum: number, commands: string[][]): number => sum + commands.length, 0); progress?.postMessage({ done, total }); - for (const update of updates) { - for (const command of update) { + for (const commands of updates) { + for (const command of commands) { await new ComposerCommand(...command).inDirectory(this.root).run(); done++; progress?.postMessage({ done, total }); From 10d23b6dbb5dcf713c625211990371f1b0686256 Mon Sep 17 00:00:00 2001 From: Adam G-H Date: Mon, 16 Feb 2026 15:03:32 -0500 Subject: [PATCH 6/6] Minor change --- src/main/Drupal.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/Drupal.ts b/src/main/Drupal.ts index 5755248..a58ce65 100644 --- a/src/main/Drupal.ts +++ b/src/main/Drupal.ts @@ -81,16 +81,15 @@ export class Drupal { const version: number = await this.version(); - // Find the subset of updates that need to be done, and always add a final "update" - // to increment to stored version number. + // Find the subset of updates that need to be done (if any). const updates: string[][][] = this.commands.update.slice(version - 1); + if (updates.length === 0) { + return; + } + // Always add a final "update" to increment to stored version number. updates.push([ ['config', 'extra.drupal-launcher.version', String(version + 1), '--json'], ]); - // If all we're doing is incrementing the stored version, there are no updates. - if (updates.length === 1) { - return; - } let done: number = 0; const total: number = updates.reduce((sum: number, commands: string[][]): number => sum + commands.length, 0);