@hubspot/cli 8.10.0 → 8.12.0-beta.0
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.
- package/commands/account/clean.js +1 -1
- package/commands/account/list.js +1 -1
- package/commands/account/remove.js +1 -1
- package/commands/account/rename.js +1 -1
- package/commands/account/use.js +1 -1
- package/commands/api.d.ts +4 -1
- package/commands/api.js +11 -14
- package/commands/hubdb/list.d.ts +1 -1
- package/commands/mcp/setup.d.ts +2 -0
- package/commands/mcp/setup.js +29 -1
- package/commands/project/appInstallStatus.d.ts +2 -1
- package/commands/project/appInstallStatus.js +19 -17
- package/commands/project/create.js +0 -1
- package/commands/project/deploy.d.ts +2 -1
- package/commands/project/deploy.js +31 -14
- package/commands/project/dev/index.js +18 -64
- package/commands/project/info.d.ts +2 -1
- package/commands/project/info.js +8 -6
- package/commands/project/installApp.d.ts +2 -1
- package/commands/project/installApp.js +25 -26
- package/commands/project/list.js +1 -1
- package/commands/project/profile/add.d.ts +2 -1
- package/commands/project/profile/add.js +22 -1
- package/commands/project/profile/delete.d.ts +1 -1
- package/commands/project/release/create.d.ts +2 -1
- package/commands/project/release/create.js +68 -69
- package/commands/project/release/info.d.ts +2 -1
- package/commands/project/release/info.js +7 -6
- package/commands/project/release/list.d.ts +2 -1
- package/commands/project/release/list.js +14 -6
- package/commands/project/upload.d.ts +2 -1
- package/commands/project/upload.js +23 -17
- package/commands/project/validate.d.ts +1 -1
- package/commands/project.js +2 -2
- package/commands/testAccount/create.d.ts +2 -1
- package/commands/testAccount/create.js +7 -7
- package/commands/testAccount/importData.d.ts +1 -1
- package/lang/en.d.ts +32 -28
- package/lang/en.js +41 -37
- package/lib/commonOpts.js +6 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +1 -0
- package/lib/jsonOutput.d.ts +109 -0
- package/lib/jsonOutput.js +94 -0
- package/lib/mcp/setup.d.ts +6 -1
- package/lib/mcp/setup.js +29 -18
- package/lib/projects/builds.d.ts +2 -0
- package/lib/projects/builds.js +22 -0
- package/lib/projects/localDev/DevSessionManager.d.ts +2 -2
- package/lib/projects/localDev/DevSessionManager.js +4 -30
- package/lib/projects/localDev/helpers/account.d.ts +0 -7
- package/lib/projects/localDev/helpers/account.js +1 -80
- package/lib/projects/release.d.ts +4 -0
- package/lib/projects/release.js +90 -0
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +4 -8
- package/lib/yargs/makeWrappedYargsHandler.d.ts +5 -1
- package/lib/yargs/makeWrappedYargsHandler.js +123 -65
- package/mcp-server/Tool.d.ts +8 -3
- package/mcp-server/Tool.js +58 -32
- package/mcp-server/server.js +10 -6
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +10 -17
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +12 -18
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -10
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +9 -9
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +7 -7
- package/mcp-server/tools/cms/HsListTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsListTool.js +6 -10
- package/mcp-server/tools/index.js +2 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +8 -9
- package/mcp-server/tools/project/AuthAccountTool.d.ts +18 -0
- package/mcp-server/tools/project/AuthAccountTool.js +78 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/CreateProjectTool.js +13 -12
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +2 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +14 -15
- package/mcp-server/tools/project/DeployProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/DeployProjectTool.js +10 -10
- package/mcp-server/tools/project/DocFetchTool.js +1 -1
- package/mcp-server/tools/project/DocsSearchTool.js +9 -3
- package/mcp-server/tools/project/FindProjectsTool.js +1 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +9 -4
- package/mcp-server/tools/project/GetApplicationInfoTool.js +9 -4
- package/mcp-server/tools/project/GetBuildLogsTool.js +9 -3
- package/mcp-server/tools/project/GetBuildStatusTool.js +9 -3
- package/mcp-server/tools/project/GetConfigValuesTool.js +9 -3
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.d.ts +2 -2
- package/mcp-server/tools/project/UploadProjectTools.js +9 -8
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +5 -4
- package/mcp-server/utils/command.d.ts +25 -2
- package/mcp-server/utils/command.js +67 -17
- package/mcp-server/utils/logger.d.ts +3 -0
- package/mcp-server/utils/logger.js +30 -0
- package/mcp-server/utils/toolUsageTracking.js +8 -1
- package/package.json +10 -8
- package/types/Yargs.d.ts +3 -1
- package/commands/project/dev/deprecatedFlow.d.ts +0 -11
- package/commands/project/dev/deprecatedFlow.js +0 -180
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +0 -43
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +0 -128
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +0 -394
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { getConfigAccountById, getLinkedOrAllConfigAccounts, getConfigAccountEnvironment, } from '@hubspot/local-dev-lib/config';
|
|
2
|
-
import { getHsSettingsFileIfExists, getHsSettingsFilePath, } from '@hubspot/local-dev-lib/config/hsSettings';
|
|
3
|
-
import { findProjectComponents, getProjectComponentTypes, } from '../../../lib/projects/structure.js';
|
|
4
|
-
import { ComponentTypes } from '../../../types/Projects.js';
|
|
5
|
-
import { commands } from '../../../lang/en.js';
|
|
6
|
-
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
7
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
8
|
-
import LocalDevManager_DEPRECATED from '../../../lib/projects/localDev/LocalDevManager_DEPRECATED.js';
|
|
9
|
-
import { confirmDefaultAccountIsTarget, suggestRecommendedNestedAccount, checkIfAccountFlagIsSupported, checkIfDefaultAccountIsSupported, createSandboxForLocalDev, createDeveloperTestAccountForLocalDev, useExistingDevTestAccount, checkIfParentAccountIsAuthed, hasSandboxes, } from '../../../lib/projects/localDev/helpers/account.js';
|
|
10
|
-
import { createInitialBuildForNewProject, createNewProjectForLocalDev, } from '../../../lib/projects/localDev/helpers/project.js';
|
|
11
|
-
import { handleExit } from '../../../lib/process.js';
|
|
12
|
-
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
13
|
-
import { isSandbox, isDeveloperTestAccount, } from '../../../lib/accountTypes.js';
|
|
14
|
-
import { ensureProjectExists } from '../../../lib/projects/ensureProjectExists.js';
|
|
15
|
-
import { isDirectoryLinked, addAccountToLinkedSettings, } from '../../../lib/link/linkUtils.js';
|
|
16
|
-
export async function deprecatedProjectDevFlow({ args, accountId, projectConfig, projectDir, }) {
|
|
17
|
-
const { userProvidedAccount, derivedAccountId, exit } = args;
|
|
18
|
-
const env = getConfigAccountEnvironment(derivedAccountId);
|
|
19
|
-
const components = await findProjectComponents(projectDir);
|
|
20
|
-
const runnableComponents = components.filter(component => component.runnable);
|
|
21
|
-
const componentTypes = getProjectComponentTypes(runnableComponents);
|
|
22
|
-
const hasPrivateApps = !!componentTypes[ComponentTypes.PrivateApp];
|
|
23
|
-
const hasPublicApps = !!componentTypes[ComponentTypes.PublicApp];
|
|
24
|
-
const accountConfig = getConfigAccountById(accountId);
|
|
25
|
-
if (!accountConfig) {
|
|
26
|
-
uiLogger.error(commands.project.dev.errors.noAccount(accountId));
|
|
27
|
-
return exit(EXIT_CODES.ERROR);
|
|
28
|
-
}
|
|
29
|
-
if (runnableComponents.length === 0) {
|
|
30
|
-
uiLogger.error(commands.project.dev.errors.noRunnableComponents);
|
|
31
|
-
return exit(EXIT_CODES.SUCCESS);
|
|
32
|
-
}
|
|
33
|
-
else if (hasPrivateApps && hasPublicApps) {
|
|
34
|
-
uiLogger.error(commands.project.dev.errors.invalidProjectComponents);
|
|
35
|
-
return exit(EXIT_CODES.SUCCESS);
|
|
36
|
-
}
|
|
37
|
-
const hsSettings = getHsSettingsFileIfExists();
|
|
38
|
-
const directoryIsLinked = isDirectoryLinked(hsSettings);
|
|
39
|
-
const accounts = getLinkedOrAllConfigAccounts();
|
|
40
|
-
if (!accounts) {
|
|
41
|
-
uiLogger.error(commands.project.dev.errors.noAccountsInConfig);
|
|
42
|
-
return exit(EXIT_CODES.ERROR);
|
|
43
|
-
}
|
|
44
|
-
let bypassRecommendedAccountPrompt = false;
|
|
45
|
-
if (isDeveloperTestAccount(accountConfig)) {
|
|
46
|
-
bypassRecommendedAccountPrompt = true;
|
|
47
|
-
}
|
|
48
|
-
else if (!hasPublicApps && isSandbox(accountConfig)) {
|
|
49
|
-
bypassRecommendedAccountPrompt = true;
|
|
50
|
-
}
|
|
51
|
-
else if (!hasPublicApps) {
|
|
52
|
-
const defaultAccountHasSandboxes = await hasSandboxes(accountConfig);
|
|
53
|
-
bypassRecommendedAccountPrompt = !defaultAccountHasSandboxes;
|
|
54
|
-
}
|
|
55
|
-
// targetProjectAccountId and targetTestingAccountId are set to null if --account flag is not provided.
|
|
56
|
-
// By setting them to null, we can later check if they need to be assigned based on the default account configuration and the type of app.
|
|
57
|
-
let targetProjectAccountId = userProvidedAccount ? derivedAccountId : null;
|
|
58
|
-
// The account that we are locally testing against
|
|
59
|
-
let targetTestingAccountId = userProvidedAccount ? derivedAccountId : null;
|
|
60
|
-
// Check that the default account or flag option is valid for the type of app in this project
|
|
61
|
-
if (userProvidedAccount) {
|
|
62
|
-
try {
|
|
63
|
-
checkIfAccountFlagIsSupported(accountConfig, hasPublicApps);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
uiLogger.error(getErrorMessage(e));
|
|
67
|
-
return exit(EXIT_CODES.SUCCESS);
|
|
68
|
-
}
|
|
69
|
-
if (hasPublicApps) {
|
|
70
|
-
targetProjectAccountId = accountConfig.parentAccountId || null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
await checkIfDefaultAccountIsSupported(accountConfig, hasPublicApps, exit);
|
|
75
|
-
}
|
|
76
|
-
if (directoryIsLinked) {
|
|
77
|
-
uiLogger.log('');
|
|
78
|
-
uiLogger.info(commands.account.subcommands.link.shared.usingLinkedAccounts(getHsSettingsFilePath()));
|
|
79
|
-
}
|
|
80
|
-
// The user is targeting an account type that we recommend developing on
|
|
81
|
-
if (!targetProjectAccountId && bypassRecommendedAccountPrompt) {
|
|
82
|
-
targetTestingAccountId = derivedAccountId;
|
|
83
|
-
await confirmDefaultAccountIsTarget(accountConfig, exit);
|
|
84
|
-
if (hasPublicApps) {
|
|
85
|
-
try {
|
|
86
|
-
checkIfParentAccountIsAuthed(accountConfig);
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
uiLogger.error(getErrorMessage(e));
|
|
90
|
-
return exit(EXIT_CODES.SUCCESS);
|
|
91
|
-
}
|
|
92
|
-
targetProjectAccountId = accountConfig.parentAccountId || null;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
targetProjectAccountId = derivedAccountId;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
let createNewSandbox = false;
|
|
99
|
-
let createNewDeveloperTestAccount = false;
|
|
100
|
-
if (!targetProjectAccountId) {
|
|
101
|
-
const { targetAccountId, parentAccountId, createNestedAccount, notInConfigAccount, } = await suggestRecommendedNestedAccount(accounts, accountConfig, hasPublicApps);
|
|
102
|
-
targetProjectAccountId = hasPublicApps
|
|
103
|
-
? parentAccountId || null
|
|
104
|
-
: targetAccountId;
|
|
105
|
-
targetTestingAccountId = targetAccountId;
|
|
106
|
-
// Only used for developer test accounts that are not yet in the config
|
|
107
|
-
if (notInConfigAccount) {
|
|
108
|
-
const accountAdded = await useExistingDevTestAccount(env, notInConfigAccount);
|
|
109
|
-
if (!accountAdded) {
|
|
110
|
-
return exit(EXIT_CODES.SUCCESS);
|
|
111
|
-
}
|
|
112
|
-
if (directoryIsLinked) {
|
|
113
|
-
addAccountToLinkedSettings(notInConfigAccount.id);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
createNewSandbox = hasPrivateApps && createNestedAccount;
|
|
117
|
-
createNewDeveloperTestAccount = hasPublicApps && createNestedAccount;
|
|
118
|
-
}
|
|
119
|
-
if (createNewSandbox) {
|
|
120
|
-
try {
|
|
121
|
-
targetProjectAccountId = await createSandboxForLocalDev(derivedAccountId, accountConfig, env);
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
return exit(EXIT_CODES.ERROR);
|
|
125
|
-
}
|
|
126
|
-
// We will be running our tests against this new sandbox account
|
|
127
|
-
targetTestingAccountId = targetProjectAccountId;
|
|
128
|
-
if (directoryIsLinked) {
|
|
129
|
-
addAccountToLinkedSettings(targetProjectAccountId);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (createNewDeveloperTestAccount) {
|
|
133
|
-
try {
|
|
134
|
-
targetTestingAccountId = await createDeveloperTestAccountForLocalDev(derivedAccountId, accountConfig, env, false);
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return exit(EXIT_CODES.ERROR);
|
|
138
|
-
}
|
|
139
|
-
targetProjectAccountId = derivedAccountId;
|
|
140
|
-
if (directoryIsLinked) {
|
|
141
|
-
addAccountToLinkedSettings(targetTestingAccountId);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (!targetProjectAccountId || !targetTestingAccountId) {
|
|
145
|
-
uiLogger.error(commands.project.dev.errors.noAccount(accountId));
|
|
146
|
-
return exit(EXIT_CODES.ERROR);
|
|
147
|
-
}
|
|
148
|
-
// eslint-disable-next-line prefer-const
|
|
149
|
-
let { projectExists, project } = await ensureProjectExists(targetProjectAccountId, projectConfig.name, {
|
|
150
|
-
allowCreate: false,
|
|
151
|
-
noLogs: true,
|
|
152
|
-
withPolling: createNewSandbox,
|
|
153
|
-
});
|
|
154
|
-
let deployedBuild;
|
|
155
|
-
let isGithubLinked = false;
|
|
156
|
-
if (projectExists && project) {
|
|
157
|
-
deployedBuild = project.deployedBuild;
|
|
158
|
-
isGithubLinked = Boolean(project.sourceIntegration && project.sourceIntegration.source === 'GITHUB');
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
project = await createNewProjectForLocalDev(projectConfig, targetProjectAccountId, createNewSandbox, hasPublicApps, exit);
|
|
162
|
-
deployedBuild = await createInitialBuildForNewProject(projectConfig, projectDir, targetProjectAccountId, exit);
|
|
163
|
-
}
|
|
164
|
-
const LocalDev = new LocalDevManager_DEPRECATED({
|
|
165
|
-
runnableComponents,
|
|
166
|
-
debug: args.debug,
|
|
167
|
-
deployedBuild,
|
|
168
|
-
isGithubLinked,
|
|
169
|
-
parentAccountId: targetProjectAccountId,
|
|
170
|
-
projectConfig,
|
|
171
|
-
projectDir,
|
|
172
|
-
projectId: project.id,
|
|
173
|
-
targetAccountId: targetTestingAccountId,
|
|
174
|
-
env,
|
|
175
|
-
exit,
|
|
176
|
-
port: args.port,
|
|
177
|
-
});
|
|
178
|
-
await LocalDev.start();
|
|
179
|
-
handleExit(({ isSIGHUP }) => LocalDev.stop(!isSIGHUP));
|
|
180
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ProjectConfig, ComponentTypes, Component } from '../../../types/Projects.js';
|
|
2
|
-
import { ExitFunction } from '../../../types/Yargs.js';
|
|
3
|
-
type DevServerInterface = {
|
|
4
|
-
setup?: Function;
|
|
5
|
-
start?: (options: object) => Promise<void>;
|
|
6
|
-
fileChange?: (filePath: string, event: string) => Promise<void>;
|
|
7
|
-
cleanup?: () => Promise<void>;
|
|
8
|
-
};
|
|
9
|
-
type ComponentsByType = {
|
|
10
|
-
[key in ComponentTypes]?: {
|
|
11
|
-
[key: string]: Component;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
declare class DevServerManager_DEPRECATED {
|
|
15
|
-
private initialized;
|
|
16
|
-
private started;
|
|
17
|
-
private componentsByType;
|
|
18
|
-
private devServers;
|
|
19
|
-
constructor();
|
|
20
|
-
iterateDevServers(callback: (serverInterface: DevServerInterface, compatibleComponents: {
|
|
21
|
-
[key: string]: Component;
|
|
22
|
-
}) => Promise<void>): Promise<void>;
|
|
23
|
-
arrangeComponentsByType(components: Component[]): ComponentsByType;
|
|
24
|
-
setup({ components, onUploadRequired, accountId, setActiveApp, exit, port, }: {
|
|
25
|
-
components: Component[];
|
|
26
|
-
onUploadRequired: () => void;
|
|
27
|
-
accountId: number;
|
|
28
|
-
setActiveApp: (appUid: string | undefined) => Promise<void>;
|
|
29
|
-
exit: ExitFunction;
|
|
30
|
-
port?: number;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
start({ accountId, projectConfig, }: {
|
|
33
|
-
accountId: number;
|
|
34
|
-
projectConfig: ProjectConfig;
|
|
35
|
-
}): Promise<void>;
|
|
36
|
-
fileChange({ filePath, event, }: {
|
|
37
|
-
filePath: string;
|
|
38
|
-
event: string;
|
|
39
|
-
}): Promise<void>;
|
|
40
|
-
cleanup(): Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
declare const Manager: DevServerManager_DEPRECATED;
|
|
43
|
-
export default Manager;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
|
-
import { DevModeInterface as UIEDevModeInterface } from '@hubspot/ui-extensions-dev-server';
|
|
3
|
-
import { startPortManagerServer, stopPortManagerServer, requestPorts, } from '@hubspot/local-dev-lib/portManager';
|
|
4
|
-
import { getHubSpotApiOrigin, getHubSpotWebsiteOrigin, } from '@hubspot/local-dev-lib/urls';
|
|
5
|
-
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
6
|
-
import { ComponentTypes, } from '../../../types/Projects.js';
|
|
7
|
-
import { lib } from '../../../lang/en.js';
|
|
8
|
-
import { uiLogger } from '../../ui/logger.js';
|
|
9
|
-
import { logError } from '../../errorHandlers/index.js';
|
|
10
|
-
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
11
|
-
const SERVER_KEYS = {
|
|
12
|
-
privateApp: 'privateApp',
|
|
13
|
-
publicApp: 'publicApp',
|
|
14
|
-
};
|
|
15
|
-
class DevServerManager_DEPRECATED {
|
|
16
|
-
initialized;
|
|
17
|
-
started;
|
|
18
|
-
componentsByType;
|
|
19
|
-
devServers;
|
|
20
|
-
constructor() {
|
|
21
|
-
this.initialized = false;
|
|
22
|
-
this.started = false;
|
|
23
|
-
this.componentsByType = {};
|
|
24
|
-
this.devServers = {
|
|
25
|
-
[SERVER_KEYS.privateApp]: {
|
|
26
|
-
componentType: ComponentTypes.PrivateApp,
|
|
27
|
-
serverInterface: UIEDevModeInterface,
|
|
28
|
-
},
|
|
29
|
-
[SERVER_KEYS.publicApp]: {
|
|
30
|
-
componentType: ComponentTypes.PublicApp,
|
|
31
|
-
serverInterface: UIEDevModeInterface,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
async iterateDevServers(callback) {
|
|
36
|
-
const serverKeys = Object.keys(this.devServers);
|
|
37
|
-
for (let i = 0; i < serverKeys.length; i++) {
|
|
38
|
-
const serverKey = serverKeys[i];
|
|
39
|
-
const devServer = this.devServers[serverKey];
|
|
40
|
-
const compatibleComponents = this.componentsByType[devServer.componentType] || {};
|
|
41
|
-
if (Object.keys(compatibleComponents).length) {
|
|
42
|
-
await callback(devServer.serverInterface, compatibleComponents);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
uiLogger.debug(lib.DevServerManager.noCompatibleComponents(serverKey));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
arrangeComponentsByType(components) {
|
|
50
|
-
return components.reduce((acc, component) => {
|
|
51
|
-
if (!acc[component.type]) {
|
|
52
|
-
acc[component.type] = {};
|
|
53
|
-
}
|
|
54
|
-
if ('name' in component.config && component.config.name) {
|
|
55
|
-
acc[component.type][component.config.name] = component;
|
|
56
|
-
}
|
|
57
|
-
return acc;
|
|
58
|
-
}, {});
|
|
59
|
-
}
|
|
60
|
-
async setup({ components, onUploadRequired, accountId, setActiveApp, exit, port, }) {
|
|
61
|
-
this.componentsByType = this.arrangeComponentsByType(components);
|
|
62
|
-
let env;
|
|
63
|
-
const accountConfig = getConfigAccountById(accountId);
|
|
64
|
-
if (accountConfig) {
|
|
65
|
-
env = accountConfig.env;
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
await startPortManagerServer(port);
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
logError(e);
|
|
72
|
-
return exit(EXIT_CODES.ERROR);
|
|
73
|
-
}
|
|
74
|
-
await this.iterateDevServers(async (serverInterface, compatibleComponents) => {
|
|
75
|
-
if (serverInterface.setup) {
|
|
76
|
-
await serverInterface.setup({
|
|
77
|
-
components: compatibleComponents,
|
|
78
|
-
onUploadRequired,
|
|
79
|
-
logger,
|
|
80
|
-
urls: {
|
|
81
|
-
api: getHubSpotApiOrigin(env),
|
|
82
|
-
web: getHubSpotWebsiteOrigin(env),
|
|
83
|
-
},
|
|
84
|
-
setActiveApp,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
this.initialized = true;
|
|
89
|
-
}
|
|
90
|
-
async start({ accountId, projectConfig, }) {
|
|
91
|
-
if (this.initialized) {
|
|
92
|
-
await this.iterateDevServers(async (serverInterface) => {
|
|
93
|
-
if (serverInterface.start) {
|
|
94
|
-
await serverInterface.start({
|
|
95
|
-
accountId,
|
|
96
|
-
projectConfig,
|
|
97
|
-
requestPorts,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw new Error(lib.DevServerManager.notInitialized);
|
|
104
|
-
}
|
|
105
|
-
this.started = true;
|
|
106
|
-
}
|
|
107
|
-
async fileChange({ filePath, event, }) {
|
|
108
|
-
if (this.started) {
|
|
109
|
-
this.iterateDevServers(async (serverInterface) => {
|
|
110
|
-
if (serverInterface.fileChange) {
|
|
111
|
-
await serverInterface.fileChange(filePath, event);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async cleanup() {
|
|
117
|
-
if (this.started) {
|
|
118
|
-
await this.iterateDevServers(async (serverInterface) => {
|
|
119
|
-
if (serverInterface.cleanup) {
|
|
120
|
-
await serverInterface.cleanup();
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
await stopPortManagerServer();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const Manager = new DevServerManager_DEPRECATED();
|
|
128
|
-
export default Manager;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { FSWatcher } from 'chokidar';
|
|
2
|
-
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
-
import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
|
|
4
|
-
import { Environment } from '@hubspot/local-dev-lib/types/Accounts';
|
|
5
|
-
import { Component, ProjectConfig } from '../../../types/Projects.js';
|
|
6
|
-
import { ExitFunction } from '../../../types/Yargs.js';
|
|
7
|
-
type LocalDevManagerConstructorOptions = {
|
|
8
|
-
targetAccountId: number;
|
|
9
|
-
parentAccountId: number;
|
|
10
|
-
projectConfig: ProjectConfig;
|
|
11
|
-
projectDir: string;
|
|
12
|
-
projectId: number;
|
|
13
|
-
debug?: boolean;
|
|
14
|
-
deployedBuild?: Build;
|
|
15
|
-
isGithubLinked: boolean;
|
|
16
|
-
runnableComponents: Component[];
|
|
17
|
-
env: Environment;
|
|
18
|
-
exit: ExitFunction;
|
|
19
|
-
port?: number;
|
|
20
|
-
};
|
|
21
|
-
declare class LocalDevManager_DEPRECATED {
|
|
22
|
-
targetAccountId: number;
|
|
23
|
-
targetProjectAccountId: number;
|
|
24
|
-
projectConfig: ProjectConfig;
|
|
25
|
-
projectDir: string;
|
|
26
|
-
projectId: number;
|
|
27
|
-
debug: boolean;
|
|
28
|
-
deployedBuild?: Build;
|
|
29
|
-
isGithubLinked: boolean;
|
|
30
|
-
watcher: FSWatcher | null;
|
|
31
|
-
uploadWarnings: {
|
|
32
|
-
[key: string]: boolean;
|
|
33
|
-
};
|
|
34
|
-
runnableComponents: Component[];
|
|
35
|
-
activeApp: Component | null;
|
|
36
|
-
activePublicAppData: PublicApp | null;
|
|
37
|
-
env: Environment;
|
|
38
|
-
publicAppActiveInstalls: number | null;
|
|
39
|
-
projectSourceDir: string;
|
|
40
|
-
mostRecentUploadWarning: string | null;
|
|
41
|
-
private devSessionManager;
|
|
42
|
-
private exit;
|
|
43
|
-
private port?;
|
|
44
|
-
constructor(options: LocalDevManagerConstructorOptions);
|
|
45
|
-
setActiveApp(appUid?: string): Promise<void>;
|
|
46
|
-
setActivePublicAppData(): Promise<void>;
|
|
47
|
-
checkActivePublicAppInstalls(): Promise<void>;
|
|
48
|
-
start(): Promise<void>;
|
|
49
|
-
stop(showProgress?: boolean): Promise<void>;
|
|
50
|
-
checkPublicAppInstallation(): Promise<void>;
|
|
51
|
-
updateKeypressListeners(): void;
|
|
52
|
-
getUploadCommand(): string;
|
|
53
|
-
logUploadWarning(reason?: string): void;
|
|
54
|
-
monitorConsoleOutput(): void;
|
|
55
|
-
compareLocalProjectToDeployed(): void;
|
|
56
|
-
startWatching(): void;
|
|
57
|
-
stopWatching(): Promise<void>;
|
|
58
|
-
handleWatchEvent(filePath: string, event: string, configPaths: string[]): void;
|
|
59
|
-
devServerSetup(): Promise<boolean>;
|
|
60
|
-
devServerStart(): Promise<void>;
|
|
61
|
-
devServerFileChange(filePath: string, event: string): void;
|
|
62
|
-
devServerCleanup(): Promise<boolean>;
|
|
63
|
-
}
|
|
64
|
-
export default LocalDevManager_DEPRECATED;
|