Skip to content

Commit

Permalink
chore: Update dev server contract
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-yeager authored Feb 16, 2024
2 parents a2a5584 + 832179c commit 6da90df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions packages/cli/lib/DevServerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const {
stopPortManagerServer,
requestPorts,
} = require('@hubspot/local-dev-lib/portManager');
const {
getHubSpotApiOrigin,
getHubSpotWebsiteOrigin,
} = require('@hubspot/local-dev-lib/urls');
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');

const i18nKey = 'cli.lib.DevServerManager';

Expand All @@ -29,7 +34,6 @@ class DevServerManager {
serverInterface: DevModeInterface,
},
};
this.debug = false;
}

async iterateDevServers(callback) {
Expand Down Expand Up @@ -62,19 +66,22 @@ class DevServerManager {
}, {});
}

async setup({ components, debug, onUploadRequired }) {
this.debug = debug;
async setup({ components, onUploadRequired, accountId }) {
this.componentsByType = this.arrangeComponentsByType(components);

const { env } = getAccountConfig(accountId);
await startPortManagerServer();
await this.iterateDevServers(
async (serverInterface, compatibleComponents) => {
if (serverInterface.setup) {
await serverInterface.setup({
components: compatibleComponents,
debug,
onUploadRequired,
promptUser,
logger,
urls: {
api: getHubSpotApiOrigin(env),
web: getHubSpotWebsiteOrigin(env),
},
});
}
}
Expand All @@ -89,7 +96,6 @@ class DevServerManager {
if (serverInterface.start) {
await serverInterface.start({
accountId,
debug: this.debug,
projectConfig,
requestPorts,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/LocalDevManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ class LocalDevManager {
try {
await DevServerManager.setup({
components,
debug: this.debug,
onUploadRequired: this.logUploadWarning.bind(this),
accountId: this.targetAccountId,
});
return true;
} catch (e) {
Expand Down

0 comments on commit 6da90df

Please sign in to comment.