@hubspot/cli 7.8.0-experimental.0 → 7.8.2-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 +0 -2
- package/commands/__tests__/getStarted.test.js +2 -2
- package/commands/__tests__/mcp.test.js +1 -1
- package/commands/__tests__/project.test.js +0 -3
- package/commands/app/__tests__/migrate.test.js +0 -1
- package/commands/app/migrate.js +4 -5
- package/commands/app/secret/add.js +2 -1
- package/commands/app/secret/delete.js +2 -1
- package/commands/app/secret/list.js +2 -1
- package/commands/app/secret/update.js +2 -1
- package/commands/app/secret.js +2 -1
- package/commands/app.js +2 -2
- package/commands/config/set.js +0 -1
- package/commands/feedback.js +1 -1
- package/commands/getStarted.d.ts +1 -3
- package/commands/getStarted.js +66 -18
- package/commands/mcp/__tests__/setup.test.js +2 -2
- package/commands/mcp/setup.js +11 -2
- package/commands/mcp.js +3 -3
- package/commands/project/__tests__/create.test.js +6 -6
- package/commands/project/__tests__/deploy.test.js +0 -3
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -4
- package/commands/project/__tests__/logs.test.js +0 -3
- package/commands/project/__tests__/migrate.test.js +1 -2
- package/commands/project/__tests__/migrateApp.test.js +1 -2
- package/commands/project/__tests__/profile.test.js +1 -1
- package/commands/project/add.js +1 -5
- package/commands/project/create.js +3 -9
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/index.js +4 -3
- package/commands/project/dev/unifiedFlow.js +6 -4
- package/commands/project/download.js +1 -2
- package/commands/project/installDeps.js +1 -2
- package/commands/project/listBuilds.js +2 -2
- package/commands/project/logs.js +2 -2
- package/commands/project/migrate.js +28 -10
- package/commands/project/migrateApp.js +1 -2
- package/commands/project/open.js +1 -2
- package/commands/project/profile/add.js +3 -3
- package/commands/project/profile/delete.js +1 -2
- package/commands/project/profile.js +2 -3
- package/commands/project/upload.js +2 -2
- package/commands/project/validate.js +1 -1
- package/commands/project/watch.js +2 -2
- package/commands/project.js +1 -2
- package/commands/sandbox/delete.js +1 -1
- package/commands/testAccount/importData.d.ts +1 -1
- package/commands/testAccount/importData.js +1 -1
- package/commands/testAccount.js +1 -1
- package/lang/en.d.ts +15 -4
- package/lang/en.js +18 -6
- package/lib/__tests__/hasFeature.test.js +145 -7
- package/lib/app/__tests__/migrate.test.js +14 -51
- package/lib/app/migrate.d.ts +2 -8
- package/lib/app/migrate.js +5 -80
- package/lib/constants.d.ts +8 -0
- package/lib/constants.js +8 -0
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +0 -9
- package/lib/hasFeature.js +6 -0
- package/lib/links.d.ts +1 -0
- package/lib/links.js +10 -3
- package/lib/mcp/setup.js +1 -1
- package/lib/middleware/fireAlarmMiddleware.js +15 -5
- package/lib/projects/__tests__/LocalDevProcess.test.js +227 -16
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +16 -21
- package/lib/projects/__tests__/deploy.test.js +71 -6
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +4 -2
- package/lib/projects/create/__tests__/v3.test.js +79 -4
- package/lib/projects/create/v3.js +11 -8
- package/lib/projects/localDev/AppDevModeInterface.js +5 -5
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +22 -0
- package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
- package/lib/projects/localDev/LocalDevProcess.js +90 -19
- package/lib/projects/localDev/LocalDevState.d.ts +9 -8
- package/lib/projects/localDev/LocalDevState.js +18 -17
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +2 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +55 -23
- package/lib/projects/localDev/helpers/project.d.ts +2 -2
- package/lib/projects/localDev/helpers/project.js +10 -7
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +4 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +10 -0
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
- package/lib/prompts/projectAddPrompt.js +2 -1
- package/lib/prompts/promptUtils.js +3 -0
- package/lib/prompts/selectProjectTemplatePrompt.js +2 -0
- package/lib/theme/__tests__/migrate.test.d.ts +1 -0
- package/lib/theme/__tests__/migrate.test.js +233 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +90 -0
- package/lib/ui/SpinniesManager.js +105 -8
- package/lib/usageTracking.js +2 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +1 -1
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +3 -3
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +5 -5
- package/mcp-server/tools/project/DeployProjectTool.js +1 -1
- package/mcp-server/tools/project/DocFetchTool.js +2 -2
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +7 -7
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +11 -5
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +2 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +1 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +14 -12
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +9 -8
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +1 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/constants.d.ts +1 -1
- package/mcp-server/tools/project/constants.js +9 -3
- package/mcp-server/utils/__tests__/cliConfig.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/cliConfig.test.js +110 -0
- package/mcp-server/utils/cliConfig.d.ts +1 -0
- package/mcp-server/utils/cliConfig.js +12 -0
- package/package.json +4 -9
- package/types/LocalDev.d.ts +19 -3
- package/ui/components/HorizontalSelectPrompt.js +1 -1
- package/ui/index.js +1 -1
- package/commands/getStartedV2.d.ts +0 -9
- package/commands/getStartedV2.js +0 -39
- package/ui/components/Ascii.d.ts +0 -10
- package/ui/components/Ascii.js +0 -11
- package/ui/views/GetStarted.d.ts +0 -7
- package/ui/views/GetStarted.js +0 -157
|
@@ -2,10 +2,13 @@ import { WebSocketServer } from 'ws';
|
|
|
2
2
|
import { isPortManagerServerRunning, requestPorts, } from '@hubspot/local-dev-lib/portManager';
|
|
3
3
|
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
4
|
import { addLocalStateFlag } from '@hubspot/local-dev-lib/config';
|
|
5
|
-
import { LOCAL_DEV_UI_MESSAGE_SEND_TYPES,
|
|
5
|
+
import { LOCAL_DEV_UI_MESSAGE_SEND_TYPES, LOCAL_DEV_SERVER_MESSAGE_TYPES, CONFIG_LOCAL_STATE_FLAGS, } from '../../constants.js';
|
|
6
6
|
import { lib } from '../../../lang/en.js';
|
|
7
7
|
import { removeAnsiCodes } from '../../ui/removeAnsiCodes.js';
|
|
8
|
+
import { isDeployWebsocketMessage, isViewedWelcomeScreenWebsocketMessage, isUploadWebsocketMessage, } from './localDevWebsocketServerUtils.js';
|
|
9
|
+
import pkg from '../../../package.json' with { type: 'json' };
|
|
8
10
|
const SERVER_INSTANCE_ID = 'local-dev-ui-websocket-server';
|
|
11
|
+
const LOCAL_DEV_WEBSOCKET_SERVER_VERSION = 1;
|
|
9
12
|
const LOG_PREFIX = '[LocalDevWebsocketServer]';
|
|
10
13
|
class LocalDevWebsocketServer {
|
|
11
14
|
server;
|
|
@@ -35,17 +38,32 @@ class LocalDevWebsocketServer {
|
|
|
35
38
|
websocket.send(JSON.stringify(message));
|
|
36
39
|
}
|
|
37
40
|
async handleUpload(websocket) {
|
|
38
|
-
const uploadSuccess = await this.localDevProcess.uploadProject();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
const { uploadSuccess, buildSuccess, deploySuccess, deployId } = await this.localDevProcess.uploadProject();
|
|
42
|
+
this.sendMessage(websocket, {
|
|
43
|
+
type: uploadSuccess
|
|
44
|
+
? LOCAL_DEV_UI_MESSAGE_SEND_TYPES.UPLOAD_SUCCESS
|
|
45
|
+
: LOCAL_DEV_UI_MESSAGE_SEND_TYPES.UPLOAD_FAILURE,
|
|
46
|
+
data: {
|
|
47
|
+
latestBuild: this.localDevProcess.projectData.latestBuild,
|
|
48
|
+
deployedBuild: this.localDevProcess.projectData.deployedBuild,
|
|
49
|
+
buildSuccess,
|
|
50
|
+
deploySuccess,
|
|
51
|
+
deployId,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async handleDeploy(websocket, force) {
|
|
56
|
+
const { success, deployId } = await this.localDevProcess.deployLatestBuild(force);
|
|
57
|
+
this.sendMessage(websocket, {
|
|
58
|
+
type: success
|
|
59
|
+
? LOCAL_DEV_UI_MESSAGE_SEND_TYPES.DEPLOY_SUCCESS
|
|
60
|
+
: LOCAL_DEV_UI_MESSAGE_SEND_TYPES.DEPLOY_FAILURE,
|
|
61
|
+
data: {
|
|
62
|
+
latestBuild: this.localDevProcess.projectData.latestBuild,
|
|
63
|
+
deployedBuild: this.localDevProcess.projectData.deployedBuild,
|
|
64
|
+
latestDeployId: deployId,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
49
67
|
}
|
|
50
68
|
setupMessageHandlers(websocket) {
|
|
51
69
|
websocket.on('message', data => {
|
|
@@ -55,15 +73,17 @@ class LocalDevWebsocketServer {
|
|
|
55
73
|
this.logError(lib.LocalDevWebsocketServer.errors.missingTypeField(data.toString()));
|
|
56
74
|
return;
|
|
57
75
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
if (isUploadWebsocketMessage(message)) {
|
|
77
|
+
this.handleUpload(websocket);
|
|
78
|
+
}
|
|
79
|
+
else if (isDeployWebsocketMessage(message)) {
|
|
80
|
+
this.handleDeploy(websocket, message.data.force);
|
|
81
|
+
}
|
|
82
|
+
else if (isViewedWelcomeScreenWebsocketMessage(message)) {
|
|
83
|
+
addLocalStateFlag(CONFIG_LOCAL_STATE_FLAGS.LOCAL_DEV_UI_WELCOME);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.logError(lib.LocalDevWebsocketServer.errors.unknownMessageType(message.type));
|
|
67
87
|
}
|
|
68
88
|
}
|
|
69
89
|
catch (e) {
|
|
@@ -71,12 +91,23 @@ class LocalDevWebsocketServer {
|
|
|
71
91
|
}
|
|
72
92
|
});
|
|
73
93
|
}
|
|
94
|
+
sendCliMetadata(websocket) {
|
|
95
|
+
this.sendMessage(websocket, {
|
|
96
|
+
type: LOCAL_DEV_UI_MESSAGE_SEND_TYPES.CLI_METADATA,
|
|
97
|
+
data: {
|
|
98
|
+
cliVersion: pkg.version,
|
|
99
|
+
localDevWebsocketServerVersion: LOCAL_DEV_WEBSOCKET_SERVER_VERSION,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
74
103
|
sendProjectData(websocket) {
|
|
75
104
|
this.sendMessage(websocket, {
|
|
76
105
|
type: LOCAL_DEV_UI_MESSAGE_SEND_TYPES.UPDATE_PROJECT_DATA,
|
|
77
106
|
data: {
|
|
78
|
-
projectName: this.localDevProcess.
|
|
79
|
-
projectId: this.localDevProcess.
|
|
107
|
+
projectName: this.localDevProcess.projectData.name,
|
|
108
|
+
projectId: this.localDevProcess.projectData.id,
|
|
109
|
+
latestBuild: this.localDevProcess.projectData.latestBuild,
|
|
110
|
+
deployedBuild: this.localDevProcess.projectData.deployedBuild,
|
|
80
111
|
targetProjectAccountId: this.localDevProcess.targetProjectAccountId,
|
|
81
112
|
targetTestingAccountId: this.localDevProcess.targetTestingAccountId,
|
|
82
113
|
},
|
|
@@ -139,6 +170,7 @@ class LocalDevWebsocketServer {
|
|
|
139
170
|
ws.close(1008, lib.LocalDevWebsocketServer.errors.originNotAllowed(origin));
|
|
140
171
|
return;
|
|
141
172
|
}
|
|
173
|
+
this.sendCliMetadata(ws);
|
|
142
174
|
this.sendProjectData(ws);
|
|
143
175
|
this.setupMessageHandlers(ws);
|
|
144
176
|
this.setupStateListeners(ws);
|
|
@@ -6,7 +6,7 @@ export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig
|
|
|
6
6
|
export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIR?: boolean, profile?: string): Promise<Build>;
|
|
7
7
|
export declare function compareLocalProjectToDeployed(projectConfig: ProjectConfig, accountId: number, deployedBuildId: number | undefined, localProjectNodes: {
|
|
8
8
|
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
9
|
-
}): Promise<void>;
|
|
9
|
+
}, profile?: string): Promise<void>;
|
|
10
10
|
export declare function isDeployedProjectUpToDateWithLocal(projectConfig: ProjectConfig, accountId: number, deployedBuildId: number, localProjectNodes: {
|
|
11
11
|
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
12
|
-
}): Promise<boolean>;
|
|
12
|
+
}, profile?: string): Promise<boolean>;
|
|
@@ -18,7 +18,7 @@ import SpinniesManager from '../../../ui/SpinniesManager.js';
|
|
|
18
18
|
import { EXIT_CODES } from '../../../enums/exitCodes.js';
|
|
19
19
|
import { handleProjectUpload } from '../../upload.js';
|
|
20
20
|
import { pollProjectBuildAndDeploy } from '../../pollProjectBuildAndDeploy.js';
|
|
21
|
-
import { logError } from '../../../errorHandlers/index.js';
|
|
21
|
+
import { debugError, logError } from '../../../errorHandlers/index.js';
|
|
22
22
|
import { ApiErrorContext } from '../../../errorHandlers/index.js';
|
|
23
23
|
// Prompt the user to create a new project if one doesn't exist on their target account
|
|
24
24
|
export async function createNewProjectForLocalDev(projectConfig, targetAccountId, shouldCreateWithoutConfirmation, hasPublicApps) {
|
|
@@ -123,7 +123,7 @@ export async function createInitialBuildForNewProject(projectConfig, projectDir,
|
|
|
123
123
|
}
|
|
124
124
|
return initialUploadResult.buildResult;
|
|
125
125
|
}
|
|
126
|
-
export async function compareLocalProjectToDeployed(projectConfig, accountId, deployedBuildId, localProjectNodes) {
|
|
126
|
+
export async function compareLocalProjectToDeployed(projectConfig, accountId, deployedBuildId, localProjectNodes, profile) {
|
|
127
127
|
uiLogger.log('');
|
|
128
128
|
if (!deployedBuildId) {
|
|
129
129
|
uiLogger.error(lib.localDevHelpers.project.compareLocalProjectToDeployed.noDeployedBuild(projectConfig.name, uiAccountDescription(accountId)));
|
|
@@ -132,7 +132,7 @@ export async function compareLocalProjectToDeployed(projectConfig, accountId, de
|
|
|
132
132
|
SpinniesManager.add('compareLocalProjectToDeployed', {
|
|
133
133
|
text: lib.localDevHelpers.project.compareLocalProjectToDeployed.checking,
|
|
134
134
|
});
|
|
135
|
-
const isUpToDate = await isDeployedProjectUpToDateWithLocal(projectConfig, accountId, deployedBuildId, localProjectNodes);
|
|
135
|
+
const isUpToDate = await isDeployedProjectUpToDateWithLocal(projectConfig, accountId, deployedBuildId, localProjectNodes, profile);
|
|
136
136
|
if (isUpToDate) {
|
|
137
137
|
SpinniesManager.succeed('compareLocalProjectToDeployed', {
|
|
138
138
|
text: lib.localDevHelpers.project.compareLocalProjectToDeployed.upToDate,
|
|
@@ -144,12 +144,11 @@ export async function compareLocalProjectToDeployed(projectConfig, accountId, de
|
|
|
144
144
|
.notUpToDate,
|
|
145
145
|
});
|
|
146
146
|
uiLogger.log('');
|
|
147
|
-
uiLogger.log(lib.localDevHelpers.project.compareLocalProjectToDeployed
|
|
148
|
-
.notUpToDateExplanation);
|
|
147
|
+
uiLogger.log(lib.localDevHelpers.project.compareLocalProjectToDeployed.notUpToDateExplanation(profile));
|
|
149
148
|
process.exit(EXIT_CODES.SUCCESS);
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
|
-
export async function isDeployedProjectUpToDateWithLocal(projectConfig, accountId, deployedBuildId, localProjectNodes) {
|
|
151
|
+
export async function isDeployedProjectUpToDateWithLocal(projectConfig, accountId, deployedBuildId, localProjectNodes, profile) {
|
|
153
152
|
let tempDir = null;
|
|
154
153
|
try {
|
|
155
154
|
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'hubspot-project-compare-'));
|
|
@@ -161,9 +160,13 @@ export async function isDeployedProjectUpToDateWithLocal(projectConfig, accountI
|
|
|
161
160
|
projectSourceDir: deployedProjectSourceDir,
|
|
162
161
|
platformVersion: projectConfig.platformVersion,
|
|
163
162
|
accountId: accountId,
|
|
164
|
-
}, {});
|
|
163
|
+
}, { profile });
|
|
165
164
|
return isDeepEqual(localProjectNodes, deployedProjectNodes, ['localDev']);
|
|
166
165
|
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
debugError(err);
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
167
170
|
finally {
|
|
168
171
|
// Clean up temporary directory
|
|
169
172
|
if (tempDir && (await fs.pathExists(tempDir))) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LocalDevDeployWebsocketMessage, LocalDevWebsocketMessage } from '../../../types/LocalDev.js';
|
|
2
|
+
export declare function isUploadWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|
|
3
|
+
export declare function isDeployWebsocketMessage(message: LocalDevWebsocketMessage): message is LocalDevDeployWebsocketMessage;
|
|
4
|
+
export declare function isViewedWelcomeScreenWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES } from '../../constants.js';
|
|
2
|
+
export function isUploadWebsocketMessage(message) {
|
|
3
|
+
return message.type === LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES.UPLOAD;
|
|
4
|
+
}
|
|
5
|
+
export function isDeployWebsocketMessage(message) {
|
|
6
|
+
return message.type === LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES.DEPLOY;
|
|
7
|
+
}
|
|
8
|
+
export function isViewedWelcomeScreenWebsocketMessage(message) {
|
|
9
|
+
return (message.type === LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES.VIEWED_WELCOME_SCREEN);
|
|
10
|
+
}
|
|
@@ -278,10 +278,10 @@ export async function displayWarnLogs(accountId, projectName, taskId, isDeploy =
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
if (result && result.logs) {
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
uiLogger.warn(log
|
|
284
|
-
if (i <
|
|
281
|
+
const dedupedLogs = result.logs.reduce((acc, log) => acc.add(log.message), new Set());
|
|
282
|
+
Array.from(dedupedLogs).forEach((log, i) => {
|
|
283
|
+
uiLogger.warn(log);
|
|
284
|
+
if (i < dedupedLogs.size - 1) {
|
|
285
285
|
uiLogger.log('');
|
|
286
286
|
}
|
|
287
287
|
});
|
|
@@ -62,10 +62,11 @@ export async function projectAddPromptV3(components, selectedFeatures) {
|
|
|
62
62
|
const result = await promptUser([
|
|
63
63
|
{
|
|
64
64
|
name: 'componentTemplate',
|
|
65
|
-
message: lib.prompts.projectAddPrompt.
|
|
65
|
+
message: lib.prompts.projectAddPrompt.selectFeatures,
|
|
66
66
|
when: !selectedFeatures && selectedComponents.length === 0,
|
|
67
67
|
type: 'checkbox',
|
|
68
68
|
choices: components,
|
|
69
|
+
pageSize: components.length,
|
|
69
70
|
},
|
|
70
71
|
]);
|
|
71
72
|
if (!result.componentTemplate) {
|
|
@@ -133,6 +133,9 @@ function handleCheckboxPrompt(config) {
|
|
|
133
133
|
validate: config.validate,
|
|
134
134
|
loop: config.loop,
|
|
135
135
|
theme: PROMPT_THEME,
|
|
136
|
+
shortcuts: {
|
|
137
|
+
invert: null,
|
|
138
|
+
},
|
|
136
139
|
}).then(resp => ({ [config.name]: resp }));
|
|
137
140
|
}
|
|
138
141
|
function handleConfirmPrompt(config) {
|
|
@@ -51,6 +51,8 @@ export async function selectProjectTemplatePrompt(promptOptions, projectTemplate
|
|
|
51
51
|
selectedComponents.length === 0,
|
|
52
52
|
type: 'checkbox',
|
|
53
53
|
choices: componentTemplates,
|
|
54
|
+
loop: false,
|
|
55
|
+
pageSize: componentTemplates?.length,
|
|
54
56
|
},
|
|
55
57
|
]);
|
|
56
58
|
if (!result.componentTemplates) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { getProjectThemeDetails, migrateThemes, } from '@hubspot/project-parsing-lib';
|
|
2
|
+
import { confirmPrompt } from '../../prompts/promptUtils.js';
|
|
3
|
+
import { writeProjectConfig, } from '../../projects/config.js';
|
|
4
|
+
import { ensureProjectExists } from '../../projects/ensureProjectExists.js';
|
|
5
|
+
import { useV3Api } from '../../projects/platformVersion.js';
|
|
6
|
+
import { fetchMigrationApps } from '../../app/migrate.js';
|
|
7
|
+
import { getHasMigratableThemes, validateMigrationAppsAndThemes, handleThemesMigration, migrateThemes2025_2, } from '../migrate.js';
|
|
8
|
+
import { lib } from '../../../lang/en.js';
|
|
9
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
10
|
+
vi.mock('@hubspot/project-parsing-lib');
|
|
11
|
+
vi.mock('../../prompts/promptUtils');
|
|
12
|
+
vi.mock('../../projects/config');
|
|
13
|
+
vi.mock('../../projects/ensureProjectExists');
|
|
14
|
+
vi.mock('../../projects/platformVersion');
|
|
15
|
+
vi.mock('../../app/migrate');
|
|
16
|
+
const mockedGetProjectThemeDetails = getProjectThemeDetails;
|
|
17
|
+
const mockedMigrateThemes = migrateThemes;
|
|
18
|
+
const mockedConfirmPrompt = confirmPrompt;
|
|
19
|
+
const mockedWriteProjectConfig = writeProjectConfig;
|
|
20
|
+
const mockedEnsureProjectExists = ensureProjectExists;
|
|
21
|
+
const mockedUseV3Api = useV3Api;
|
|
22
|
+
const mockedFetchMigrationApps = fetchMigrationApps;
|
|
23
|
+
const ACCOUNT_ID = 123;
|
|
24
|
+
const PROJECT_NAME = 'Test Project';
|
|
25
|
+
const PLATFORM_VERSION = '2025.2';
|
|
26
|
+
const MOCK_PROJECT_DIR = '/mock/project/dir';
|
|
27
|
+
const createLoadedProjectConfig = (name) => ({
|
|
28
|
+
projectConfig: { name, srcDir: 'src', platformVersion: '2024.1' },
|
|
29
|
+
projectDir: MOCK_PROJECT_DIR,
|
|
30
|
+
});
|
|
31
|
+
describe('lib/theme/migrate', () => {
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
mockedUseV3Api.mockReturnValue(false);
|
|
34
|
+
});
|
|
35
|
+
describe('getHasMigratableThemes', () => {
|
|
36
|
+
it('should return false when no projectConfig is provided', async () => {
|
|
37
|
+
const result = await getHasMigratableThemes();
|
|
38
|
+
expect(result).toEqual({
|
|
39
|
+
hasMigratableThemes: false,
|
|
40
|
+
migratableThemesCount: 0,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
it('should return false when projectConfig is missing required properties', async () => {
|
|
44
|
+
const invalidProjectConfig = {
|
|
45
|
+
projectConfig: { name: undefined, srcDir: 'src' },
|
|
46
|
+
projectDir: undefined,
|
|
47
|
+
};
|
|
48
|
+
const result = await getHasMigratableThemes(invalidProjectConfig);
|
|
49
|
+
expect(result).toEqual({
|
|
50
|
+
hasMigratableThemes: false,
|
|
51
|
+
migratableThemesCount: 0,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
it('should return true when there are legacy themes', async () => {
|
|
55
|
+
mockedGetProjectThemeDetails.mockResolvedValue({
|
|
56
|
+
legacyThemeDetails: [
|
|
57
|
+
{
|
|
58
|
+
configFilepath: 'src/theme.json',
|
|
59
|
+
themePath: 'src/theme',
|
|
60
|
+
themeConfig: {
|
|
61
|
+
secret_names: ['my-secret'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
legacyReactThemeDetails: [],
|
|
66
|
+
});
|
|
67
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
68
|
+
const result = await getHasMigratableThemes(projectConfig);
|
|
69
|
+
expect(result).toEqual({
|
|
70
|
+
hasMigratableThemes: true,
|
|
71
|
+
migratableThemesCount: 1,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
it('should return true when there are legacy React themes', async () => {
|
|
75
|
+
mockedGetProjectThemeDetails.mockResolvedValue({
|
|
76
|
+
legacyThemeDetails: [],
|
|
77
|
+
legacyReactThemeDetails: [
|
|
78
|
+
{
|
|
79
|
+
configFilepath: 'src/react-theme.json',
|
|
80
|
+
themePath: 'src/react-theme',
|
|
81
|
+
themeConfig: {
|
|
82
|
+
secretNames: ['my-secret'],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
88
|
+
const result = await getHasMigratableThemes(projectConfig);
|
|
89
|
+
expect(result).toEqual({
|
|
90
|
+
hasMigratableThemes: true,
|
|
91
|
+
migratableThemesCount: 1,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
it('should return true when there are both legacy and React themes', async () => {
|
|
95
|
+
mockedGetProjectThemeDetails.mockResolvedValue({
|
|
96
|
+
legacyThemeDetails: [
|
|
97
|
+
{
|
|
98
|
+
configFilepath: 'src/theme.json',
|
|
99
|
+
themePath: 'src/theme',
|
|
100
|
+
themeConfig: {
|
|
101
|
+
secret_names: ['my-secret'],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
legacyReactThemeDetails: [
|
|
106
|
+
{
|
|
107
|
+
configFilepath: 'src/react-theme.json',
|
|
108
|
+
themePath: 'src/react-theme',
|
|
109
|
+
themeConfig: {
|
|
110
|
+
secretNames: ['my-secret'],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
116
|
+
const result = await getHasMigratableThemes(projectConfig);
|
|
117
|
+
expect(result).toEqual({
|
|
118
|
+
hasMigratableThemes: true,
|
|
119
|
+
migratableThemesCount: 2,
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe('validateMigrationAppsAndThemes', () => {
|
|
124
|
+
it('should throw an error when themes are already migrated (v3 API)', async () => {
|
|
125
|
+
mockedUseV3Api.mockReturnValue(true);
|
|
126
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
127
|
+
await expect(validateMigrationAppsAndThemes(0, projectConfig)).rejects.toThrow(lib.migrate.errors.project.themesAlreadyMigrated);
|
|
128
|
+
});
|
|
129
|
+
it('should throw an error when apps and themes are both present', async () => {
|
|
130
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
131
|
+
await expect(validateMigrationAppsAndThemes(1, projectConfig)).rejects.toThrow(lib.migrate.errors.project.themesAndAppsNotAllowed);
|
|
132
|
+
});
|
|
133
|
+
it('should throw an error when no project config is provided', async () => {
|
|
134
|
+
await expect(validateMigrationAppsAndThemes(0)).rejects.toThrow(lib.migrate.errors.project.noProjectForThemesMigration);
|
|
135
|
+
});
|
|
136
|
+
it('should not throw an error when validation passes', async () => {
|
|
137
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
138
|
+
await expect(validateMigrationAppsAndThemes(0, projectConfig)).resolves.not.toThrow();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
describe('handleThemesMigration', () => {
|
|
142
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
143
|
+
beforeEach(() => {
|
|
144
|
+
mockedMigrateThemes.mockResolvedValue({
|
|
145
|
+
migrated: true,
|
|
146
|
+
failureReason: undefined,
|
|
147
|
+
legacyThemeDetails: [],
|
|
148
|
+
legacyReactThemeDetails: [],
|
|
149
|
+
});
|
|
150
|
+
mockedWriteProjectConfig.mockReturnValue(true);
|
|
151
|
+
});
|
|
152
|
+
it('should throw an error when project config is invalid', async () => {
|
|
153
|
+
const invalidProjectConfig = {
|
|
154
|
+
projectConfig: { name: PROJECT_NAME, srcDir: undefined },
|
|
155
|
+
projectDir: undefined,
|
|
156
|
+
};
|
|
157
|
+
await expect(handleThemesMigration(invalidProjectConfig, PLATFORM_VERSION)).rejects.toThrow(lib.migrate.errors.project.invalidConfig);
|
|
158
|
+
});
|
|
159
|
+
it('should successfully migrate themes and update project config', async () => {
|
|
160
|
+
await handleThemesMigration(projectConfig, PLATFORM_VERSION);
|
|
161
|
+
expect(mockedMigrateThemes).toHaveBeenCalledWith(MOCK_PROJECT_DIR, `${MOCK_PROJECT_DIR}/src`);
|
|
162
|
+
expect(mockedWriteProjectConfig).toHaveBeenCalledWith(`${MOCK_PROJECT_DIR}/hsproject.json`, expect.objectContaining({
|
|
163
|
+
platformVersion: PLATFORM_VERSION,
|
|
164
|
+
}));
|
|
165
|
+
});
|
|
166
|
+
it('should throw an error when theme migration fails', async () => {
|
|
167
|
+
mockedMigrateThemes.mockResolvedValue({
|
|
168
|
+
migrated: false,
|
|
169
|
+
failureReason: 'Migration failed',
|
|
170
|
+
legacyThemeDetails: [],
|
|
171
|
+
legacyReactThemeDetails: [],
|
|
172
|
+
});
|
|
173
|
+
await expect(handleThemesMigration(projectConfig, PLATFORM_VERSION)).rejects.toThrow('Migration failed');
|
|
174
|
+
});
|
|
175
|
+
it('should throw an error when project config write fails', async () => {
|
|
176
|
+
mockedWriteProjectConfig.mockReturnValue(false);
|
|
177
|
+
await expect(handleThemesMigration(projectConfig, PLATFORM_VERSION)).rejects.toThrow(lib.migrate.errors.project.failedToUpdateProjectConfig);
|
|
178
|
+
});
|
|
179
|
+
it('should throw an error when migrateThemes throws an exception', async () => {
|
|
180
|
+
mockedMigrateThemes.mockRejectedValue(new Error('Unexpected error'));
|
|
181
|
+
await expect(handleThemesMigration(projectConfig, PLATFORM_VERSION)).rejects.toThrow(lib.migrate.errors.project.failedToMigrateThemes);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe('migrateThemes2025_2', () => {
|
|
185
|
+
const options = {
|
|
186
|
+
platformVersion: PLATFORM_VERSION,
|
|
187
|
+
};
|
|
188
|
+
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
189
|
+
const themeCount = 2;
|
|
190
|
+
beforeEach(() => {
|
|
191
|
+
mockedEnsureProjectExists.mockResolvedValue({ projectExists: true });
|
|
192
|
+
mockedFetchMigrationApps.mockResolvedValue({
|
|
193
|
+
migratableApps: [],
|
|
194
|
+
unmigratableApps: [],
|
|
195
|
+
});
|
|
196
|
+
mockedConfirmPrompt.mockResolvedValue(true);
|
|
197
|
+
mockedMigrateThemes.mockResolvedValue({
|
|
198
|
+
migrated: true,
|
|
199
|
+
failureReason: undefined,
|
|
200
|
+
legacyThemeDetails: [],
|
|
201
|
+
legacyReactThemeDetails: [],
|
|
202
|
+
});
|
|
203
|
+
mockedWriteProjectConfig.mockReturnValue(true);
|
|
204
|
+
});
|
|
205
|
+
it('should throw an error when project config is invalid', async () => {
|
|
206
|
+
const invalidProjectConfig = {
|
|
207
|
+
projectConfig: undefined,
|
|
208
|
+
projectDir: MOCK_PROJECT_DIR,
|
|
209
|
+
};
|
|
210
|
+
await expect(migrateThemes2025_2(ACCOUNT_ID, options, themeCount, invalidProjectConfig)).rejects.toThrow(lib.migrate.errors.project.invalidConfig);
|
|
211
|
+
});
|
|
212
|
+
it('should throw an error when project does not exist', async () => {
|
|
213
|
+
mockedEnsureProjectExists.mockResolvedValue({ projectExists: false });
|
|
214
|
+
await expect(migrateThemes2025_2(ACCOUNT_ID, options, themeCount, projectConfig)).rejects.toThrow(lib.migrate.errors.project.doesNotExist(ACCOUNT_ID));
|
|
215
|
+
});
|
|
216
|
+
it('should proceed with migration when user confirms', async () => {
|
|
217
|
+
await migrateThemes2025_2(ACCOUNT_ID, options, themeCount, projectConfig);
|
|
218
|
+
expect(mockedFetchMigrationApps).toHaveBeenCalledWith(ACCOUNT_ID, PLATFORM_VERSION, projectConfig);
|
|
219
|
+
expect(mockedConfirmPrompt).toHaveBeenCalledWith(lib.migrate.prompt.proceed, { defaultAnswer: false });
|
|
220
|
+
expect(mockedMigrateThemes).toHaveBeenCalledWith(MOCK_PROJECT_DIR, `${MOCK_PROJECT_DIR}/src`);
|
|
221
|
+
});
|
|
222
|
+
it('should exit without migrating when user cancels', async () => {
|
|
223
|
+
mockedConfirmPrompt.mockResolvedValue(false);
|
|
224
|
+
await migrateThemes2025_2(ACCOUNT_ID, options, themeCount, projectConfig);
|
|
225
|
+
expect(mockedMigrateThemes).not.toHaveBeenCalled();
|
|
226
|
+
});
|
|
227
|
+
it('should validate migration apps and themes', async () => {
|
|
228
|
+
await migrateThemes2025_2(ACCOUNT_ID, options, themeCount, projectConfig);
|
|
229
|
+
// The validation is called internally, so we verify it through the error handling
|
|
230
|
+
expect(mockedFetchMigrationApps).toHaveBeenCalled();
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { LoadedProjectConfig } from '../projects/config.js';
|
|
3
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs.js';
|
|
4
|
+
export type MigrateThemesArgs = CommonArgs & AccountArgs & EnvironmentArgs & ConfigArgs & {
|
|
5
|
+
platformVersion: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function getHasMigratableThemes(projectConfig?: LoadedProjectConfig): Promise<{
|
|
8
|
+
hasMigratableThemes: boolean;
|
|
9
|
+
migratableThemesCount: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function validateMigrationAppsAndThemes(hasApps: number, projectConfig?: LoadedProjectConfig): Promise<void>;
|
|
12
|
+
export declare function handleThemesMigration(projectConfig: LoadedProjectConfig, platformVersion: string): Promise<void>;
|
|
13
|
+
export declare function migrateThemes2025_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateThemesArgs>, themeCount: number, projectConfig: LoadedProjectConfig): Promise<void>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { migrateThemes, getProjectThemeDetails, } from '@hubspot/project-parsing-lib';
|
|
3
|
+
import { writeProjectConfig } from '../projects/config.js';
|
|
4
|
+
import { ensureProjectExists } from '../projects/ensureProjectExists.js';
|
|
5
|
+
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
6
|
+
import { lib } from '../../lang/en.js';
|
|
7
|
+
import { PROJECT_CONFIG_FILE } from '../constants.js';
|
|
8
|
+
import { uiLogger } from '../ui/logger.js';
|
|
9
|
+
import { debugError } from '../errorHandlers/index.js';
|
|
10
|
+
import { useV3Api } from '../projects/platformVersion.js';
|
|
11
|
+
import { confirmPrompt } from '../prompts/promptUtils.js';
|
|
12
|
+
import { fetchMigrationApps } from '../app/migrate.js';
|
|
13
|
+
export async function getHasMigratableThemes(projectConfig) {
|
|
14
|
+
if (!projectConfig?.projectConfig?.name || !projectConfig?.projectDir) {
|
|
15
|
+
return { hasMigratableThemes: false, migratableThemesCount: 0 };
|
|
16
|
+
}
|
|
17
|
+
const projectSrcDir = path.resolve(projectConfig.projectDir, projectConfig.projectConfig.srcDir);
|
|
18
|
+
const { legacyThemeDetails, legacyReactThemeDetails } = await getProjectThemeDetails(projectSrcDir);
|
|
19
|
+
return {
|
|
20
|
+
hasMigratableThemes: legacyThemeDetails.length > 0 || legacyReactThemeDetails.length > 0,
|
|
21
|
+
migratableThemesCount: legacyThemeDetails.length + legacyReactThemeDetails.length,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export async function validateMigrationAppsAndThemes(hasApps, projectConfig) {
|
|
25
|
+
if (useV3Api(projectConfig?.projectConfig?.platformVersion)) {
|
|
26
|
+
throw new Error(lib.migrate.errors.project.themesAlreadyMigrated);
|
|
27
|
+
}
|
|
28
|
+
if (hasApps > 0 && projectConfig) {
|
|
29
|
+
throw new Error(lib.migrate.errors.project.themesAndAppsNotAllowed);
|
|
30
|
+
}
|
|
31
|
+
if (!projectConfig) {
|
|
32
|
+
throw new Error(lib.migrate.errors.project.noProjectForThemesMigration);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function handleThemesMigration(projectConfig, platformVersion) {
|
|
36
|
+
if (!projectConfig?.projectDir || !projectConfig?.projectConfig?.srcDir) {
|
|
37
|
+
throw new Error(lib.migrate.errors.project.invalidConfig);
|
|
38
|
+
}
|
|
39
|
+
const projectSrcDir = path.resolve(projectConfig.projectDir, projectConfig.projectConfig.srcDir);
|
|
40
|
+
let migrated = false;
|
|
41
|
+
let failureReason;
|
|
42
|
+
try {
|
|
43
|
+
const migrationResult = await migrateThemes(projectConfig.projectDir, projectSrcDir);
|
|
44
|
+
migrated = migrationResult.migrated;
|
|
45
|
+
failureReason = migrationResult.failureReason;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
debugError(error);
|
|
49
|
+
throw new Error(lib.migrate.errors.project.failedToMigrateThemes);
|
|
50
|
+
}
|
|
51
|
+
if (!migrated) {
|
|
52
|
+
throw new Error(failureReason || lib.migrate.errors.project.failedToMigrateThemes);
|
|
53
|
+
}
|
|
54
|
+
const newProjectConfig = { ...projectConfig.projectConfig };
|
|
55
|
+
newProjectConfig.platformVersion = platformVersion;
|
|
56
|
+
const projectConfigPath = path.join(projectConfig.projectDir, PROJECT_CONFIG_FILE);
|
|
57
|
+
const success = writeProjectConfig(projectConfigPath, newProjectConfig);
|
|
58
|
+
if (!success) {
|
|
59
|
+
throw new Error(lib.migrate.errors.project.failedToUpdateProjectConfig);
|
|
60
|
+
}
|
|
61
|
+
uiLogger.log('');
|
|
62
|
+
uiLogger.log(lib.migrate.success.themesMigrationSuccess(platformVersion));
|
|
63
|
+
}
|
|
64
|
+
export async function migrateThemes2025_2(derivedAccountId, options, themeCount, projectConfig) {
|
|
65
|
+
SpinniesManager.init();
|
|
66
|
+
if (!projectConfig?.projectConfig || !projectConfig?.projectDir) {
|
|
67
|
+
throw new Error(lib.migrate.errors.project.invalidConfig);
|
|
68
|
+
}
|
|
69
|
+
const { projectExists } = await ensureProjectExists(derivedAccountId, projectConfig.projectConfig.name, { allowCreate: false, noLogs: true });
|
|
70
|
+
if (!projectExists) {
|
|
71
|
+
throw new Error(lib.migrate.errors.project.doesNotExist(derivedAccountId));
|
|
72
|
+
}
|
|
73
|
+
SpinniesManager.add('checkingForMigratableComponents', {
|
|
74
|
+
text: lib.migrate.spinners.checkingForMigratableComponents,
|
|
75
|
+
});
|
|
76
|
+
const { migratableApps, unmigratableApps } = await fetchMigrationApps(derivedAccountId, options.platformVersion, projectConfig);
|
|
77
|
+
const hasApps = [...migratableApps, ...unmigratableApps].length;
|
|
78
|
+
SpinniesManager.remove('checkingForMigratableComponents');
|
|
79
|
+
await validateMigrationAppsAndThemes(hasApps, projectConfig);
|
|
80
|
+
uiLogger.log(lib.migrate.prompt.themesMigration(themeCount));
|
|
81
|
+
const proceed = await confirmPrompt(lib.migrate.prompt.proceed, {
|
|
82
|
+
defaultAnswer: false,
|
|
83
|
+
});
|
|
84
|
+
if (proceed) {
|
|
85
|
+
await handleThemesMigration(projectConfig, options.platformVersion);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
uiLogger.log(lib.migrate.exitWithoutMigrating);
|
|
89
|
+
}
|
|
90
|
+
}
|