@hubspot/cli 7.4.4-beta.0 → 7.4.5-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/auth.js +59 -39
- package/commands/app/migrate.js +2 -2
- package/commands/create/website-theme.js +1 -1
- package/commands/project/add.js +2 -2
- package/commands/project/cloneApp.js +8 -8
- package/commands/project/create.js +1 -1
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/deprecatedFlow.js +15 -15
- package/commands/project/dev/index.js +3 -3
- package/commands/project/dev/unifiedFlow.js +8 -8
- package/commands/project/download.js +2 -2
- package/commands/project/installDeps.js +2 -2
- package/commands/project/listBuilds.js +3 -3
- package/commands/project/migrate.js +5 -5
- package/commands/project/open.js +4 -3
- package/commands/project/upload.js +7 -5
- package/commands/project/watch.js +3 -1
- package/commands/theme/preview.js +2 -2
- package/lang/en.d.ts +40 -35
- package/lang/en.js +40 -36
- package/lang/en.lyaml +2 -1
- package/lib/app/migrate.d.ts +1 -1
- package/lib/app/migrate.js +23 -19
- package/lib/app/migrate_legacy.js +2 -2
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +7 -5
- package/lib/commonOpts.d.ts +2 -3
- package/lib/commonOpts.js +12 -2
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +5 -5
- package/lib/dependencyManagement.js +2 -2
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -10
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +3 -3
- package/lib/middleware/yargsChecksMiddleware.js +2 -2
- package/lib/projects/ProjectLogsManager.js +14 -19
- package/lib/projects/buildAndDeploy.js +15 -26
- package/lib/projects/{index.d.ts → config.d.ts} +0 -12
- package/lib/projects/config.js +79 -0
- package/lib/projects/create.js +4 -5
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +5 -6
- package/lib/{DevServerManagerV2.d.ts → projects/localDev/DevServerManagerV2.d.ts} +1 -1
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +3 -4
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +42 -76
- package/lib/{LocalDevManagerV2.d.ts → projects/localDev/LocalDevManagerV2.d.ts} +2 -2
- package/lib/{LocalDevManagerV2.js → projects/localDev/LocalDevManagerV2.js} +37 -70
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +2 -2
- package/lib/{localDev.js → projects/localDev/helpers.js} +51 -96
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.js +9 -30
- package/lib/projects/urls.d.ts +1 -0
- package/lib/projects/urls.js +6 -0
- package/lib/projects/watch.js +18 -15
- package/lib/prompts/projectNamePrompt.js +2 -2
- package/package.json +2 -2
- package/lib/projects/index.js +0 -194
package/lang/en.d.ts
CHANGED
|
@@ -947,7 +947,9 @@ export declare const commands: {
|
|
|
947
947
|
readonly noProjectConfig: "No project detected. Run this command again from a project directory.";
|
|
948
948
|
readonly failedToFetchProjectDetails: "There was an error fetching project details";
|
|
949
949
|
readonly noFunctionsLinkText: "Visit developer docs";
|
|
950
|
-
readonly noFunctionsInProject:
|
|
950
|
+
readonly noFunctionsInProject: `There aren't any functions in this project
|
|
951
|
+
\t- Run ${string} to learn more about logs
|
|
952
|
+
\t- ${string} to learn more about serverless functions`;
|
|
951
953
|
readonly noFunctionWithName: (name: string | number) => string;
|
|
952
954
|
readonly functionNotDeployed: (name: string | number) => string;
|
|
953
955
|
readonly projectLogsManagerNotInitialized: "Function called on ProjectLogsManager before initialization";
|
|
@@ -1020,10 +1022,10 @@ export declare const commands: {
|
|
|
1020
1022
|
readonly processExited: "Stopping watcher...";
|
|
1021
1023
|
readonly watchCancelledFromUi: () => string;
|
|
1022
1024
|
readonly resuming: "Resuming watcher...";
|
|
1023
|
-
readonly uploadSucceeded: (
|
|
1024
|
-
readonly deleteFileSucceeded: (
|
|
1025
|
-
readonly deleteFolderSucceeded: (
|
|
1026
|
-
readonly watching: (
|
|
1025
|
+
readonly uploadSucceeded: (remotePath: string | number, filePath: string | number) => string;
|
|
1026
|
+
readonly deleteFileSucceeded: (remotePath: string | number) => string;
|
|
1027
|
+
readonly deleteFolderSucceeded: (remotePath: string | number) => string;
|
|
1028
|
+
readonly watching: (projectDir: string | number) => string;
|
|
1027
1029
|
readonly previousStagingBuildCancelled: "Killed the previous watch process. Please try running `hs project watch` again";
|
|
1028
1030
|
};
|
|
1029
1031
|
readonly options: {
|
|
@@ -1034,16 +1036,16 @@ export declare const commands: {
|
|
|
1034
1036
|
readonly debug: {
|
|
1035
1037
|
readonly pause: "Pausing watcher, attempting to queue build";
|
|
1036
1038
|
readonly buildStarted: "Build queued.";
|
|
1037
|
-
readonly extensionNotAllowed: (
|
|
1038
|
-
readonly ignored: (
|
|
1039
|
-
readonly uploading: (
|
|
1039
|
+
readonly extensionNotAllowed: (filePath: string | number) => string;
|
|
1040
|
+
readonly ignored: (filePath: string | number) => string;
|
|
1041
|
+
readonly uploading: (filePath: string | number, remotePath: string | number) => string;
|
|
1040
1042
|
readonly attemptNewBuild: "Attempting to create a new build";
|
|
1041
|
-
readonly fileAlreadyQueued: (
|
|
1043
|
+
readonly fileAlreadyQueued: (filePath: string | number) => string;
|
|
1042
1044
|
};
|
|
1043
1045
|
readonly errors: {
|
|
1044
|
-
readonly uploadFailed: (
|
|
1045
|
-
readonly deleteFileFailed: (
|
|
1046
|
-
readonly deleteFolderFailed: (
|
|
1046
|
+
readonly uploadFailed: (remotePath: string | number, filePath: string | number) => string;
|
|
1047
|
+
readonly deleteFileFailed: (remotePath: string | number) => string;
|
|
1048
|
+
readonly deleteFolderFailed: (remotePath: string | number) => string;
|
|
1047
1049
|
};
|
|
1048
1050
|
};
|
|
1049
1051
|
readonly download: {
|
|
@@ -1053,11 +1055,11 @@ export declare const commands: {
|
|
|
1053
1055
|
};
|
|
1054
1056
|
readonly logs: {
|
|
1055
1057
|
readonly downloadCancelled: "Cancelling project download";
|
|
1056
|
-
readonly downloadSucceeded: (
|
|
1058
|
+
readonly downloadSucceeded: (buildId: string | number, projectName: string | number) => string;
|
|
1057
1059
|
};
|
|
1058
1060
|
readonly errors: {
|
|
1059
1061
|
readonly downloadFailed: "Something went wrong downloading the project";
|
|
1060
|
-
readonly projectNotFound: (
|
|
1062
|
+
readonly projectNotFound: (projectName: string | number, accountId: string | number) => string;
|
|
1061
1063
|
};
|
|
1062
1064
|
readonly warnings: {
|
|
1063
1065
|
readonly cannotDownloadWithinProject: "Cancelling project download. Please run the command again outside the context of an existing project.";
|
|
@@ -1438,13 +1440,13 @@ export declare const commands: {
|
|
|
1438
1440
|
};
|
|
1439
1441
|
};
|
|
1440
1442
|
readonly success: {
|
|
1441
|
-
readonly fileUploaded: (
|
|
1442
|
-
readonly uploadComplete: (
|
|
1443
|
+
readonly fileUploaded: (src: string | number, dest: string | number, accountId: string | number) => string;
|
|
1444
|
+
readonly uploadComplete: (dest: string | number) => string;
|
|
1443
1445
|
};
|
|
1444
|
-
readonly uploading: (
|
|
1445
|
-
readonly notUploaded: (
|
|
1446
|
-
readonly cleaning: (
|
|
1447
|
-
readonly confirmCleanUpload: (
|
|
1446
|
+
readonly uploading: (src: string | number, dest: string | number, accountId: string | number) => string;
|
|
1447
|
+
readonly notUploaded: (src: string | number) => string;
|
|
1448
|
+
readonly cleaning: (filePath: string | number, accountId: string | number) => string;
|
|
1449
|
+
readonly confirmCleanUpload: (filePath: string | number, accountId: string | number) => string;
|
|
1448
1450
|
};
|
|
1449
1451
|
readonly watch: {
|
|
1450
1452
|
readonly describe: "Watch a directory on your computer for changes and upload the changed files to the HubSpot CMS.";
|
|
@@ -2114,7 +2116,7 @@ export declare const lib: {
|
|
|
2114
2116
|
readonly exitingStart: "Stopping local dev server ...";
|
|
2115
2117
|
readonly exitingSucceed: "Successfully exited";
|
|
2116
2118
|
readonly exitingFail: "Failed to cleanup before exiting";
|
|
2117
|
-
readonly missingUid:
|
|
2119
|
+
readonly missingUid: `Could not find a uid for the selected app. Confirm that the app config file contains the uid field and re-run ${string}.`;
|
|
2118
2120
|
readonly uploadWarning: {
|
|
2119
2121
|
readonly appLabel: "[App]";
|
|
2120
2122
|
readonly uiExtensionLabel: "[UI Extension]";
|
|
@@ -2122,10 +2124,11 @@ export declare const lib: {
|
|
|
2122
2124
|
readonly defaultWarning: string;
|
|
2123
2125
|
readonly defaultPublicAppWarning: (installCount: string | number, installText: string | number) => string;
|
|
2124
2126
|
readonly header: (warning: string | number) => string;
|
|
2125
|
-
readonly stopDev:
|
|
2127
|
+
readonly stopDev: ` * Stop ${string}`;
|
|
2126
2128
|
readonly runUpload: (command: string | number) => string;
|
|
2127
|
-
readonly restartDev:
|
|
2129
|
+
readonly restartDev: ` * Re-run ${string}`;
|
|
2128
2130
|
readonly pushToGithub: " * Commit and push your changes to GitHub";
|
|
2131
|
+
readonly defaultMarketplaceAppWarning: (installCount: string | number, accountText: string | number) => string;
|
|
2129
2132
|
};
|
|
2130
2133
|
readonly activeInstallWarning: {
|
|
2131
2134
|
readonly installCount: (appName: string | number, installCount: string | number, installText: string | number) => string;
|
|
@@ -2140,18 +2143,18 @@ export declare const lib: {
|
|
|
2140
2143
|
readonly fileChangeError: (message: string | number) => string;
|
|
2141
2144
|
};
|
|
2142
2145
|
};
|
|
2143
|
-
readonly
|
|
2146
|
+
readonly localDevHelpers: {
|
|
2144
2147
|
readonly confirmDefaultAccountIsTarget: {
|
|
2145
|
-
readonly configError:
|
|
2146
|
-
readonly declineDefaultAccountExplanation:
|
|
2148
|
+
readonly configError: `An error occurred while reading the default account from your config. Run ${string} to re-auth this account`;
|
|
2149
|
+
readonly declineDefaultAccountExplanation: `To develop on a different account, run ${string} to change your default account, then re-run ${string}.`;
|
|
2147
2150
|
};
|
|
2148
2151
|
readonly checkIfDefaultAccountIsSupported: {
|
|
2149
|
-
readonly publicApp:
|
|
2150
|
-
readonly privateApp:
|
|
2152
|
+
readonly publicApp: `This project contains a public app. Local development of public apps is only supported on developer accounts and developer test accounts. Change your default account using ${string}, or link a new account with ${string}.`;
|
|
2153
|
+
readonly privateApp: `This project contains a private app. Local development of private apps is not supported in developer accounts. Change your default account using ${string}, or link a new account with ${string}.`;
|
|
2151
2154
|
};
|
|
2152
2155
|
readonly validateAccountOption: {
|
|
2153
|
-
readonly invalidPublicAppAccount:
|
|
2154
|
-
readonly invalidPrivateAppAccount:
|
|
2156
|
+
readonly invalidPublicAppAccount: `This project contains a public app. The "--account" flag must point to a developer test account to develop this project locally. Alternatively, change your default account to an App Developer Account using ${string} and run ${string} to set up a new Developer Test Account.`;
|
|
2157
|
+
readonly invalidPrivateAppAccount: `This project contains a private app. The account specified with the "--account" flag points to a developer account, which do not support the local development of private apps. Update the "--account" flag to point to a standard, sandbox, or developer test account, or change your default account by running ${string}.`;
|
|
2155
2158
|
readonly nonSandboxWarning: (command: string | number) => string;
|
|
2156
2159
|
readonly publicAppNonDeveloperTestAccountWarning: () => string;
|
|
2157
2160
|
};
|
|
@@ -2167,10 +2170,10 @@ export declare const lib: {
|
|
|
2167
2170
|
readonly createInitialBuildForNewProject: {
|
|
2168
2171
|
readonly initialUploadMessage: "HubSpot Local Dev Server Startup";
|
|
2169
2172
|
readonly projectLockedError: "Your project is locked. This may mean that another user is running the `hs project watch` command for this project. If this is you, unlock the project in Projects UI.";
|
|
2170
|
-
readonly genericError:
|
|
2173
|
+
readonly genericError: `An error occurred while creating the initial build for this project. Run ${string} to try again.`;
|
|
2171
2174
|
};
|
|
2172
2175
|
readonly checkIfParentAccountIsAuthed: {
|
|
2173
|
-
readonly notAuthedError: (
|
|
2176
|
+
readonly notAuthedError: (parentAccountId: string | number, accountIdentifier: string | number) => string;
|
|
2174
2177
|
};
|
|
2175
2178
|
};
|
|
2176
2179
|
readonly projects: {
|
|
@@ -2182,7 +2185,7 @@ export declare const lib: {
|
|
|
2182
2185
|
};
|
|
2183
2186
|
};
|
|
2184
2187
|
readonly validateProjectConfig: {
|
|
2185
|
-
readonly configNotFound:
|
|
2188
|
+
readonly configNotFound: `Unable to locate a project configuration file. Try running again from a project directory, or run ${string} to create a new project.`;
|
|
2186
2189
|
readonly configMissingFields: "The project configuration file is missing required fields.";
|
|
2187
2190
|
readonly srcDirNotFound: (srcDir: string | number, projectDir: string | number) => string;
|
|
2188
2191
|
readonly srcOutsideProjectDir: (projectConfig: string | number, srcDir: string | number) => string;
|
|
@@ -2203,7 +2206,7 @@ export declare const lib: {
|
|
|
2203
2206
|
};
|
|
2204
2207
|
readonly projectBuildAndDeploy: {
|
|
2205
2208
|
readonly makePollTaskStatusFunc: {
|
|
2206
|
-
readonly componentCountSingular: "Found 1 component in this project";
|
|
2209
|
+
readonly componentCountSingular: "Found 1 component in this project\n";
|
|
2207
2210
|
readonly componentCount: (numComponents: string | number) => string;
|
|
2208
2211
|
readonly successStatusText: "DONE";
|
|
2209
2212
|
readonly failedStatusText: "FAILED";
|
|
@@ -2225,7 +2228,7 @@ export declare const lib: {
|
|
|
2225
2228
|
readonly buildCreated: (projectName: string | number, buildId: string | number) => string;
|
|
2226
2229
|
};
|
|
2227
2230
|
readonly handleProjectUpload: {
|
|
2228
|
-
readonly emptySource: (srcDir: string | number
|
|
2231
|
+
readonly emptySource: (srcDir: string | number) => string;
|
|
2229
2232
|
readonly compressed: (byteCount: string | number) => string;
|
|
2230
2233
|
readonly compressing: (path: string | number) => string;
|
|
2231
2234
|
readonly fileFiltered: (filename: string | number) => string;
|
|
@@ -2598,6 +2601,7 @@ export declare const lib: {
|
|
|
2598
2601
|
readonly message: "The personal access key you provided doesn't include developer sandbox permissions.";
|
|
2599
2602
|
readonly instructions: (accountName: string | number, url: string | number) => string;
|
|
2600
2603
|
};
|
|
2604
|
+
readonly generic: "An error occured while creating a developer sandbox";
|
|
2601
2605
|
};
|
|
2602
2606
|
};
|
|
2603
2607
|
readonly standard: {
|
|
@@ -2757,6 +2761,7 @@ export declare const lib: {
|
|
|
2757
2761
|
readonly upToDate: "App is already up to date";
|
|
2758
2762
|
readonly isPrivateApp: "Private apps are not currently migratable";
|
|
2759
2763
|
readonly listedInMarketplace: "Listed apps are not currently migratable";
|
|
2764
|
+
readonly projectConnectedToGitHub: (projectName: string | undefined, accountId: number) => string;
|
|
2760
2765
|
readonly partOfProjectAlready: `This app is part of a project, run ${string} from the project directory to migrate it`;
|
|
2761
2766
|
readonly generic: (reasonCode: string | number) => string;
|
|
2762
2767
|
};
|
package/lang/en.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.lib = exports.commands = void 0;
|
|
|
7
7
|
// @ts-nocheck
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const ui_1 = require("../lib/ui");
|
|
10
|
+
const urls_1 = require("../lib/projects/urls");
|
|
10
11
|
exports.commands = {
|
|
11
12
|
generalErrors: {
|
|
12
13
|
updateNotify: {
|
|
@@ -956,7 +957,7 @@ exports.commands = {
|
|
|
956
957
|
noProjectConfig: 'No project detected. Run this command again from a project directory.',
|
|
957
958
|
failedToFetchProjectDetails: 'There was an error fetching project details',
|
|
958
959
|
noFunctionsLinkText: 'Visit developer docs',
|
|
959
|
-
noFunctionsInProject:
|
|
960
|
+
noFunctionsInProject: `There aren't any functions in this project\n\t- Run ${(0, ui_1.uiCommandReference)('hs project logs --help')} to learn more about logs\n\t- ${(0, ui_1.uiLink)('Visit developer docs', 'https://developers.hubspot.com/docs/platform/serverless-functions')} to learn more about serverless functions`,
|
|
960
961
|
noFunctionWithName: name => `No function with name "${name}"`,
|
|
961
962
|
functionNotDeployed: name => `The function with name "${name}" is not deployed`,
|
|
962
963
|
projectLogsManagerNotInitialized: 'Function called on ProjectLogsManager before initialization',
|
|
@@ -1029,10 +1030,10 @@ exports.commands = {
|
|
|
1029
1030
|
processExited: 'Stopping watcher...',
|
|
1030
1031
|
watchCancelledFromUi: () => `The watch process has been cancelled from the UI. Any changes made since cancelling have not been uploaded. To resume watching, rerun ${chalk_1.default.yellow('`hs project watch`')}.`,
|
|
1031
1032
|
resuming: 'Resuming watcher...',
|
|
1032
|
-
uploadSucceeded: (
|
|
1033
|
-
deleteFileSucceeded:
|
|
1034
|
-
deleteFolderSucceeded:
|
|
1035
|
-
watching:
|
|
1033
|
+
uploadSucceeded: (remotePath, filePath) => `Uploaded file "${filePath}" to "${remotePath}"`,
|
|
1034
|
+
deleteFileSucceeded: remotePath => `Deleted file "${remotePath}"`,
|
|
1035
|
+
deleteFolderSucceeded: remotePath => `Deleted folder "${remotePath}"`,
|
|
1036
|
+
watching: projectDir => `Watcher is ready and watching "${projectDir}". Any changes detected will be automatically uploaded.`,
|
|
1036
1037
|
previousStagingBuildCancelled: 'Killed the previous watch process. Please try running `hs project watch` again',
|
|
1037
1038
|
},
|
|
1038
1039
|
options: {
|
|
@@ -1043,16 +1044,16 @@ exports.commands = {
|
|
|
1043
1044
|
debug: {
|
|
1044
1045
|
pause: 'Pausing watcher, attempting to queue build',
|
|
1045
1046
|
buildStarted: 'Build queued.',
|
|
1046
|
-
extensionNotAllowed:
|
|
1047
|
-
ignored:
|
|
1048
|
-
uploading: (
|
|
1047
|
+
extensionNotAllowed: filePath => `Skipping "${filePath}" due to unsupported extension`,
|
|
1048
|
+
ignored: filePath => `Skipping "${filePath}" due to an ignore rule`,
|
|
1049
|
+
uploading: (filePath, remotePath) => `Attempting to upload file "${filePath}" to "${remotePath}"`,
|
|
1049
1050
|
attemptNewBuild: 'Attempting to create a new build',
|
|
1050
|
-
fileAlreadyQueued:
|
|
1051
|
+
fileAlreadyQueued: filePath => `File "${filePath}" is already queued for upload`,
|
|
1051
1052
|
},
|
|
1052
1053
|
errors: {
|
|
1053
|
-
uploadFailed: (
|
|
1054
|
-
deleteFileFailed:
|
|
1055
|
-
deleteFolderFailed:
|
|
1054
|
+
uploadFailed: (remotePath, filePath) => `Failed to upload file "${filePath}" to "${remotePath}"`,
|
|
1055
|
+
deleteFileFailed: remotePath => `Failed to delete file "${remotePath}"`,
|
|
1056
|
+
deleteFolderFailed: remotePath => `Failed to delete folder "${remotePath}"`,
|
|
1056
1057
|
},
|
|
1057
1058
|
},
|
|
1058
1059
|
download: {
|
|
@@ -1062,11 +1063,11 @@ exports.commands = {
|
|
|
1062
1063
|
},
|
|
1063
1064
|
logs: {
|
|
1064
1065
|
downloadCancelled: 'Cancelling project download',
|
|
1065
|
-
downloadSucceeded: (
|
|
1066
|
+
downloadSucceeded: (buildId, projectName) => `Downloaded build "${buildId}" from project "${projectName}"`,
|
|
1066
1067
|
},
|
|
1067
1068
|
errors: {
|
|
1068
1069
|
downloadFailed: 'Something went wrong downloading the project',
|
|
1069
|
-
projectNotFound: (
|
|
1070
|
+
projectNotFound: (projectName, accountId) => `Your project ${chalk_1.default.bold(projectName)} could not be found in ${accountId}`,
|
|
1070
1071
|
},
|
|
1071
1072
|
warnings: {
|
|
1072
1073
|
cannotDownloadWithinProject: 'Cancelling project download. Please run the command again outside the context of an existing project.',
|
|
@@ -1447,13 +1448,13 @@ exports.commands = {
|
|
|
1447
1448
|
},
|
|
1448
1449
|
},
|
|
1449
1450
|
success: {
|
|
1450
|
-
fileUploaded: (
|
|
1451
|
-
uploadComplete:
|
|
1451
|
+
fileUploaded: (src, dest, accountId) => `Uploaded file from "${src}" to "${dest}" in the Design Manager of account ${accountId}`,
|
|
1452
|
+
uploadComplete: dest => `Uploading files to "${dest}" in the Design Manager is complete`,
|
|
1452
1453
|
},
|
|
1453
|
-
uploading: (
|
|
1454
|
-
notUploaded:
|
|
1455
|
-
cleaning: (
|
|
1456
|
-
confirmCleanUpload: (
|
|
1454
|
+
uploading: (src, dest, accountId) => `Uploading files from "${src}" to "${dest}" in the Design Manager of account ${accountId}`,
|
|
1455
|
+
notUploaded: src => `There was an error processing "${src}". The file has not been uploaded.`,
|
|
1456
|
+
cleaning: (filePath, accountId) => `Removing "${filePath}" from account ${accountId} and uploading local...`,
|
|
1457
|
+
confirmCleanUpload: (filePath, accountId) => `You are about to delete the directory "${filePath}" and its contents on HubSpot account ${accountId} before uploading. This will also clear the global content associated with any global partial templates and modules. Are you sure you want to do this?`,
|
|
1457
1458
|
},
|
|
1458
1459
|
watch: {
|
|
1459
1460
|
describe: 'Watch a directory on your computer for changes and upload the changed files to the HubSpot CMS.',
|
|
@@ -2123,7 +2124,7 @@ exports.lib = {
|
|
|
2123
2124
|
exitingStart: 'Stopping local dev server ...',
|
|
2124
2125
|
exitingSucceed: 'Successfully exited',
|
|
2125
2126
|
exitingFail: 'Failed to cleanup before exiting',
|
|
2126
|
-
missingUid:
|
|
2127
|
+
missingUid: `Could not find a uid for the selected app. Confirm that the app config file contains the uid field and re-run ${(0, ui_1.uiCommandReference)('hs project dev')}.`,
|
|
2127
2128
|
uploadWarning: {
|
|
2128
2129
|
appLabel: '[App]',
|
|
2129
2130
|
uiExtensionLabel: '[UI Extension]',
|
|
@@ -2131,10 +2132,11 @@ exports.lib = {
|
|
|
2131
2132
|
defaultWarning: chalk_1.default.bold('Changing project configuration requires a new project build.'),
|
|
2132
2133
|
defaultPublicAppWarning: (installCount, installText) => `${chalk_1.default.bold('Changing project configuration requires a new project build.')}\n\nThis will affect your public app's ${chalk_1.default.bold(`${installCount} existing ${installText}`)}. If your app has users in production, we strongly recommend creating a copy of this app to test your changes before proceding.`,
|
|
2133
2134
|
header: warning => `${warning} To reflect these changes and continue testing:`,
|
|
2134
|
-
stopDev:
|
|
2135
|
+
stopDev: ` * Stop ${(0, ui_1.uiCommandReference)('hs project dev')}`,
|
|
2135
2136
|
runUpload: command => ` * Run ${command}`,
|
|
2136
|
-
restartDev:
|
|
2137
|
+
restartDev: ` * Re-run ${(0, ui_1.uiCommandReference)('hs project dev')}`,
|
|
2137
2138
|
pushToGithub: ' * Commit and push your changes to GitHub',
|
|
2139
|
+
defaultMarketplaceAppWarning: (installCount, accountText) => `${chalk_1.default.bold('Changing project configuration requires creating a new project build.')}\n\nYour marketplace app is currently installed in ${chalk_1.default.bold(`${installCount} ${accountText}`)}. Any uploaded changes will impact your app's users. We strongly recommend creating a copy of this app to test your changes before proceding.`,
|
|
2138
2140
|
},
|
|
2139
2141
|
activeInstallWarning: {
|
|
2140
2142
|
installCount: (appName, installCount, installText) => `${chalk_1.default.bold(`The app ${appName} has ${installCount} production ${installText}`)}`,
|
|
@@ -2149,18 +2151,18 @@ exports.lib = {
|
|
|
2149
2151
|
fileChangeError: message => `Failed to notify local dev server of file change: ${message}`,
|
|
2150
2152
|
},
|
|
2151
2153
|
},
|
|
2152
|
-
|
|
2154
|
+
localDevHelpers: {
|
|
2153
2155
|
confirmDefaultAccountIsTarget: {
|
|
2154
|
-
configError:
|
|
2155
|
-
declineDefaultAccountExplanation:
|
|
2156
|
+
configError: `An error occurred while reading the default account from your config. Run ${(0, ui_1.uiCommandReference)('hs auth')} to re-auth this account`,
|
|
2157
|
+
declineDefaultAccountExplanation: `To develop on a different account, run ${(0, ui_1.uiCommandReference)('hs accounts use')} to change your default account, then re-run ${(0, ui_1.uiCommandReference)('hs project dev')}.`,
|
|
2156
2158
|
},
|
|
2157
2159
|
checkIfDefaultAccountIsSupported: {
|
|
2158
|
-
publicApp:
|
|
2159
|
-
privateApp:
|
|
2160
|
+
publicApp: `This project contains a public app. Local development of public apps is only supported on developer accounts and developer test accounts. Change your default account using ${(0, ui_1.uiCommandReference)('hs accounts use')}, or link a new account with ${(0, ui_1.uiCommandReference)('hs auth')}.`,
|
|
2161
|
+
privateApp: `This project contains a private app. Local development of private apps is not supported in developer accounts. Change your default account using ${(0, ui_1.uiCommandReference)('hs accounts use')}, or link a new account with ${(0, ui_1.uiCommandReference)('hs auth')}.`,
|
|
2160
2162
|
},
|
|
2161
2163
|
validateAccountOption: {
|
|
2162
|
-
invalidPublicAppAccount:
|
|
2163
|
-
invalidPrivateAppAccount:
|
|
2164
|
+
invalidPublicAppAccount: `This project contains a public app. The "--account" flag must point to a developer test account to develop this project locally. Alternatively, change your default account to an App Developer Account using ${(0, ui_1.uiCommandReference)('hs accounts use')} and run ${(0, ui_1.uiCommandReference)('hs project dev')} to set up a new Developer Test Account.`,
|
|
2165
|
+
invalidPrivateAppAccount: `This project contains a private app. The account specified with the "--account" flag points to a developer account, which do not support the local development of private apps. Update the "--account" flag to point to a standard, sandbox, or developer test account, or change your default account by running ${(0, ui_1.uiCommandReference)('hs accounts use')}.`,
|
|
2164
2166
|
nonSandboxWarning: command => `Testing in a sandbox is strongly recommended. To switch the target account, select an option below or run ${chalk_1.default.bold(command)} before running the command again.`,
|
|
2165
2167
|
publicAppNonDeveloperTestAccountWarning: () => `Local development of public apps is only supported in ${chalk_1.default.bold('developer test accounts')}.`,
|
|
2166
2168
|
},
|
|
@@ -2176,10 +2178,10 @@ exports.lib = {
|
|
|
2176
2178
|
createInitialBuildForNewProject: {
|
|
2177
2179
|
initialUploadMessage: 'HubSpot Local Dev Server Startup',
|
|
2178
2180
|
projectLockedError: 'Your project is locked. This may mean that another user is running the `hs project watch` command for this project. If this is you, unlock the project in Projects UI.',
|
|
2179
|
-
genericError:
|
|
2181
|
+
genericError: `An error occurred while creating the initial build for this project. Run ${(0, ui_1.uiCommandReference)('hs project upload')} to try again.`,
|
|
2180
2182
|
},
|
|
2181
2183
|
checkIfParentAccountIsAuthed: {
|
|
2182
|
-
notAuthedError: (
|
|
2184
|
+
notAuthedError: (parentAccountId, accountIdentifier) => `To develop this project locally, run ${(0, ui_1.uiCommandReference)(`hs auth --account=${parentAccountId}`)} to authenticate the App Developer Account ${parentAccountId} associated with ${accountIdentifier}.`,
|
|
2183
2185
|
},
|
|
2184
2186
|
},
|
|
2185
2187
|
projects: {
|
|
@@ -2191,7 +2193,7 @@ exports.lib = {
|
|
|
2191
2193
|
},
|
|
2192
2194
|
},
|
|
2193
2195
|
validateProjectConfig: {
|
|
2194
|
-
configNotFound:
|
|
2196
|
+
configNotFound: `Unable to locate a project configuration file. Try running again from a project directory, or run ${(0, ui_1.uiCommandReference)('hs project create')} to create a new project.`,
|
|
2195
2197
|
configMissingFields: 'The project configuration file is missing required fields.',
|
|
2196
2198
|
srcDirNotFound: (srcDir, projectDir) => `Project source directory ${chalk_1.default.bold(srcDir)} could not be found in ${chalk_1.default.bold(projectDir)}.`,
|
|
2197
2199
|
srcOutsideProjectDir: (projectConfig, srcDir) => `Invalid value for 'srcDir' in ${projectConfig}: ${chalk_1.default.bold(`srcDir: "${srcDir}"`)}\n\t'srcDir' must be a relative path to a folder under the project root, such as "." or "./src"`,
|
|
@@ -2212,8 +2214,8 @@ exports.lib = {
|
|
|
2212
2214
|
},
|
|
2213
2215
|
projectBuildAndDeploy: {
|
|
2214
2216
|
makePollTaskStatusFunc: {
|
|
2215
|
-
componentCountSingular: 'Found 1 component in this project',
|
|
2216
|
-
componentCount: numComponents => `Found ${numComponents} components in this project`,
|
|
2217
|
+
componentCountSingular: 'Found 1 component in this project\n',
|
|
2218
|
+
componentCount: numComponents => `Found ${numComponents} components in this project\n`,
|
|
2217
2219
|
successStatusText: 'DONE',
|
|
2218
2220
|
failedStatusText: 'FAILED',
|
|
2219
2221
|
errorFetchingTaskStatus: taskType => `Error fetching ${taskType} status`,
|
|
@@ -2234,7 +2236,7 @@ exports.lib = {
|
|
|
2234
2236
|
buildCreated: (projectName, buildId) => `Project "${projectName}" uploaded and build #${buildId} created`,
|
|
2235
2237
|
},
|
|
2236
2238
|
handleProjectUpload: {
|
|
2237
|
-
emptySource:
|
|
2239
|
+
emptySource: srcDir => `Source directory "${srcDir}" is empty. Add files to your project and rerun ${(0, ui_1.uiCommandReference)('hs project upload')} to upload them to HubSpot.`,
|
|
2238
2240
|
compressed: byteCount => `Project files compressed: ${byteCount} bytes`,
|
|
2239
2241
|
compressing: path => `Compressing build files to "${path}"`,
|
|
2240
2242
|
fileFiltered: filename => `Ignore rule triggered for "${filename}"`,
|
|
@@ -2607,6 +2609,7 @@ exports.lib = {
|
|
|
2607
2609
|
message: "The personal access key you provided doesn't include developer sandbox permissions.",
|
|
2608
2610
|
instructions: (accountName, url) => `To update CLI permissions for "${accountName}": \n- Go to ${url}, deactivate the existing personal access key, and create a new one that includes developer sandbox permissions. \n- Update the CLI config for this account by running ${chalk_1.default.bold('hs auth')} and entering the new key.\n`,
|
|
2609
2611
|
},
|
|
2612
|
+
generic: 'An error occured while creating a developer sandbox',
|
|
2610
2613
|
},
|
|
2611
2614
|
},
|
|
2612
2615
|
standard: {
|
|
@@ -2766,6 +2769,7 @@ exports.lib = {
|
|
|
2766
2769
|
upToDate: 'App is already up to date',
|
|
2767
2770
|
isPrivateApp: 'Private apps are not currently migratable',
|
|
2768
2771
|
listedInMarketplace: 'Listed apps are not currently migratable',
|
|
2772
|
+
projectConnectedToGitHub: (projectName, accountId) => `The project is linked to a GitHub repository. ${(0, ui_1.uiLink)('Visit the project settings page to unlink it', (0, urls_1.getProjectSettingsUrl)(projectName, accountId))}`,
|
|
2769
2773
|
partOfProjectAlready: `This app is part of a project, run ${(0, ui_1.uiCommandReference)('hs project migrate')} from the project directory to migrate it`,
|
|
2770
2774
|
generic: reasonCode => `Unable to migrate app: ${reasonCode}`,
|
|
2771
2775
|
},
|
package/lang/en.lyaml
CHANGED
|
@@ -27,7 +27,8 @@ en:
|
|
|
27
27
|
describe: "HubSpot account to authenticate"
|
|
28
28
|
errors:
|
|
29
29
|
failedToUpdateConfig: "Failed to update the configuration file. Please try again."
|
|
30
|
-
|
|
30
|
+
migrationNotConfirmed: "Did not migrate. Use the {{ authCommand }} command to update the deprecated config at {{ deprecatedConfigPath }}."
|
|
31
|
+
mergeNotConfirmed: "Did not merge. When you are ready to merge the deprecated config file with the global config file, run the {{ authCommand }} or {{ migrateCommand }} command."
|
|
31
32
|
success:
|
|
32
33
|
configFileCreated: "Created config file \"{{ configPath }}\""
|
|
33
34
|
configFileUpdated: "Connected account \"{{ account }}\" and set it as the default account"
|
package/lib/app/migrate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { LoadedProjectConfig } from '../projects';
|
|
2
|
+
import { LoadedProjectConfig } from '../projects/config';
|
|
3
3
|
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
4
4
|
export type MigrateAppArgs = CommonArgs & AccountArgs & EnvironmentArgs & ConfigArgs & {
|
|
5
5
|
name?: string;
|
package/lib/app/migrate.js
CHANGED
|
@@ -18,7 +18,7 @@ const projects_2 = require("@hubspot/local-dev-lib/api/projects");
|
|
|
18
18
|
const inquirer = require('inquirer');
|
|
19
19
|
const promptUtils_1 = require("../prompts/promptUtils");
|
|
20
20
|
const ui_1 = require("../ui");
|
|
21
|
-
const
|
|
21
|
+
const ensureProjectExists_1 = require("../projects/ensureProjectExists");
|
|
22
22
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
23
23
|
const polling_1 = require("../polling");
|
|
24
24
|
const migrate_1 = require("../../api/migrate");
|
|
@@ -27,7 +27,7 @@ const en_1 = require("../../lang/en");
|
|
|
27
27
|
const hasFeature_1 = require("../hasFeature");
|
|
28
28
|
const constants_1 = require("../constants");
|
|
29
29
|
const urls_1 = require("../projects/urls");
|
|
30
|
-
function getUnmigratableReason(reasonCode) {
|
|
30
|
+
function getUnmigratableReason(reasonCode, projectName, accountId) {
|
|
31
31
|
switch (reasonCode) {
|
|
32
32
|
case projects_1.UNMIGRATABLE_REASONS.UP_TO_DATE:
|
|
33
33
|
return en_1.lib.migrate.errors.unmigratableReasons.upToDate;
|
|
@@ -35,6 +35,8 @@ function getUnmigratableReason(reasonCode) {
|
|
|
35
35
|
return en_1.lib.migrate.errors.unmigratableReasons.isPrivateApp;
|
|
36
36
|
case projects_1.UNMIGRATABLE_REASONS.LISTED_IN_MARKETPLACE:
|
|
37
37
|
return en_1.lib.migrate.errors.unmigratableReasons.listedInMarketplace;
|
|
38
|
+
case projects_1.UNMIGRATABLE_REASONS.PROJECT_CONNECTED_TO_GITHUB:
|
|
39
|
+
return en_1.lib.migrate.errors.unmigratableReasons.projectConnectedToGitHub(projectName, accountId);
|
|
38
40
|
case migrate_1.CLI_UNMIGRATABLE_REASONS.PART_OF_PROJECT_ALREADY:
|
|
39
41
|
return en_1.lib.migrate.errors.unmigratableReasons.partOfProjectAlready;
|
|
40
42
|
default:
|
|
@@ -70,7 +72,7 @@ async function fetchMigrationApps(appId, derivedAccountId, platformVersion, proj
|
|
|
70
72
|
throw new Error(en_1.lib.migrate.errors.noAppsForProject(projectConfig?.projectConfig?.name || ''));
|
|
71
73
|
}
|
|
72
74
|
if (allApps.length === 0 || !allApps.some(app => app.isMigratable)) {
|
|
73
|
-
const reasons = filteredUnmigratableApps.map(app => `${chalk_1.default.bold(app.appName)}: ${getUnmigratableReason(app.unmigratableReason)}`);
|
|
75
|
+
const reasons = filteredUnmigratableApps.map(app => `${chalk_1.default.bold(app.appName)}: ${getUnmigratableReason(app.unmigratableReason, app.projectName, derivedAccountId)}`);
|
|
74
76
|
throw new Error(en_1.lib.migrate.errors.noAppsEligible((0, ui_1.uiAccountDescription)(derivedAccountId), reasons));
|
|
75
77
|
}
|
|
76
78
|
if (appId &&
|
|
@@ -81,7 +83,7 @@ async function fetchMigrationApps(appId, derivedAccountId, platformVersion, proj
|
|
|
81
83
|
}
|
|
82
84
|
return allApps;
|
|
83
85
|
}
|
|
84
|
-
async function promptForAppToMigrate(allApps) {
|
|
86
|
+
async function promptForAppToMigrate(allApps, derivedAccountId) {
|
|
85
87
|
const appChoices = allApps.map(app => ({
|
|
86
88
|
name: app.isMigratable
|
|
87
89
|
? app.appName
|
|
@@ -89,7 +91,7 @@ async function promptForAppToMigrate(allApps) {
|
|
|
89
91
|
value: app,
|
|
90
92
|
disabled: app.isMigratable
|
|
91
93
|
? false
|
|
92
|
-
: getUnmigratableReason(app.unmigratableReason),
|
|
94
|
+
: getUnmigratableReason(app.unmigratableReason, app.projectName, derivedAccountId),
|
|
93
95
|
}));
|
|
94
96
|
const enabledChoices = appChoices.filter(app => !app.disabled);
|
|
95
97
|
const disabledChoices = appChoices.filter(app => app.disabled);
|
|
@@ -102,7 +104,7 @@ async function promptForAppToMigrate(allApps) {
|
|
|
102
104
|
});
|
|
103
105
|
return selectedAppId;
|
|
104
106
|
}
|
|
105
|
-
async function selectAppToMigrate(allApps, appId, projectConfig) {
|
|
107
|
+
async function selectAppToMigrate(allApps, derivedAccountId, appId, projectConfig) {
|
|
106
108
|
if (appId &&
|
|
107
109
|
!allApps.some(app => {
|
|
108
110
|
return app.appId === appId;
|
|
@@ -111,7 +113,7 @@ async function selectAppToMigrate(allApps, appId, projectConfig) {
|
|
|
111
113
|
}
|
|
112
114
|
let appIdToMigrate = appId;
|
|
113
115
|
if (!appIdToMigrate) {
|
|
114
|
-
appIdToMigrate = await promptForAppToMigrate(allApps);
|
|
116
|
+
appIdToMigrate = await promptForAppToMigrate(allApps, derivedAccountId);
|
|
115
117
|
}
|
|
116
118
|
const selectedApp = allApps.find(app => app.appId === appIdToMigrate);
|
|
117
119
|
const migratableComponents = new Set();
|
|
@@ -143,7 +145,7 @@ async function selectAppToMigrate(allApps, appId, projectConfig) {
|
|
|
143
145
|
async function handleMigrationSetup(derivedAccountId, options, projectConfig) {
|
|
144
146
|
const { name, dest, appId } = options;
|
|
145
147
|
const allApps = await fetchMigrationApps(appId, derivedAccountId, options.platformVersion, projectConfig);
|
|
146
|
-
const { proceed, appIdToMigrate } = await selectAppToMigrate(allApps, appId, projectConfig);
|
|
148
|
+
const { proceed, appIdToMigrate } = await selectAppToMigrate(allApps, derivedAccountId, appId, projectConfig);
|
|
147
149
|
if (!proceed) {
|
|
148
150
|
return {};
|
|
149
151
|
}
|
|
@@ -160,14 +162,14 @@ async function handleMigrationSetup(derivedAccountId, options, projectConfig) {
|
|
|
160
162
|
const projectName = name ||
|
|
161
163
|
(await (0, promptUtils_1.inputPrompt)(en_1.lib.migrate.prompt.inputName, {
|
|
162
164
|
validate: async (input) => {
|
|
163
|
-
const { projectExists } = await (0,
|
|
165
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, input, { allowCreate: false, noLogs: true });
|
|
164
166
|
if (projectExists) {
|
|
165
167
|
return en_1.lib.migrate.errors.project.alreadyExists(input);
|
|
166
168
|
}
|
|
167
169
|
return true;
|
|
168
170
|
},
|
|
169
171
|
}));
|
|
170
|
-
const { projectExists } = await (0,
|
|
172
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectName, { allowCreate: false, noLogs: true });
|
|
171
173
|
if (projectExists) {
|
|
172
174
|
throw new Error(en_1.lib.migrate.errors.project.alreadyExists(projectName));
|
|
173
175
|
}
|
|
@@ -233,14 +235,16 @@ async function finalizeMigration(derivedAccountId, migrationId, uidMap, projectN
|
|
|
233
235
|
text: en_1.lib.migrate.spinners.migrationFailed,
|
|
234
236
|
});
|
|
235
237
|
if ((0, migrate_1.isMigrationStatus)(error) && error.status === Migration_1.MIGRATION_STATUS.FAILURE) {
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
:
|
|
238
|
+
const { componentErrors, projectErrorDetail } = error;
|
|
239
|
+
if (!componentErrors || !componentErrors.length) {
|
|
240
|
+
throw new Error(projectErrorDetail);
|
|
241
|
+
}
|
|
242
|
+
const errorMessage = `${projectErrorDetail}: \n\t- ${componentErrors
|
|
243
|
+
.map(componentError => {
|
|
244
|
+
const { componentType, errorMessage, developerSymbol: uid, } = componentError;
|
|
245
|
+
return `${componentType}${uid ? ` (${uid})` : ''}: ${errorMessage}`;
|
|
246
|
+
})
|
|
247
|
+
.join('\n\t- ')}`;
|
|
244
248
|
throw new Error(errorMessage);
|
|
245
249
|
}
|
|
246
250
|
throw new Error(en_1.lib.migrate.errors.migrationFailed, {
|
|
@@ -304,7 +308,7 @@ async function migrateApp2025_2(derivedAccountId, options, projectConfig) {
|
|
|
304
308
|
if (!projectConfig?.projectConfig || !projectConfig?.projectDir) {
|
|
305
309
|
throw new Error(en_1.lib.migrate.errors.project.invalidConfig);
|
|
306
310
|
}
|
|
307
|
-
const { projectExists } = await (0,
|
|
311
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectConfig.projectConfig.name, { allowCreate: false, noLogs: true });
|
|
308
312
|
if (!projectExists) {
|
|
309
313
|
throw new Error(en_1.lib.migrate.errors.project.doesNotExist(derivedAccountId));
|
|
310
314
|
}
|
|
@@ -19,7 +19,7 @@ const lang_1 = require("../lang");
|
|
|
19
19
|
const accountTypes_1 = require("../accountTypes");
|
|
20
20
|
const selectPublicAppPrompt_1 = require("../prompts/selectPublicAppPrompt");
|
|
21
21
|
const createProjectPrompt_1 = require("../prompts/createProjectPrompt");
|
|
22
|
-
const
|
|
22
|
+
const ensureProjectExists_1 = require("../projects/ensureProjectExists");
|
|
23
23
|
const usageTracking_1 = require("../usageTracking");
|
|
24
24
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
25
25
|
const process_1 = require("../process");
|
|
@@ -60,7 +60,7 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
|
|
|
60
60
|
}
|
|
61
61
|
const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(options);
|
|
62
62
|
const { name: projectName, dest: projectDest } = createProjectPromptResponse;
|
|
63
|
-
const { projectExists } = await (0,
|
|
63
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectName, {
|
|
64
64
|
allowCreate: false,
|
|
65
65
|
noLogs: true,
|
|
66
66
|
});
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
2
2
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
3
|
-
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
4
3
|
import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
5
4
|
import { SandboxAccountType } from '../types/Sandboxes';
|
|
6
5
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
7
|
-
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<
|
|
6
|
+
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<number>;
|
|
8
7
|
type SandboxAccount = SandboxResponse & {
|
|
9
8
|
name: string;
|
|
10
9
|
};
|
package/lib/buildAccount.js
CHANGED
|
@@ -76,14 +76,16 @@ async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, e
|
|
|
76
76
|
accountName: testAccountName,
|
|
77
77
|
}),
|
|
78
78
|
});
|
|
79
|
-
let
|
|
79
|
+
let developerTestAccountId;
|
|
80
|
+
let developerTestAccountPersonalAccessKey;
|
|
80
81
|
try {
|
|
81
82
|
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountName);
|
|
82
|
-
|
|
83
|
+
developerTestAccountId = data.id;
|
|
84
|
+
developerTestAccountPersonalAccessKey = data.personalAccessKey;
|
|
83
85
|
SpinniesManager_1.default.succeed('buildDeveloperTestAccount', {
|
|
84
86
|
text: (0, lang_1.i18n)(`${i18nKey}.succeed`, {
|
|
85
87
|
accountName: testAccountName,
|
|
86
|
-
accountId:
|
|
88
|
+
accountId: developerTestAccountId,
|
|
87
89
|
}),
|
|
88
90
|
});
|
|
89
91
|
}
|
|
@@ -97,13 +99,13 @@ async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, e
|
|
|
97
99
|
(0, developerTestAccounts_2.handleDeveloperTestAccountCreateError)(e, parentAccountId, env, portalLimit);
|
|
98
100
|
}
|
|
99
101
|
try {
|
|
100
|
-
await saveAccountToConfig(
|
|
102
|
+
await saveAccountToConfig(developerTestAccountId, testAccountName, env, developerTestAccountPersonalAccessKey);
|
|
101
103
|
}
|
|
102
104
|
catch (err) {
|
|
103
105
|
(0, index_1.logError)(err);
|
|
104
106
|
throw err;
|
|
105
107
|
}
|
|
106
|
-
return
|
|
108
|
+
return developerTestAccountId;
|
|
107
109
|
}
|
|
108
110
|
async function buildSandbox(sandboxName, parentAccountConfig, sandboxType, env, force = false) {
|
|
109
111
|
let i18nKey;
|