From 6ce285ec94b69a99b2638a7013c1f9cbcb8789ea Mon Sep 17 00:00:00 2001 From: lemusthelroy Date: Wed, 26 Jun 2024 11:41:54 +0100 Subject: [PATCH] feat: pass accountId to resolveConfig (#6733) * feat: pass accountId to * feat: pass accountId to resolveConfig * fix: revert package-lock change --------- Co-authored-by: Netlify Bot --- src/commands/base-command.ts | 3 +++ tests/integration/commands/build/build-program.test.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/commands/base-command.ts b/src/commands/base-command.ts index 12ba72b01c8..f3a30eba883 100644 --- a/src/commands/base-command.ts +++ b/src/commands/base-command.ts @@ -177,6 +177,7 @@ export default class BaseCommand extends Command { featureFlags: FeatureFlags = {} siteId?: string + accountId?: string /** * IMPORTANT this function will be called for each command! @@ -575,6 +576,7 @@ export default class BaseCommand extends Command { try { const site = await api.getSite({ siteId: actionCommand.siteId, feature_flags: 'cli' }) actionCommand.featureFlags = site.feature_flags + actionCommand.accountId = site.account_id } catch { // if the site is not found, that could mean that the user passed a site name, not an ID } @@ -685,6 +687,7 @@ export default class BaseCommand extends Command { try { return await resolveConfig({ + accountId: this.accountId, config: config.configFilePath, packagePath: config.packagePath, repositoryRoot: config.repositoryRoot, diff --git a/tests/integration/commands/build/build-program.test.js b/tests/integration/commands/build/build-program.test.js index c4326f36fc1..ea6d311111a 100644 --- a/tests/integration/commands/build/build-program.test.js +++ b/tests/integration/commands/build/build-program.test.js @@ -22,6 +22,7 @@ vi.mock('@netlify/config', async (importOriginal) => { const siteInfo = { account_slug: 'test-account', + account_id: 'account_id', id: 'site_id', name: 'site-name', feature_flags: { test_flag: true }, @@ -72,6 +73,7 @@ describe('command/build', () => { await createBuildCommand(new BaseCommand('netlify')).parseAsync(['', '', 'build']) expect(configOptions.featureFlags).toEqual(siteInfo.feature_flags) + expect(configOptions.accountId).toEqual(siteInfo.account_id) await createBuildCommand(new BaseCommand('netlify')).parseAsync(['', '', 'build', '--offline']) expect(configOptions.featureFlags, 'should not call API in offline mode').toEqual({})