@hubspot/cli 7.7.21-experimental.0 → 7.7.22-experimental.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/bin/cli.js +6 -2
- package/commands/__tests__/getStarted.test.js +0 -10
- package/commands/create/api-sample.d.ts +1 -1
- package/commands/create/app.d.ts +1 -1
- package/commands/create/function.d.ts +1 -1
- package/commands/create/index.d.ts +1 -1
- package/commands/create/module.d.ts +1 -1
- package/commands/create/react-app.d.ts +1 -1
- package/commands/create/template.d.ts +1 -1
- package/commands/create/vue-app.d.ts +1 -1
- package/commands/create/webpack-serverless.d.ts +1 -1
- package/commands/create/website-theme.d.ts +1 -1
- package/commands/create.d.ts +1 -1
- package/commands/getStarted.js +12 -27
- package/commands/mcp/setup.js +1 -0
- package/commands/mcp/start.d.ts +4 -1
- package/commands/mcp/start.js +8 -3
- package/commands/project/__tests__/deploy.test.js +28 -26
- package/commands/project/__tests__/devUnifiedFlow.test.js +19 -16
- package/commands/project/create.js +2 -2
- package/commands/project/deploy.d.ts +3 -2
- package/commands/project/deploy.js +63 -54
- package/commands/project/dev/unifiedFlow.js +7 -6
- package/commands/testAccount/__tests__/createConfig.test.js +0 -3
- package/commands/testAccount/create.js +12 -25
- package/commands/testAccount/createConfig.d.ts +0 -2
- package/commands/testAccount/createConfig.js +8 -9
- package/lang/en.d.ts +40 -23
- package/lang/en.js +41 -24
- package/lang/en.lyaml +0 -26
- package/lib/__tests__/buildAccount.test.js +31 -3
- package/lib/__tests__/usageTracking.test.js +8 -14
- package/lib/buildAccount.d.ts +8 -2
- package/lib/buildAccount.js +54 -5
- package/lib/mcp/setup.js +26 -5
- package/lib/projects/add/legacyAddComponent.js +2 -2
- package/lib/projects/add/v3AddComponent.js +2 -2
- package/lib/projects/localDev/DevServerManager.js +0 -2
- package/lib/projects/localDev/DevServerManagerV2.js +0 -2
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -2
- package/lib/projects/upload.js +1 -1
- package/lib/prompts/createApiSamplePrompt.d.ts +1 -1
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +11 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +73 -31
- package/lib/prompts/promptUtils.js +66 -56
- package/lib/prompts/sandboxesPrompt.d.ts +1 -1
- package/lib/sandboxSync.d.ts +1 -1
- package/lib/sandboxes.d.ts +1 -1
- package/lib/schema.js +5 -1
- package/lib/ui/index.js +1 -1
- package/lib/usageTracking.d.ts +11 -0
- package/lib/usageTracking.js +66 -75
- package/mcp-server/tools/project/AddFeatureToProject.js +4 -1
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/CreateProjectTool.js +4 -1
- package/mcp-server/tools/project/DeployProject.js +4 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -1
- package/mcp-server/tools/project/UploadProjectTools.js +4 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +4 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +1 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +1 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +1 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +1 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +1 -0
- package/mcp-server/utils/__tests__/project.test.js +9 -6
- package/mcp-server/utils/project.js +3 -0
- package/mcp-server/utils/toolUsageTracking.d.ts +1 -0
- package/mcp-server/utils/toolUsageTracking.js +22 -0
- package/package.json +4 -4
- /package/types/{cms.d.ts → Cms.d.ts} +0 -0
- /package/types/{cms.js → Cms.js} +0 -0
- /package/types/{sandboxes.d.ts → Sandboxes.d.ts} +0 -0
- /package/types/{sandboxes.js → Sandboxes.js} +0 -0
package/bin/cli.js
CHANGED
|
@@ -130,8 +130,12 @@ const argv = yargs(process.argv.slice(2))
|
|
|
130
130
|
.wrap(getTerminalWidth())
|
|
131
131
|
.strict().argv;
|
|
132
132
|
if ('help' in argv && argv.help !== undefined) {
|
|
133
|
-
|
|
133
|
+
(async () => {
|
|
134
|
+
await trackHelpUsage(getCommandName(argv));
|
|
135
|
+
})();
|
|
134
136
|
}
|
|
135
137
|
if ('convertFields' in argv && argv.convertFields !== undefined) {
|
|
136
|
-
|
|
138
|
+
(async () => {
|
|
139
|
+
await trackConvertFieldsUsage(getCommandName(argv));
|
|
140
|
+
})();
|
|
137
141
|
}
|
|
@@ -103,9 +103,6 @@ describe('commands/get-started', () => {
|
|
|
103
103
|
promptUser
|
|
104
104
|
.mockResolvedValueOnce({
|
|
105
105
|
default: GET_STARTED_OPTIONS.APP,
|
|
106
|
-
})
|
|
107
|
-
.mockResolvedValueOnce({
|
|
108
|
-
shouldInstallDependencies: true,
|
|
109
106
|
})
|
|
110
107
|
.mockResolvedValueOnce({
|
|
111
108
|
shouldUpload: true,
|
|
@@ -144,13 +141,6 @@ describe('commands/get-started', () => {
|
|
|
144
141
|
}),
|
|
145
142
|
]);
|
|
146
143
|
});
|
|
147
|
-
it('should skip upload when user declines', async () => {
|
|
148
|
-
promptUser
|
|
149
|
-
.mockResolvedValueOnce({ shouldInstallDependencies: false })
|
|
150
|
-
.mockResolvedValueOnce({ shouldUpload: false });
|
|
151
|
-
await getStartedCommand.handler(mockArgs);
|
|
152
|
-
expect(process.exit).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
153
|
-
});
|
|
154
144
|
});
|
|
155
145
|
describe('tracking', () => {
|
|
156
146
|
it('should track command usage', async () => {
|
package/commands/create/app.d.ts
CHANGED
package/commands/create.d.ts
CHANGED
package/commands/getStarted.js
CHANGED
|
@@ -121,35 +121,20 @@ async function handler(args) {
|
|
|
121
121
|
uiLogger.log(' ');
|
|
122
122
|
uiLogger.log(commands.getStarted.prompts.projectCreated.description);
|
|
123
123
|
uiLogger.log(' ');
|
|
124
|
-
// 5. Install dependencies
|
|
124
|
+
// 5. Install dependencies
|
|
125
125
|
const installLocations = await getProjectPackageJsonLocations(projectDest);
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
]);
|
|
134
|
-
if (shouldInstallDependencies) {
|
|
135
|
-
try {
|
|
136
|
-
await installPackages({
|
|
137
|
-
installLocations: installLocations,
|
|
138
|
-
});
|
|
139
|
-
uiLogger.log(' ');
|
|
140
|
-
uiLogger.success(commands.getStarted.logs.dependenciesInstalled);
|
|
141
|
-
uiLogger.log(' ');
|
|
142
|
-
}
|
|
143
|
-
catch (err) {
|
|
144
|
-
uiLogger.log(' ');
|
|
145
|
-
uiLogger.error(commands.getStarted.errors.installDepsFailed);
|
|
146
|
-
logError(err);
|
|
147
|
-
uiLogger.log(' ');
|
|
148
|
-
}
|
|
126
|
+
try {
|
|
127
|
+
await installPackages({
|
|
128
|
+
installLocations: installLocations,
|
|
129
|
+
});
|
|
130
|
+
uiLogger.log(' ');
|
|
131
|
+
uiLogger.success(commands.getStarted.logs.dependenciesInstalled);
|
|
132
|
+
uiLogger.log(' ');
|
|
149
133
|
}
|
|
150
|
-
|
|
134
|
+
catch (err) {
|
|
151
135
|
uiLogger.log(' ');
|
|
152
|
-
uiLogger.
|
|
136
|
+
uiLogger.error(commands.getStarted.errors.installDepsFailed);
|
|
137
|
+
logError(err);
|
|
153
138
|
uiLogger.log(' ');
|
|
154
139
|
}
|
|
155
140
|
// 6. Ask user if they want to upload the project
|
|
@@ -211,7 +196,7 @@ async function handler(args) {
|
|
|
211
196
|
targetAccountId: derivedAccountId,
|
|
212
197
|
env: env,
|
|
213
198
|
appId: lastCreatedApp.id,
|
|
214
|
-
}), { url: true });
|
|
199
|
+
}) + '&tourId=get-started', { url: true });
|
|
215
200
|
uiLogger.log(' ');
|
|
216
201
|
uiLogger.success(commands.getStarted.openedDeveloperOverview);
|
|
217
202
|
}
|
package/commands/mcp/setup.js
CHANGED
package/commands/mcp/start.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { CommonArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
-
|
|
2
|
+
interface McpStartArgs extends CommonArgs {
|
|
3
|
+
aiAgent: string;
|
|
4
|
+
}
|
|
5
|
+
declare const mcpStartCommand: YargsCommandModule<unknown, McpStartArgs>;
|
|
3
6
|
export default mcpStartCommand;
|
package/commands/mcp/start.js
CHANGED
|
@@ -19,9 +19,9 @@ async function handler(args) {
|
|
|
19
19
|
process.exit(EXIT_CODES.ERROR);
|
|
20
20
|
}
|
|
21
21
|
trackCommandUsage('mcp-start', {}, args.derivedAccountId);
|
|
22
|
-
await startMcpServer();
|
|
22
|
+
await startMcpServer(args.aiAgent);
|
|
23
23
|
}
|
|
24
|
-
async function startMcpServer() {
|
|
24
|
+
async function startMcpServer(aiAgent) {
|
|
25
25
|
try {
|
|
26
26
|
const serverPath = path.join(__dirname, '..', '..', 'mcp-server', 'server.js');
|
|
27
27
|
// Check if server file exists
|
|
@@ -31,11 +31,13 @@ async function startMcpServer() {
|
|
|
31
31
|
}
|
|
32
32
|
uiLogger.info(commands.mcp.start.startingServer);
|
|
33
33
|
uiLogger.info(commands.mcp.start.stopInstructions);
|
|
34
|
+
const args = [serverPath];
|
|
34
35
|
// Start the server using ts-node
|
|
35
|
-
const child = spawn(
|
|
36
|
+
const child = spawn(`node`, args, {
|
|
36
37
|
stdio: 'inherit',
|
|
37
38
|
env: {
|
|
38
39
|
...process.env,
|
|
40
|
+
HUBSPOT_MCP_AI_AGENT: aiAgent || 'unknown',
|
|
39
41
|
},
|
|
40
42
|
});
|
|
41
43
|
// Handle server process events
|
|
@@ -58,6 +60,9 @@ async function startMcpServer() {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
function startBuilder(yargs) {
|
|
63
|
+
yargs.option('ai-agent', {
|
|
64
|
+
type: 'string',
|
|
65
|
+
});
|
|
61
66
|
return yargs;
|
|
62
67
|
}
|
|
63
68
|
const builder = makeYargsBuilder(startBuilder, command, describe, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HttpStatusCode } from 'axios';
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
-
import * as configUtils from '@hubspot/local-dev-lib/config';
|
|
5
4
|
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
5
|
+
import * as configUtils from '@hubspot/local-dev-lib/config';
|
|
6
6
|
import * as projectApiUtils from '@hubspot/local-dev-lib/api/projects';
|
|
7
7
|
import * as ui from '../../../lib/ui/index.js';
|
|
8
|
-
import { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } from '../../../lib/commonOpts.js';
|
|
8
|
+
import { addAccountOptions, addConfigOptions, addJSONOutputOptions, addUseEnvironmentOptions, } from '../../../lib/commonOpts.js';
|
|
9
9
|
import * as projectUtils from '../../../lib/projects/config.js';
|
|
10
10
|
import * as projectUrlUtils from '../../../lib/projects/urls.js';
|
|
11
11
|
import { pollDeployStatus } from '../../../lib/projects/buildAndDeploy.js';
|
|
@@ -16,7 +16,7 @@ import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
|
16
16
|
import exampleProject from './fixtures/exampleProject.json' with { type: 'json' };
|
|
17
17
|
import { mockHubSpotHttpResponse, mockHubSpotHttpError, } from '../../../lib/testUtils.js';
|
|
18
18
|
import projectDeployCommand from '../deploy.js';
|
|
19
|
-
|
|
19
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
20
20
|
vi.mock('@hubspot/local-dev-lib/api/projects');
|
|
21
21
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
22
22
|
vi.mock('../../../lib/commonOpts');
|
|
@@ -27,8 +27,9 @@ vi.mock('../../../lib/projects/buildAndDeploy');
|
|
|
27
27
|
vi.mock('../../../lib/prompts/projectNamePrompt');
|
|
28
28
|
vi.mock('../../../lib/prompts/promptUtils');
|
|
29
29
|
vi.mock('../../../lib/usageTracking');
|
|
30
|
+
vi.mock('../../../lib/ui/logger');
|
|
31
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
30
32
|
vi.spyOn(ui, 'uiLine');
|
|
31
|
-
const uiLinkSpy = vi.spyOn(ui, 'uiLink').mockImplementation(text => text);
|
|
32
33
|
const uiCommandReferenceSpy = vi.spyOn(ui, 'uiCommandReference');
|
|
33
34
|
const uiAccountDescriptionSpy = vi.spyOn(ui, 'uiAccountDescription');
|
|
34
35
|
const getProjectConfigSpy = vi.spyOn(projectUtils, 'getProjectConfig');
|
|
@@ -51,6 +52,7 @@ const conflictsSpy = vi
|
|
|
51
52
|
describe('commands/project/deploy', () => {
|
|
52
53
|
const projectFlag = 'project';
|
|
53
54
|
const buildFlag = 'build';
|
|
55
|
+
const deployLatestBuildFlag = 'deployLatestBuild';
|
|
54
56
|
const profileFlag = 'profile';
|
|
55
57
|
const forceFlag = 'force';
|
|
56
58
|
describe('command', () => {
|
|
@@ -79,6 +81,11 @@ describe('commands/project/deploy', () => {
|
|
|
79
81
|
alias: ['build-id'],
|
|
80
82
|
type: 'number',
|
|
81
83
|
}),
|
|
84
|
+
[deployLatestBuildFlag]: expect.objectContaining({
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
alias: ['deploy-latest-build'],
|
|
87
|
+
default: false,
|
|
88
|
+
}),
|
|
82
89
|
[profileFlag]: expect.objectContaining({
|
|
83
90
|
type: 'string',
|
|
84
91
|
alias: ['p'],
|
|
@@ -95,6 +102,8 @@ describe('commands/project/deploy', () => {
|
|
|
95
102
|
expect(addAccountOptions).toHaveBeenCalledWith(yargs);
|
|
96
103
|
expect(addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
97
104
|
expect(addUseEnvironmentOptions).toHaveBeenCalledWith(yargs);
|
|
105
|
+
expect(addJSONOutputOptions).toHaveBeenCalledTimes(1);
|
|
106
|
+
expect(addJSONOutputOptions).toHaveBeenCalledWith(yargs);
|
|
98
107
|
});
|
|
99
108
|
it('should provide examples', () => {
|
|
100
109
|
projectDeployCommand.builder(yargs);
|
|
@@ -108,9 +117,9 @@ describe('commands/project/deploy', () => {
|
|
|
108
117
|
const projectNameFromPrompt = 'project name from prompt';
|
|
109
118
|
const deployDetails = {
|
|
110
119
|
id: 123,
|
|
120
|
+
buildResultType: 'DEPLOY_QUEUED',
|
|
111
121
|
};
|
|
112
122
|
const projectDetailUrl = 'http://project-details-page-url.com';
|
|
113
|
-
const viewProjectsInHubSpot = 'View project builds in HubSpot';
|
|
114
123
|
beforeEach(() => {
|
|
115
124
|
args = {
|
|
116
125
|
project: 'project name from options',
|
|
@@ -130,9 +139,6 @@ describe('commands/project/deploy', () => {
|
|
|
130
139
|
projectName: projectNameFromPrompt,
|
|
131
140
|
});
|
|
132
141
|
getProjectDetailUrlSpy.mockReturnValue(projectDetailUrl);
|
|
133
|
-
uiLinkSpy.mockImplementation(text => {
|
|
134
|
-
return text;
|
|
135
|
-
});
|
|
136
142
|
getAccountConfigSpy.mockReturnValue({ accountType, env: 'qa' });
|
|
137
143
|
fetchProjectSpy.mockReturnValue(mockHubSpotHttpResponse(exampleProject));
|
|
138
144
|
deployProjectSpy.mockReturnValue(mockHubSpotHttpResponse(deployDetails));
|
|
@@ -195,28 +201,24 @@ describe('commands/project/deploy', () => {
|
|
|
195
201
|
it('should log an error and exit when latest build is not defined', async () => {
|
|
196
202
|
fetchProjectSpy.mockReturnValue(mockHubSpotHttpResponse({}));
|
|
197
203
|
await projectDeployCommand.handler(args);
|
|
198
|
-
expect(
|
|
199
|
-
expect(
|
|
204
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
205
|
+
expect(uiLogger.error).toHaveBeenCalledWith('Deploy error: no builds for this project were found.');
|
|
200
206
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
201
207
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
202
208
|
});
|
|
203
209
|
it('should log an error and exit when buildId option is not a valid build', async () => {
|
|
204
210
|
args.buildId = exampleProject.latestBuild.buildId + 1;
|
|
205
211
|
await projectDeployCommand.handler(args);
|
|
206
|
-
expect(
|
|
207
|
-
expect(
|
|
208
|
-
expect(logger.error).toHaveBeenCalledTimes(1);
|
|
209
|
-
expect(logger.error).toHaveBeenCalledWith(`Build ${args.buildId} does not exist for project ${projectNameFromPrompt}. ${viewProjectsInHubSpot}`);
|
|
212
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
213
|
+
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringMatching(`Build ${args.buildId} does not exist for project`));
|
|
210
214
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
211
215
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
212
216
|
});
|
|
213
217
|
it('should log an error and exit when buildId option is already deployed', async () => {
|
|
214
218
|
args.buildId = exampleProject.deployedBuildId;
|
|
215
219
|
await projectDeployCommand.handler(args);
|
|
216
|
-
expect(
|
|
217
|
-
expect(
|
|
218
|
-
expect(logger.error).toHaveBeenCalledTimes(1);
|
|
219
|
-
expect(logger.error).toHaveBeenCalledWith(`Build ${args.buildId} is already deployed. ${viewProjectsInHubSpot}`);
|
|
220
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
221
|
+
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringMatching(`Build ${args.buildId} is already deployed. View project builds in HubSpot.`));
|
|
220
222
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
221
223
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
222
224
|
});
|
|
@@ -233,8 +235,8 @@ describe('commands/project/deploy', () => {
|
|
|
233
235
|
promptUserSpy.mockResolvedValue({});
|
|
234
236
|
await projectDeployCommand.handler(args);
|
|
235
237
|
expect(promptUserSpy).toHaveBeenCalledTimes(1);
|
|
236
|
-
expect(
|
|
237
|
-
expect(
|
|
238
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
239
|
+
expect(uiLogger.error).toHaveBeenCalledWith('You must specify a build to deploy');
|
|
238
240
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
239
241
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
240
242
|
});
|
|
@@ -247,8 +249,8 @@ describe('commands/project/deploy', () => {
|
|
|
247
249
|
// @ts-expect-error Testing an edge case where the response is empty
|
|
248
250
|
deployProjectSpy.mockResolvedValue({});
|
|
249
251
|
await projectDeployCommand.handler(args);
|
|
250
|
-
expect(
|
|
251
|
-
expect(
|
|
252
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
253
|
+
expect(uiLogger.error).toHaveBeenCalledWith(`Deploy error: an unknown error occurred.`);
|
|
252
254
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
253
255
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
254
256
|
});
|
|
@@ -269,8 +271,8 @@ describe('commands/project/deploy', () => {
|
|
|
269
271
|
});
|
|
270
272
|
});
|
|
271
273
|
await projectDeployCommand.handler(args);
|
|
272
|
-
expect(
|
|
273
|
-
expect(
|
|
274
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
275
|
+
expect(uiLogger.error).toHaveBeenCalledWith(`The project ${chalk.bold(projectNameFromPrompt)} does not exist in account ${accountDescription}. Run ${commandReference} to upload your project files to HubSpot.`);
|
|
274
276
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
275
277
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
276
278
|
});
|
|
@@ -283,8 +285,8 @@ describe('commands/project/deploy', () => {
|
|
|
283
285
|
});
|
|
284
286
|
});
|
|
285
287
|
await projectDeployCommand.handler(args);
|
|
286
|
-
expect(
|
|
287
|
-
expect(
|
|
288
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
289
|
+
expect(uiLogger.error).toHaveBeenCalledWith('The request was bad.');
|
|
288
290
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
289
291
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
290
292
|
});
|
|
@@ -64,9 +64,9 @@ describe('unifiedProjectDevFlow', () => {
|
|
|
64
64
|
const mockProjectDir = '/test/project.js';
|
|
65
65
|
const mockTargetProjectAccountId = 123;
|
|
66
66
|
const mockProvidedTargetTestingAccountId = 456;
|
|
67
|
-
const mockProfileConfig = {
|
|
68
|
-
|
|
69
|
-
};
|
|
67
|
+
// const mockProfileConfig: HsProfileFile = {
|
|
68
|
+
// accountId: 789,
|
|
69
|
+
// };
|
|
70
70
|
const mockAccountConfig = {
|
|
71
71
|
accountId: 123,
|
|
72
72
|
name: 'test-account',
|
|
@@ -152,18 +152,21 @@ describe('unifiedProjectDevFlow', () => {
|
|
|
152
152
|
expect(mockLocalDevWatcher.start).toHaveBeenCalled();
|
|
153
153
|
expect(mockWebsocketServer.start).toHaveBeenCalled();
|
|
154
154
|
});
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
155
|
+
// TODO: Restore test once we've switched back to using profile account for testing
|
|
156
|
+
// it('should complete successfully with profile config', async () => {
|
|
157
|
+
// await unifiedProjectDevFlow({
|
|
158
|
+
// args: mockArgs,
|
|
159
|
+
// targetProjectAccountId: mockTargetProjectAccountId,
|
|
160
|
+
// projectConfig: mockProjectConfig,
|
|
161
|
+
// projectDir: mockProjectDir,
|
|
162
|
+
// profileConfig: mockProfileConfig,
|
|
163
|
+
// });
|
|
164
|
+
// expect(LocalDevProcess).toHaveBeenCalledWith(
|
|
165
|
+
// expect.objectContaining({
|
|
166
|
+
// targetTestingAccountId: mockProfileConfig.accountId,
|
|
167
|
+
// })
|
|
168
|
+
// );
|
|
169
|
+
// });
|
|
167
170
|
it('should use target project account as testing account when it is a test account', async () => {
|
|
168
171
|
isTestAccountOrSandbox.mockReturnValue(true);
|
|
169
172
|
await unifiedProjectDevFlow({
|
|
@@ -253,7 +256,7 @@ describe('unifiedProjectDevFlow', () => {
|
|
|
253
256
|
projectConfig: mockProjectConfig,
|
|
254
257
|
projectDir: mockProjectDir,
|
|
255
258
|
});
|
|
256
|
-
expect(createDeveloperTestAccountForLocalDev).toHaveBeenCalledWith(mockTargetProjectAccountId, mockAccountConfig, ENVIRONMENTS.PROD);
|
|
259
|
+
expect(createDeveloperTestAccountForLocalDev).toHaveBeenCalledWith(mockTargetProjectAccountId, mockAccountConfig, ENVIRONMENTS.PROD, true);
|
|
257
260
|
expect(LocalDevProcess).toHaveBeenCalledWith(expect.objectContaining({
|
|
258
261
|
targetTestingAccountId: 999,
|
|
259
262
|
}));
|
|
@@ -9,7 +9,7 @@ import { PROJECT_WITH_APP, EMPTY_PROJECT, } from '../../lib/projects/create/v3.j
|
|
|
9
9
|
import { uiBetaTag, uiFeatureHighlight } from '../../lib/ui/index.js';
|
|
10
10
|
import { debugError, logError } from '../../lib/errorHandlers/index.js';
|
|
11
11
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
12
|
-
import { PROJECT_CONFIG_FILE, HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, marketplaceDistribution, privateDistribution, oAuth, staticAuth, } from '../../lib/constants.js';
|
|
12
|
+
import { PROJECT_CONFIG_FILE, HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, marketplaceDistribution, privateDistribution, oAuth, staticAuth, DEFAULT_PROJECT_TEMPLATE_BRANCH, } from '../../lib/constants.js';
|
|
13
13
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
14
14
|
import { PLATFORM_VERSIONS } from '@hubspot/local-dev-lib/constants/projects';
|
|
15
15
|
import { commands } from '../../lang/en.js';
|
|
@@ -63,7 +63,7 @@ async function handler(args) {
|
|
|
63
63
|
await cloneGithubRepo(repo, projectDest, {
|
|
64
64
|
sourceDir: selectProjectTemplatePromptResponse.projectTemplate?.path || components,
|
|
65
65
|
hideLogs: true,
|
|
66
|
-
branch:
|
|
66
|
+
branch: DEFAULT_PROJECT_TEMPLATE_BRANCH,
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
catch (err) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
-
export type ProjectDeployArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, JSONOutputArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
export type ProjectDeployArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & JSONOutputArgs & {
|
|
3
3
|
project?: string;
|
|
4
4
|
build?: number;
|
|
5
5
|
buildId?: number;
|
|
6
6
|
profile?: string;
|
|
7
|
+
deployLatestBuild: boolean;
|
|
7
8
|
force: boolean;
|
|
8
9
|
};
|
|
9
10
|
declare const projectDeployCommand: YargsCommandModule<unknown, ProjectDeployArgs>;
|