@hubspot/cli 7.1.1 → 7.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/create/api-sample.js +14 -4
- package/commands/customObject/create.d.ts +11 -0
- package/commands/customObject/create.js +37 -28
- package/commands/customObject/schema/create.d.ts +10 -0
- package/commands/customObject/schema/create.js +40 -42
- package/commands/customObject/schema/delete.d.ts +11 -0
- package/commands/customObject/schema/delete.js +34 -27
- package/commands/customObject/schema/fetch-all.d.ts +10 -0
- package/commands/customObject/schema/fetch-all.js +31 -24
- package/commands/customObject/schema/fetch.d.ts +11 -0
- package/commands/customObject/schema/fetch.js +34 -42
- package/commands/customObject/schema/list.d.ts +7 -0
- package/commands/customObject/schema/list.js +23 -14
- package/commands/customObject/schema/update.d.ts +11 -0
- package/commands/customObject/schema/update.js +44 -46
- package/commands/customObject/schema.d.ts +5 -1
- package/commands/customObject/schema.js +49 -11
- package/commands/customObject.d.ts +4 -1
- package/commands/customObject.js +54 -21
- package/commands/filemanager/fetch.d.ts +12 -0
- package/commands/filemanager/fetch.js +33 -30
- package/commands/filemanager/upload.d.ts +11 -0
- package/commands/filemanager/upload.js +53 -47
- package/commands/filemanager.d.ts +4 -1
- package/commands/filemanager.js +41 -7
- package/commands/hubdb/clear.d.ts +11 -0
- package/commands/hubdb/clear.js +33 -30
- package/commands/hubdb/create.d.ts +10 -0
- package/commands/hubdb/create.js +46 -40
- package/commands/hubdb/delete.d.ts +10 -0
- package/commands/hubdb/delete.js +38 -35
- package/commands/hubdb/fetch.d.ts +11 -0
- package/commands/hubdb/fetch.js +30 -27
- package/commands/hubdb.d.ts +4 -1
- package/commands/hubdb.js +45 -11
- package/commands/project/add.js +62 -16
- package/commands/project/cloneApp.js +3 -3
- package/commands/project/create.js +70 -15
- package/commands/project/dev/deprecatedFlow.d.ts +5 -0
- package/commands/project/dev/deprecatedFlow.js +137 -0
- package/commands/project/dev/index.d.ts +6 -0
- package/commands/project/dev/index.js +52 -0
- package/commands/project/dev/unifiedFlow.d.ts +5 -0
- package/commands/project/dev/unifiedFlow.js +112 -0
- package/commands/project/migrateApp.js +3 -3
- package/commands/project/upload.js +7 -2
- package/commands/sandbox/create.d.ts +12 -0
- package/commands/sandbox/create.js +90 -72
- package/commands/sandbox/delete.d.ts +11 -0
- package/commands/sandbox/delete.js +112 -95
- package/commands/sandbox.d.ts +4 -1
- package/commands/sandbox.js +44 -10
- package/commands/secret/addSecret.d.ts +10 -0
- package/commands/secret/addSecret.js +32 -31
- package/commands/secret/deleteSecret.d.ts +11 -0
- package/commands/secret/deleteSecret.js +31 -29
- package/commands/secret/listSecret.d.ts +9 -0
- package/commands/secret/listSecret.js +41 -0
- package/commands/secret/updateSecret.d.ts +10 -0
- package/commands/secret/updateSecret.js +33 -31
- package/commands/secret.d.ts +4 -1
- package/commands/secret.js +46 -12
- package/commands/theme/generate-selectors.d.ts +9 -0
- package/commands/theme/generate-selectors.js +61 -43
- package/commands/theme/marketplace-validate.d.ts +10 -0
- package/commands/theme/marketplace-validate.js +32 -26
- package/commands/theme/preview.d.ts +16 -0
- package/commands/theme/preview.js +104 -97
- package/commands/theme.d.ts +4 -1
- package/commands/theme.js +44 -10
- package/lang/en.lyaml +36 -16
- package/lib/DevServerManagerV2.d.ts +34 -0
- package/lib/DevServerManagerV2.js +85 -0
- package/lib/LocalDevManager.d.ts +2 -2
- package/lib/LocalDevManagerV2.d.ts +64 -0
- package/lib/LocalDevManagerV2.js +382 -0
- package/lib/buildAccount.d.ts +2 -3
- package/lib/constants.d.ts +12 -3
- package/lib/constants.js +13 -4
- package/lib/customObject.d.ts +3 -0
- package/lib/customObject.js +15 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +6 -0
- package/lib/doctor/DiagnosticInfoBuilder.js +5 -0
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +10 -0
- package/lib/localDev.d.ts +3 -2
- package/lib/localDev.js +2 -2
- package/lib/marketplaceValidate.d.ts +2 -2
- package/lib/process.d.ts +1 -0
- package/lib/process.js +11 -10
- package/lib/projects/buildAndDeploy.js +4 -1
- package/lib/projects/create.d.ts +5 -0
- package/lib/projects/create.js +51 -0
- package/lib/projects/index.d.ts +1 -5
- package/lib/projects/index.js +1 -62
- package/lib/projects/structure.d.ts +4 -0
- package/lib/projects/structure.js +9 -0
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/createProjectPrompt.d.ts +6 -8
- package/lib/prompts/createProjectPrompt.js +26 -54
- package/lib/prompts/projectAddPrompt.d.ts +3 -3
- package/lib/prompts/projectAddPrompt.js +16 -6
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -2
- package/lib/prompts/sandboxesPrompt.d.ts +3 -2
- package/lib/prompts/sandboxesPrompt.js +1 -1
- package/lib/sandboxSync.js +6 -2
- package/lib/sandboxes.d.ts +2 -5
- package/lib/testUtils.d.ts +12 -0
- package/lib/testUtils.js +10 -0
- package/lib/ui/index.d.ts +2 -2
- package/lib/ui/index.js +1 -0
- package/lib/upload.d.ts +1 -1
- package/lib/upload.js +20 -20
- package/lib/validation.d.ts +1 -1
- package/package.json +6 -5
- package/types/ProjectComponents.d.ts +38 -0
- package/types/ProjectComponents.js +3 -0
- package/types/Projects.d.ts +1 -6
- package/types/Prompts.d.ts +7 -0
- package/types/Sandboxes.d.ts +2 -0
- package/types/Yargs.d.ts +15 -0
- package/commands/project/dev.d.ts +0 -1
- package/commands/project/dev.js +0 -146
- package/commands/secret/listSecrets.d.ts +0 -1
- package/commands/secret/listSecrets.js +0 -39
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
11
|
+
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
12
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
15
|
+
const DevServerManagerV2_1 = __importDefault(require("./DevServerManagerV2"));
|
|
16
|
+
const exitCodes_1 = require("./enums/exitCodes");
|
|
17
|
+
const urls_1 = require("./projects/urls");
|
|
18
|
+
const structure_1 = require("./projects/structure");
|
|
19
|
+
const ui_1 = require("./ui");
|
|
20
|
+
const index_1 = require("./errorHandlers/index");
|
|
21
|
+
const installPublicAppPrompt_1 = require("./prompts/installPublicAppPrompt");
|
|
22
|
+
const promptUtils_1 = require("./prompts/promptUtils");
|
|
23
|
+
const lang_1 = require("./lang");
|
|
24
|
+
const process_1 = require("./process");
|
|
25
|
+
const WATCH_EVENTS = {
|
|
26
|
+
add: 'add',
|
|
27
|
+
change: 'change',
|
|
28
|
+
unlink: 'unlink',
|
|
29
|
+
unlinkDir: 'unlinkDir',
|
|
30
|
+
};
|
|
31
|
+
const i18nKey = 'lib.LocalDevManager';
|
|
32
|
+
class LocalDevManagerV2 {
|
|
33
|
+
targetProjectAccountId;
|
|
34
|
+
targetTestingAccountId;
|
|
35
|
+
projectConfig;
|
|
36
|
+
projectDir;
|
|
37
|
+
projectId;
|
|
38
|
+
debug;
|
|
39
|
+
deployedBuild;
|
|
40
|
+
isGithubLinked;
|
|
41
|
+
watcher;
|
|
42
|
+
uploadWarnings;
|
|
43
|
+
projectNodes;
|
|
44
|
+
activeApp;
|
|
45
|
+
activePublicAppData;
|
|
46
|
+
env;
|
|
47
|
+
publicAppActiveInstalls;
|
|
48
|
+
projectSourceDir;
|
|
49
|
+
mostRecentUploadWarning;
|
|
50
|
+
constructor(options) {
|
|
51
|
+
this.targetProjectAccountId = options.targetProjectAccountId;
|
|
52
|
+
this.targetTestingAccountId = options.targetTestingAccountId;
|
|
53
|
+
this.projectConfig = options.projectConfig;
|
|
54
|
+
this.projectDir = options.projectDir;
|
|
55
|
+
this.projectId = options.projectId;
|
|
56
|
+
this.debug = options.debug || false;
|
|
57
|
+
this.deployedBuild = options.deployedBuild;
|
|
58
|
+
this.isGithubLinked = options.isGithubLinked;
|
|
59
|
+
this.watcher = null;
|
|
60
|
+
this.uploadWarnings = {};
|
|
61
|
+
this.projectNodes = options.projectNodes;
|
|
62
|
+
this.activeApp = null;
|
|
63
|
+
this.activePublicAppData = null;
|
|
64
|
+
this.env = options.env;
|
|
65
|
+
this.publicAppActiveInstalls = null;
|
|
66
|
+
this.mostRecentUploadWarning = null;
|
|
67
|
+
this.projectSourceDir = path_1.default.join(this.projectDir, this.projectConfig.srcDir);
|
|
68
|
+
if (!this.targetProjectAccountId ||
|
|
69
|
+
!this.projectConfig ||
|
|
70
|
+
!this.projectDir) {
|
|
71
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.failedToInitialize`));
|
|
72
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async setActiveApp(appUid) {
|
|
76
|
+
if (!appUid) {
|
|
77
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.missingUid`, {
|
|
78
|
+
devCommand: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
79
|
+
}));
|
|
80
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
81
|
+
}
|
|
82
|
+
const app = Object.values(this.projectNodes).find(component => component.uid === appUid) || null;
|
|
83
|
+
if (app && (0, structure_1.isAppIRNode)(app)) {
|
|
84
|
+
this.activeApp = app;
|
|
85
|
+
if (app.config.distribution === constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE) {
|
|
86
|
+
try {
|
|
87
|
+
await this.setActivePublicAppData();
|
|
88
|
+
await this.checkActivePublicAppInstalls();
|
|
89
|
+
await this.checkPublicAppInstallation();
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
(0, index_1.logError)(e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
async setActivePublicAppData() {
|
|
99
|
+
const { data: { results: portalPublicApps }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(this.targetProjectAccountId);
|
|
100
|
+
const activePublicAppData = portalPublicApps.find(({ sourceId }) => sourceId === this.activeApp?.uid);
|
|
101
|
+
if (!activePublicAppData) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const { data: { uniquePortalInstallCount }, } = await (0, appsDev_1.fetchPublicAppProductionInstallCounts)(activePublicAppData.id, this.targetProjectAccountId);
|
|
105
|
+
this.activePublicAppData = activePublicAppData;
|
|
106
|
+
this.publicAppActiveInstalls = uniquePortalInstallCount;
|
|
107
|
+
}
|
|
108
|
+
async checkActivePublicAppInstalls() {
|
|
109
|
+
if (!this.activePublicAppData ||
|
|
110
|
+
!this.publicAppActiveInstalls ||
|
|
111
|
+
this.publicAppActiveInstalls < 1) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
(0, ui_1.uiLine)();
|
|
115
|
+
logger_1.logger.warn((0, lang_1.i18n)(`${i18nKey}.activeInstallWarning.installCount`, {
|
|
116
|
+
appName: this.activePublicAppData.name,
|
|
117
|
+
installCount: this.publicAppActiveInstalls,
|
|
118
|
+
installText: this.publicAppActiveInstalls === 1 ? 'install' : 'installs',
|
|
119
|
+
}));
|
|
120
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.activeInstallWarning.explanation`));
|
|
121
|
+
(0, ui_1.uiLine)();
|
|
122
|
+
const proceed = await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(`${i18nKey}.activeInstallWarning.confirmationPrompt`), { defaultAnswer: false });
|
|
123
|
+
if (!proceed) {
|
|
124
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async start() {
|
|
128
|
+
SpinniesManager_1.default.stopAll();
|
|
129
|
+
SpinniesManager_1.default.init();
|
|
130
|
+
// Local dev currently relies on the existence of a deployed build in the target account
|
|
131
|
+
if (!this.deployedBuild) {
|
|
132
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.noDeployedBuild`, {
|
|
133
|
+
projectName: this.projectConfig.name,
|
|
134
|
+
accountIdentifier: (0, ui_1.uiAccountDescription)(this.targetProjectAccountId),
|
|
135
|
+
uploadCommand: this.getUploadCommand(),
|
|
136
|
+
}));
|
|
137
|
+
logger_1.logger.log();
|
|
138
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
139
|
+
}
|
|
140
|
+
const setupSucceeded = await this.devServerSetup();
|
|
141
|
+
if (!setupSucceeded) {
|
|
142
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
143
|
+
}
|
|
144
|
+
else if (!this.debug) {
|
|
145
|
+
console.clear();
|
|
146
|
+
}
|
|
147
|
+
(0, ui_1.uiBetaTag)((0, lang_1.i18n)(`${i18nKey}.betaMessage`));
|
|
148
|
+
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.learnMoreLocalDevServer`), 'https://developers.hubspot.com/docs/platform/project-cli-commands#start-a-local-development-server'));
|
|
149
|
+
logger_1.logger.log();
|
|
150
|
+
logger_1.logger.log(chalk_1.default.hex(ui_1.UI_COLORS.SORBET)((0, lang_1.i18n)(`${i18nKey}.running`, {
|
|
151
|
+
accountIdentifier: (0, ui_1.uiAccountDescription)(this.targetProjectAccountId),
|
|
152
|
+
projectName: this.projectConfig.name,
|
|
153
|
+
})));
|
|
154
|
+
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.viewProjectLink`), (0, urls_1.getProjectDetailUrl)(this.projectConfig.name, this.targetProjectAccountId) || ''));
|
|
155
|
+
logger_1.logger.log();
|
|
156
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.quitHelper`));
|
|
157
|
+
(0, ui_1.uiLine)();
|
|
158
|
+
logger_1.logger.log();
|
|
159
|
+
await this.devServerStart();
|
|
160
|
+
// Initialize project file watcher to detect configuration file changes
|
|
161
|
+
this.startWatching();
|
|
162
|
+
this.updateKeypressListeners();
|
|
163
|
+
this.monitorConsoleOutput();
|
|
164
|
+
// Verify that there are no mismatches between components in the local project
|
|
165
|
+
// and components in the deployed build of the project.
|
|
166
|
+
this.compareLocalProjectToDeployed();
|
|
167
|
+
}
|
|
168
|
+
async stop(showProgress = true) {
|
|
169
|
+
if (showProgress) {
|
|
170
|
+
SpinniesManager_1.default.add('cleanupMessage', {
|
|
171
|
+
text: (0, lang_1.i18n)(`${i18nKey}.exitingStart`),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
await this.stopWatching();
|
|
175
|
+
const cleanupSucceeded = await this.devServerCleanup();
|
|
176
|
+
if (!cleanupSucceeded) {
|
|
177
|
+
if (showProgress) {
|
|
178
|
+
SpinniesManager_1.default.fail('cleanupMessage', {
|
|
179
|
+
text: (0, lang_1.i18n)(`${i18nKey}.exitingFail`),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
183
|
+
}
|
|
184
|
+
if (showProgress) {
|
|
185
|
+
SpinniesManager_1.default.succeed('cleanupMessage', {
|
|
186
|
+
text: (0, lang_1.i18n)(`${i18nKey}.exitingSucceed`),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
190
|
+
}
|
|
191
|
+
async checkPublicAppInstallation() {
|
|
192
|
+
if (!this.activeApp || !this.activePublicAppData) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const { data: { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups }, } = await (0, localDevAuth_1.fetchAppInstallationData)(this.targetTestingAccountId, this.projectId, this.activeApp.uid, this.activeApp.config.auth.requiredScopes, this.activeApp.config.auth.optionalScopes);
|
|
196
|
+
const isReinstall = previouslyAuthorizedScopeGroups.length > 0;
|
|
197
|
+
if (!isInstalledWithScopeGroups) {
|
|
198
|
+
await (0, installPublicAppPrompt_1.installPublicAppPrompt)(this.env, this.targetTestingAccountId, this.activePublicAppData.clientId, this.activeApp.config.auth.requiredScopes, this.activeApp.config.auth.redirectUrls, isReinstall);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
updateKeypressListeners() {
|
|
202
|
+
(0, process_1.handleKeypress)(async (key) => {
|
|
203
|
+
if ((key.ctrl && key.name === 'c') || key.name === 'q') {
|
|
204
|
+
this.stop();
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
getUploadCommand() {
|
|
209
|
+
const currentDefaultAccount = (0, config_1.getConfigDefaultAccount)() || undefined;
|
|
210
|
+
return this.targetProjectAccountId !== (0, config_1.getAccountId)(currentDefaultAccount)
|
|
211
|
+
? (0, ui_1.uiCommandReference)(`hs project upload --account=${this.targetProjectAccountId}`)
|
|
212
|
+
: (0, ui_1.uiCommandReference)('hs project upload');
|
|
213
|
+
}
|
|
214
|
+
logUploadWarning(reason) {
|
|
215
|
+
let warning;
|
|
216
|
+
if (reason) {
|
|
217
|
+
warning = reason;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
warning =
|
|
221
|
+
this.publicAppActiveInstalls && this.publicAppActiveInstalls > 0
|
|
222
|
+
? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultPublicAppWarning`, {
|
|
223
|
+
installCount: this.publicAppActiveInstalls,
|
|
224
|
+
installText: this.publicAppActiveInstalls === 1 ? 'install' : 'installs',
|
|
225
|
+
})
|
|
226
|
+
: (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultWarning`);
|
|
227
|
+
}
|
|
228
|
+
// Avoid logging the warning to the console if it is currently the most
|
|
229
|
+
// recently logged warning. We do not want to spam the console with the same message.
|
|
230
|
+
if (!this.uploadWarnings[warning]) {
|
|
231
|
+
logger_1.logger.log();
|
|
232
|
+
logger_1.logger.warn((0, lang_1.i18n)(`${i18nKey}.uploadWarning.header`, { warning }));
|
|
233
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.uploadWarning.stopDev`, {
|
|
234
|
+
command: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
235
|
+
}));
|
|
236
|
+
if (this.isGithubLinked) {
|
|
237
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.uploadWarning.pushToGithub`));
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.uploadWarning.runUpload`, {
|
|
241
|
+
command: this.getUploadCommand(),
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.uploadWarning.restartDev`, {
|
|
245
|
+
command: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
246
|
+
}));
|
|
247
|
+
this.mostRecentUploadWarning = warning;
|
|
248
|
+
this.uploadWarnings[warning] = true;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
monitorConsoleOutput() {
|
|
252
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
253
|
+
function customStdoutWrite(chunk, encoding, callback) {
|
|
254
|
+
// Reset the most recently logged warning
|
|
255
|
+
if (this.mostRecentUploadWarning &&
|
|
256
|
+
this.uploadWarnings[this.mostRecentUploadWarning]) {
|
|
257
|
+
delete this.uploadWarnings[this.mostRecentUploadWarning];
|
|
258
|
+
}
|
|
259
|
+
if (typeof encoding === 'function') {
|
|
260
|
+
return originalStdoutWrite(chunk, callback);
|
|
261
|
+
}
|
|
262
|
+
return originalStdoutWrite(chunk, encoding, callback);
|
|
263
|
+
}
|
|
264
|
+
customStdoutWrite.bind(this);
|
|
265
|
+
process.stdout.write = customStdoutWrite;
|
|
266
|
+
}
|
|
267
|
+
compareLocalProjectToDeployed() {
|
|
268
|
+
const deployedComponentNames = this.deployedBuild.subbuildStatuses.map(subbuildStatus => subbuildStatus.buildName);
|
|
269
|
+
const missingProjectNodes = [];
|
|
270
|
+
Object.values(this.projectNodes).forEach(node => {
|
|
271
|
+
if ((0, structure_1.isAppIRNode)(node) || (0, structure_1.isCardIRNode)(node)) {
|
|
272
|
+
if (!deployedComponentNames.includes(node.uid)) {
|
|
273
|
+
missingProjectNodes.push(`${(0, lang_1.i18n)(`${i18nKey}.uploadWarning.appLabel`)} ${node.uid}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
if (missingProjectNodes.length) {
|
|
278
|
+
this.logUploadWarning((0, lang_1.i18n)(`${i18nKey}.uploadWarning.missingComponents`, {
|
|
279
|
+
missingComponents: missingProjectNodes.join(', '),
|
|
280
|
+
}));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
startWatching() {
|
|
284
|
+
this.watcher = chokidar_1.default.watch(this.projectDir, {
|
|
285
|
+
ignoreInitial: true,
|
|
286
|
+
});
|
|
287
|
+
const configPaths = Object.values(this.projectNodes)
|
|
288
|
+
.filter(structure_1.isAppIRNode)
|
|
289
|
+
.map(component => component.localDev.componentConfigPath);
|
|
290
|
+
const projectConfigPath = path_1.default.join(this.projectDir, constants_1.PROJECT_CONFIG_FILE);
|
|
291
|
+
configPaths.push(projectConfigPath);
|
|
292
|
+
this.watcher.on('add', filePath => {
|
|
293
|
+
this.handleWatchEvent(filePath, WATCH_EVENTS.add, configPaths);
|
|
294
|
+
});
|
|
295
|
+
this.watcher.on('change', filePath => {
|
|
296
|
+
this.handleWatchEvent(filePath, WATCH_EVENTS.change, configPaths);
|
|
297
|
+
});
|
|
298
|
+
this.watcher.on('unlink', filePath => {
|
|
299
|
+
this.handleWatchEvent(filePath, WATCH_EVENTS.unlink, configPaths);
|
|
300
|
+
});
|
|
301
|
+
this.watcher.on('unlinkDir', filePath => {
|
|
302
|
+
this.handleWatchEvent(filePath, WATCH_EVENTS.unlinkDir, configPaths);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async stopWatching() {
|
|
306
|
+
await this.watcher?.close();
|
|
307
|
+
}
|
|
308
|
+
handleWatchEvent(filePath, event, configPaths) {
|
|
309
|
+
if (configPaths.includes(filePath)) {
|
|
310
|
+
this.logUploadWarning();
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.devServerFileChange(filePath, event);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
async devServerSetup() {
|
|
317
|
+
try {
|
|
318
|
+
await DevServerManagerV2_1.default.setup({
|
|
319
|
+
projectNodes: this.projectNodes,
|
|
320
|
+
onUploadRequired: this.logUploadWarning.bind(this),
|
|
321
|
+
accountId: this.targetTestingAccountId,
|
|
322
|
+
setActiveApp: this.setActiveApp.bind(this),
|
|
323
|
+
});
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
catch (e) {
|
|
327
|
+
if (this.debug) {
|
|
328
|
+
logger_1.logger.error(e);
|
|
329
|
+
}
|
|
330
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.devServer.setupError`, {
|
|
331
|
+
message: e instanceof Error ? e.message : '',
|
|
332
|
+
}));
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
async devServerStart() {
|
|
337
|
+
try {
|
|
338
|
+
await DevServerManagerV2_1.default.start({
|
|
339
|
+
accountId: this.targetTestingAccountId,
|
|
340
|
+
projectConfig: this.projectConfig,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
catch (e) {
|
|
344
|
+
if (this.debug) {
|
|
345
|
+
logger_1.logger.error(e);
|
|
346
|
+
}
|
|
347
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.devServer.startError`, {
|
|
348
|
+
message: e instanceof Error ? e.message : '',
|
|
349
|
+
}));
|
|
350
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
devServerFileChange(filePath, event) {
|
|
354
|
+
try {
|
|
355
|
+
DevServerManagerV2_1.default.fileChange({ filePath, event });
|
|
356
|
+
}
|
|
357
|
+
catch (e) {
|
|
358
|
+
if (this.debug) {
|
|
359
|
+
logger_1.logger.error(e);
|
|
360
|
+
}
|
|
361
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.devServer.fileChangeError`, {
|
|
362
|
+
message: e instanceof Error ? e.message : '',
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
async devServerCleanup() {
|
|
367
|
+
try {
|
|
368
|
+
await DevServerManagerV2_1.default.cleanup();
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
catch (e) {
|
|
372
|
+
if (this.debug) {
|
|
373
|
+
logger_1.logger.error(e);
|
|
374
|
+
}
|
|
375
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.devServer.cleanupError`, {
|
|
376
|
+
message: e instanceof Error ? e.message : '',
|
|
377
|
+
}));
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
exports.default = LocalDevManagerV2;
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
2
1
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
3
2
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
4
3
|
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
5
4
|
import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
5
|
+
import { SandboxAccountType } from '../types/Sandboxes';
|
|
6
6
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
7
7
|
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<DeveloperTestAccount>;
|
|
8
|
-
type SandboxType = typeof HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX | typeof HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX;
|
|
9
8
|
type SandboxAccount = SandboxResponse & {
|
|
10
9
|
name: string;
|
|
11
10
|
};
|
|
12
|
-
export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType:
|
|
11
|
+
export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType: SandboxAccountType, env: Environment, force?: boolean): Promise<SandboxAccount>;
|
|
13
12
|
export {};
|
package/lib/constants.d.ts
CHANGED
|
@@ -3,9 +3,6 @@ export declare const DEFAULT_PROJECT_TEMPLATE_BRANCH: "main";
|
|
|
3
3
|
export declare const FEEDBACK_INTERVAL: 10;
|
|
4
4
|
export declare const HUBSPOT_FOLDER: "@hubspot";
|
|
5
5
|
export declare const MARKETPLACE_FOLDER: "@marketplace";
|
|
6
|
-
export declare const CONFIG_FLAGS: {
|
|
7
|
-
readonly USE_CUSTOM_OBJECT_HUBFILE: "useCustomObjectHubfile";
|
|
8
|
-
};
|
|
9
6
|
export declare const DEFAULT_POLLING_DELAY = 2000;
|
|
10
7
|
export declare const PROJECT_CONFIG_FILE: "hsproject.json";
|
|
11
8
|
export declare const PROJECT_BUILD_STATES: {
|
|
@@ -65,3 +62,15 @@ export declare const PLATFORM_VERSION_ERROR_TYPES: {
|
|
|
65
62
|
readonly PLATFORM_VERSION_RETIRED: "PlatformVersionErrorType.PLATFORM_VERSION_RETIRED";
|
|
66
63
|
readonly PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST: "PlatformVersionErrorType.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST";
|
|
67
64
|
};
|
|
65
|
+
export declare const IR_COMPONENT_TYPES: {
|
|
66
|
+
readonly APPLICATION: "APPLICATION";
|
|
67
|
+
readonly CARD: "CARD";
|
|
68
|
+
};
|
|
69
|
+
export declare const APP_DISTRIBUTION_TYPES: {
|
|
70
|
+
readonly MARKETPLACE: "marketplace";
|
|
71
|
+
readonly PRIVATE: "private";
|
|
72
|
+
};
|
|
73
|
+
export declare const APP_AUTH_TYPES: {
|
|
74
|
+
readonly OAUTH: "oauth";
|
|
75
|
+
readonly STATIC: "static";
|
|
76
|
+
};
|
package/lib/constants.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.
|
|
3
|
+
exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
|
|
4
4
|
exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components';
|
|
5
5
|
exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
|
|
6
6
|
exports.FEEDBACK_INTERVAL = 10;
|
|
7
7
|
exports.HUBSPOT_FOLDER = '@hubspot';
|
|
8
8
|
exports.MARKETPLACE_FOLDER = '@marketplace';
|
|
9
|
-
exports.CONFIG_FLAGS = {
|
|
10
|
-
USE_CUSTOM_OBJECT_HUBFILE: 'useCustomObjectHubfile',
|
|
11
|
-
};
|
|
12
9
|
exports.DEFAULT_POLLING_DELAY = 2000;
|
|
13
10
|
exports.PROJECT_CONFIG_FILE = 'hsproject.json';
|
|
14
11
|
exports.PROJECT_BUILD_STATES = {
|
|
@@ -60,3 +57,15 @@ exports.PLATFORM_VERSION_ERROR_TYPES = {
|
|
|
60
57
|
PLATFORM_VERSION_RETIRED: 'PlatformVersionErrorType.PLATFORM_VERSION_RETIRED',
|
|
61
58
|
PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST: 'PlatformVersionErrorType.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST',
|
|
62
59
|
};
|
|
60
|
+
exports.IR_COMPONENT_TYPES = {
|
|
61
|
+
APPLICATION: 'APPLICATION',
|
|
62
|
+
CARD: 'CARD',
|
|
63
|
+
};
|
|
64
|
+
exports.APP_DISTRIBUTION_TYPES = {
|
|
65
|
+
MARKETPLACE: 'marketplace',
|
|
66
|
+
PRIVATE: 'private',
|
|
67
|
+
};
|
|
68
|
+
exports.APP_AUTH_TYPES = {
|
|
69
|
+
OAUTH: 'oauth',
|
|
70
|
+
STATIC: 'static',
|
|
71
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSchemaDefinition = isSchemaDefinition;
|
|
4
|
+
exports.isObjectDefinition = isObjectDefinition;
|
|
5
|
+
function isSchemaDefinition(schema) {
|
|
6
|
+
return (typeof schema === 'object' &&
|
|
7
|
+
schema !== null &&
|
|
8
|
+
'labels' in schema &&
|
|
9
|
+
'name' in schema &&
|
|
10
|
+
'properties' in schema &&
|
|
11
|
+
'requiredProperties' in schema);
|
|
12
|
+
}
|
|
13
|
+
function isObjectDefinition(object) {
|
|
14
|
+
return typeof object === 'object' && object !== null && 'inputs' in object;
|
|
15
|
+
}
|
|
@@ -21,6 +21,9 @@ export interface DiagnosticInfo extends FilesInfo {
|
|
|
21
21
|
npm: string | null;
|
|
22
22
|
};
|
|
23
23
|
config: string | null;
|
|
24
|
+
configSettings: {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
24
27
|
project: {
|
|
25
28
|
details?: Project;
|
|
26
29
|
config?: ProjectConfig;
|
|
@@ -41,6 +44,9 @@ export interface DiagnosticInfo extends FilesInfo {
|
|
|
41
44
|
}
|
|
42
45
|
export declare class DiagnosticInfoBuilder {
|
|
43
46
|
accountId: number | null;
|
|
47
|
+
readonly configSettings: {
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
44
50
|
readonly env?: Environment;
|
|
45
51
|
readonly authType?: AuthType;
|
|
46
52
|
readonly accountType?: AccountType;
|
|
@@ -27,6 +27,7 @@ const configFiles = [
|
|
|
27
27
|
];
|
|
28
28
|
class DiagnosticInfoBuilder {
|
|
29
29
|
accountId;
|
|
30
|
+
configSettings;
|
|
30
31
|
env;
|
|
31
32
|
authType;
|
|
32
33
|
accountType;
|
|
@@ -39,6 +40,9 @@ class DiagnosticInfoBuilder {
|
|
|
39
40
|
constructor(processInfo) {
|
|
40
41
|
this.accountId = (0, config_1.getAccountId)();
|
|
41
42
|
const accountConfig = (0, config_2.getAccountConfig)(this.accountId);
|
|
43
|
+
this.configSettings = {
|
|
44
|
+
httpUseLocalhost: (0, config_1.isConfigFlagEnabled)('httpUseLocalhost'),
|
|
45
|
+
};
|
|
42
46
|
this.env = accountConfig?.env;
|
|
43
47
|
this.authType = accountConfig?.authType;
|
|
44
48
|
this.accountType = accountConfig?.accountType;
|
|
@@ -60,6 +64,7 @@ class DiagnosticInfoBuilder {
|
|
|
60
64
|
arch,
|
|
61
65
|
path: mainModule?.path,
|
|
62
66
|
config: (0, config_2.getConfigPath)(),
|
|
67
|
+
configSettings: this.configSettings,
|
|
63
68
|
versions: {
|
|
64
69
|
[hubspotCli]: package_json_1.default.version,
|
|
65
70
|
node,
|
package/lib/doctor/Doctor.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class Doctor {
|
|
|
10
10
|
private performCliChecks;
|
|
11
11
|
private performProjectChecks;
|
|
12
12
|
private performCliConfigChecks;
|
|
13
|
+
private performCliConfigSettingsChecks;
|
|
13
14
|
private checkIfAccessTokenValid;
|
|
14
15
|
private checkIfNodeIsInstalled;
|
|
15
16
|
private checkIfNpmIsInstalled;
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -51,6 +51,7 @@ class Doctor {
|
|
|
51
51
|
...this.performCliConfigChecks(),
|
|
52
52
|
...(this.projectConfig?.projectConfig ? this.performProjectChecks() : []),
|
|
53
53
|
]);
|
|
54
|
+
this.performCliConfigSettingsChecks();
|
|
54
55
|
SpinniesManager_1.default.succeed('runningDiagnostics', {
|
|
55
56
|
text: i18n(`${i18nKey}.diagnosticsComplete`),
|
|
56
57
|
succeedColor: 'white',
|
|
@@ -87,6 +88,15 @@ class Doctor {
|
|
|
87
88
|
}
|
|
88
89
|
return [this.checkIfAccessTokenValid()];
|
|
89
90
|
}
|
|
91
|
+
performCliConfigSettingsChecks() {
|
|
92
|
+
if (this.diagnosticInfo?.configSettings.httpUseLocalhost) {
|
|
93
|
+
this.diagnosis?.addCLIConfigSection({
|
|
94
|
+
type: 'warning',
|
|
95
|
+
message: i18n(`${i18nKey}.diagnosis.cliConfig.settings.httpUseLocalhost`),
|
|
96
|
+
secondaryMessaging: i18n(`${i18nKey}.diagnosis.cliConfig.settings.httpUseLocalhostSecondary`),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
90
100
|
async checkIfAccessTokenValid() {
|
|
91
101
|
const localI18nKey = `${i18nKey}.accountChecks`;
|
|
92
102
|
try {
|
package/lib/localDev.d.ts
CHANGED
|
@@ -3,15 +3,16 @@ import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
|
3
3
|
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
4
4
|
import { Project } from '@hubspot/local-dev-lib/types/Project';
|
|
5
5
|
import { ProjectConfig } from '../types/Projects';
|
|
6
|
+
import { ProjectDevTargetAccountPromptResponse } from '../types/Prompts';
|
|
6
7
|
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
7
8
|
export declare function confirmDefaultAccountIsTarget(accountConfig: CLIAccount): Promise<void>;
|
|
8
9
|
export declare function checkIfDefaultAccountIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
9
10
|
export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount): void;
|
|
10
11
|
export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
11
|
-
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<
|
|
12
|
+
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
12
13
|
export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
13
14
|
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
14
15
|
export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
|
|
15
16
|
export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig, targetAccountId: number, shouldCreateWithoutConfirmation: boolean, hasPublicApps: boolean): Promise<Project>;
|
|
16
|
-
export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number): Promise<Build>;
|
|
17
|
+
export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIr?: boolean): Promise<Build>;
|
|
17
18
|
export declare function getAccountHomeUrl(accountId: number): string;
|
package/lib/localDev.js
CHANGED
|
@@ -294,8 +294,8 @@ function projectUploadCallback(accountId, projectConfig, tempFile, buildId) {
|
|
|
294
294
|
}
|
|
295
295
|
// Create an initial build if the project was newly created in the account
|
|
296
296
|
// Return the newly deployed build
|
|
297
|
-
async function createInitialBuildForNewProject(projectConfig, projectDir, targetAccountId) {
|
|
298
|
-
const { result: initialUploadResult, uploadError } = await (0, upload_1.handleProjectUpload)(targetAccountId, projectConfig, projectDir, projectUploadCallback, (0, lang_1.i18n)(`${i18nKey}.createInitialBuildForNewProject.initialUploadMessage`));
|
|
297
|
+
async function createInitialBuildForNewProject(projectConfig, projectDir, targetAccountId, sendIr) {
|
|
298
|
+
const { result: initialUploadResult, uploadError } = await (0, upload_1.handleProjectUpload)(targetAccountId, projectConfig, projectDir, projectUploadCallback, (0, lang_1.i18n)(`${i18nKey}.createInitialBuildForNewProject.initialUploadMessage`), sendIr);
|
|
299
299
|
if (uploadError) {
|
|
300
300
|
if ((0, index_1.isSpecifiedError)(uploadError, {
|
|
301
301
|
subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetValidationResultsResponse } from '@hubspot/local-dev-lib/types/MarketplaceValidation';
|
|
2
2
|
export declare function kickOffValidation(accountId: number, assetType: string, src: string): Promise<number>;
|
|
3
|
-
export declare function pollForValidationFinish(accountId: number, validationId:
|
|
4
|
-
export declare function fetchValidationResults(accountId: number, validationId:
|
|
3
|
+
export declare function pollForValidationFinish(accountId: number, validationId: number): Promise<void>;
|
|
4
|
+
export declare function fetchValidationResults(accountId: number, validationId: number): Promise<GetValidationResultsResponse>;
|
|
5
5
|
export declare function processValidationErrors(i18nKey: string, validationResults: GetValidationResultsResponse): void;
|
|
6
6
|
export declare function displayValidationResults(i18nKey: string, validationResults: GetValidationResultsResponse): void;
|
package/lib/process.d.ts
CHANGED
package/lib/process.js
CHANGED
|
@@ -3,24 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TERMINATION_SIGNALS = void 0;
|
|
6
7
|
exports.handleExit = handleExit;
|
|
7
8
|
exports.handleKeypress = handleKeypress;
|
|
8
9
|
const readline_1 = __importDefault(require("readline"));
|
|
9
10
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
11
|
const lang_1 = require("./lang");
|
|
11
12
|
const i18nKey = 'lib.process';
|
|
13
|
+
exports.TERMINATION_SIGNALS = [
|
|
14
|
+
'beforeExit',
|
|
15
|
+
'SIGINT', // Terminal trying to interrupt (Ctrl + C)
|
|
16
|
+
'SIGUSR1', // Start Debugger User-defined signal 1
|
|
17
|
+
'SIGUSR2', // User-defined signal 2
|
|
18
|
+
'uncaughtException',
|
|
19
|
+
'SIGTERM', // Represents a graceful termination
|
|
20
|
+
'SIGHUP', // Parent terminal has been closed
|
|
21
|
+
];
|
|
12
22
|
function handleExit(callback) {
|
|
13
|
-
const terminationSignals = [
|
|
14
|
-
'beforeExit',
|
|
15
|
-
'SIGINT', // Terminal trying to interrupt (Ctrl + C)
|
|
16
|
-
'SIGUSR1', // Start Debugger User-defined signal 1
|
|
17
|
-
'SIGUSR2', // User-defined signal 2
|
|
18
|
-
'uncaughtException',
|
|
19
|
-
'SIGTERM', // Represents a graceful termination
|
|
20
|
-
'SIGHUP', // Parent terminal has been closed
|
|
21
|
-
];
|
|
22
23
|
let exitInProgress = false;
|
|
23
|
-
|
|
24
|
+
exports.TERMINATION_SIGNALS.forEach(signal => {
|
|
24
25
|
process.removeAllListeners(signal);
|
|
25
26
|
process.on(signal, async () => {
|
|
26
27
|
// Prevent duplicate exit handling
|
|
@@ -24,8 +24,11 @@ function useV3Api(platformVersion) {
|
|
|
24
24
|
if (!platformVersion || typeof platformVersion !== 'string') {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
|
+
if (platformVersion.toLowerCase() === 'unstable') {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
27
30
|
const [year, minor] = platformVersion.split('.');
|
|
28
|
-
return Number(year) >= 2025 && Number(minor) >=
|
|
31
|
+
return Number(year) >= 2025 && Number(minor) >= 2;
|
|
29
32
|
}
|
|
30
33
|
function getSubtasks(task) {
|
|
31
34
|
if ('subbuildStatuses' in task) {
|