@hubspot/cli 7.0.2 → 7.0.4-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.
@@ -38,7 +38,7 @@ exports.handler = async (options) => {
38
38
  });
39
39
  try {
40
40
  const { data: buildId } = await buildPackage(derivedAccountId, functionPath);
41
- const successResp = await poll(() => getBuildStatus(derivedAccountId, buildId));
41
+ const successResp = await poll(getBuildStatus, derivedAccountId, buildId);
42
42
  const buildTimeSeconds = (successResp.buildTime / 1000).toFixed(2);
43
43
  SpinniesManager.succeed('loading');
44
44
  await outputBuildLog(successResp.cdnUrl);
@@ -68,7 +68,7 @@ exports.handler = async (options) => {
68
68
  text: i18n(`${i18nKey}.cloneStatus.inProgress`),
69
69
  });
70
70
  const { data: { exportId }, } = await cloneApp(derivedAccountId, appId);
71
- const { status } = await poll(() => checkCloneStatus(derivedAccountId, exportId));
71
+ const { status } = await poll(checkCloneStatus, derivedAccountId, exportId);
72
72
  if (status === 'SUCCESS') {
73
73
  // Ensure correct project folder structure exists
74
74
  const baseDestPath = path.resolve(getCwd(), projectDest);
@@ -126,7 +126,7 @@ exports.handler = async (options) => {
126
126
  });
127
127
  const { data: migrateResponse } = await migrateApp(derivedAccountId, appId, projectName);
128
128
  const { id } = migrateResponse;
129
- const pollResponse = await poll(() => checkMigrationStatus(derivedAccountId, id));
129
+ const pollResponse = await poll(checkMigrationStatus, derivedAccountId, id);
130
130
  const { status, project } = pollResponse;
131
131
  if (status === 'SUCCESS') {
132
132
  const absoluteDestPath = path.resolve(getCwd(), projectDest);
package/lang/en.lyaml CHANGED
@@ -1113,6 +1113,7 @@ en:
1113
1113
  notFound: "Your project {{#bold}}{{ projectName }}{{/bold}} could not be found in {{#bold}}{{ accountIdentifier }}{{/bold}}."
1114
1114
  pollFetchProject:
1115
1115
  checkingProject: "Checking if project exists in {{ accountIdentifier }}"
1116
+ unableToFindAutodeployStatus: "Unable to find the auto deploy for build #{{ buildId }}. This deploy may have been skipped. {{ viewDeploysLink }}."
1116
1117
  logFeedbackMessage:
1117
1118
  feedbackHeader: "We'd love to hear your feedback!"
1118
1119
  feedbackMessage: "How are you liking the new projects and developer tools? \n > Run `{{#yellow}}hs feedback{{/yellow}}` to let us know what you think!\n"
@@ -1128,7 +1129,6 @@ en:
1128
1129
  buildSucceededAutomaticallyDeploying: "Build #{{ buildId }} succeeded. {{#bold}}Automatically deploying{{/bold}} to {{ accountIdentifier }}\n"
1129
1130
  cleanedUpTempFile: "Cleaned up temporary file {{ path }}"
1130
1131
  viewDeploys: "View all deploys for this project in HubSpot"
1131
- unableToFindAutodeployStatus: "Unable to find the auto deploy for build #{{ buildId }}. This deploy may have been skipped. {{ viewDeploysLink }}."
1132
1132
  projectUpload:
1133
1133
  uploadProjectFiles:
1134
1134
  add: "Uploading {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
@@ -6,7 +6,13 @@ export declare const MARKETPLACE_FOLDER: "@marketplace";
6
6
  export declare const CONFIG_FLAGS: {
7
7
  readonly USE_CUSTOM_OBJECT_HUBFILE: "useCustomObjectHubfile";
8
8
  };
9
- export declare const DEFAULT_POLLING_DELAY = 2000;
9
+ export declare const POLLING_DELAY = 2000;
10
+ export declare const POLLING_STATUS: {
11
+ readonly SUCCESS: "SUCCESS";
12
+ readonly ERROR: "ERROR";
13
+ readonly REVERTED: "REVERTED";
14
+ readonly FAILURE: "FAILURE";
15
+ };
10
16
  export declare const PROJECT_CONFIG_FILE: "hsproject.json";
11
17
  export declare const PROJECT_BUILD_STATES: {
12
18
  readonly BUILDING: "BUILDING";
package/lib/constants.js CHANGED
@@ -1,6 +1,6 @@
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.CONFIG_FLAGS = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
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.POLLING_STATUS = exports.POLLING_DELAY = exports.CONFIG_FLAGS = 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;
@@ -9,7 +9,13 @@ exports.MARKETPLACE_FOLDER = '@marketplace';
9
9
  exports.CONFIG_FLAGS = {
10
10
  USE_CUSTOM_OBJECT_HUBFILE: 'useCustomObjectHubfile',
11
11
  };
12
- exports.DEFAULT_POLLING_DELAY = 2000;
12
+ exports.POLLING_DELAY = 2000;
13
+ exports.POLLING_STATUS = {
14
+ SUCCESS: 'SUCCESS',
15
+ ERROR: 'ERROR',
16
+ REVERTED: 'REVERTED',
17
+ FAILURE: 'FAILURE',
18
+ };
13
19
  exports.PROJECT_CONFIG_FILE = 'hsproject.json';
14
20
  exports.PROJECT_BUILD_STATES = {
15
21
  BUILDING: 'BUILDING',
package/lib/polling.d.ts CHANGED
@@ -1,17 +1,9 @@
1
1
  import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
2
- export declare const DEFAULT_POLLING_STATES: {
3
- readonly STARTED: "STARTED";
4
- readonly SUCCESS: "SUCCESS";
5
- readonly ERROR: "ERROR";
6
- readonly REVERTED: "REVERTED";
7
- readonly FAILURE: "FAILURE";
8
- };
2
+ import { ValueOf } from '@hubspot/local-dev-lib/types/Utils';
3
+ import { POLLING_STATUS } from './constants';
9
4
  type GenericPollingResponse = {
10
- status: string;
5
+ status: ValueOf<typeof POLLING_STATUS>;
11
6
  };
12
- type PollingCallback<T extends GenericPollingResponse> = () => HubSpotPromise<T>;
13
- export declare function poll<T extends GenericPollingResponse>(callback: PollingCallback<T>, statusLookup?: {
14
- successStates: string[];
15
- errorStates: string[];
16
- }): Promise<T>;
7
+ type PollingCallback<T extends GenericPollingResponse> = (accountId: number, taskId: number | string) => HubSpotPromise<T>;
8
+ export declare function poll<T extends GenericPollingResponse>(callback: PollingCallback<T>, accountId: number, taskId: number | string): Promise<T>;
17
9
  export {};
package/lib/polling.js CHANGED
@@ -1,34 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_POLLING_STATES = void 0;
4
3
  exports.poll = poll;
5
4
  const constants_1 = require("./constants");
6
- exports.DEFAULT_POLLING_STATES = {
7
- STARTED: 'STARTED',
8
- SUCCESS: 'SUCCESS',
9
- ERROR: 'ERROR',
10
- REVERTED: 'REVERTED',
11
- FAILURE: 'FAILURE',
12
- };
13
- const DEFAULT_POLLING_STATUS_LOOKUP = {
14
- successStates: [exports.DEFAULT_POLLING_STATES.SUCCESS],
15
- errorStates: [
16
- exports.DEFAULT_POLLING_STATES.ERROR,
17
- exports.DEFAULT_POLLING_STATES.REVERTED,
18
- exports.DEFAULT_POLLING_STATES.FAILURE,
19
- ],
20
- };
21
- function poll(callback, statusLookup = DEFAULT_POLLING_STATUS_LOOKUP) {
5
+ function poll(callback, accountId, taskId) {
22
6
  return new Promise((resolve, reject) => {
23
7
  const pollInterval = setInterval(async () => {
24
8
  try {
25
- const { data: pollResp } = await callback();
9
+ const { data: pollResp } = await callback(accountId, taskId);
26
10
  const { status } = pollResp;
27
- if (statusLookup.successStates.includes(status)) {
11
+ if (status === constants_1.POLLING_STATUS.SUCCESS) {
28
12
  clearInterval(pollInterval);
29
13
  resolve(pollResp);
30
14
  }
31
- else if (statusLookup.errorStates.includes(status)) {
15
+ else if (status === constants_1.POLLING_STATUS.ERROR ||
16
+ status === constants_1.POLLING_STATUS.REVERTED ||
17
+ status === constants_1.POLLING_STATUS.FAILURE) {
32
18
  clearInterval(pollInterval);
33
19
  reject(pollResp);
34
20
  }
@@ -37,6 +23,6 @@ function poll(callback, statusLookup = DEFAULT_POLLING_STATUS_LOOKUP) {
37
23
  clearInterval(pollInterval);
38
24
  reject(error);
39
25
  }
40
- }, constants_1.DEFAULT_POLLING_DELAY);
26
+ }, constants_1.POLLING_DELAY);
41
27
  });
42
28
  }
@@ -197,13 +197,13 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
197
197
  resolve(taskStatus);
198
198
  }
199
199
  }
200
- }, constants_1.DEFAULT_POLLING_DELAY);
200
+ }, constants_1.POLLING_DELAY);
201
201
  });
202
202
  };
203
203
  }
204
204
  function pollBuildAutodeployStatus(accountId, taskName, buildId) {
205
205
  return new Promise((resolve, reject) => {
206
- let maxIntervals = (30 * 1000) / constants_1.DEFAULT_POLLING_DELAY; // Num of intervals in ~30s
206
+ let maxIntervals = (30 * 1000) / constants_1.POLLING_DELAY; // Num of intervals in ~30s
207
207
  const pollInterval = setInterval(async () => {
208
208
  let build;
209
209
  try {
@@ -224,7 +224,7 @@ function pollBuildAutodeployStatus(accountId, taskName, buildId) {
224
224
  else {
225
225
  maxIntervals -= 1;
226
226
  }
227
- }, constants_1.DEFAULT_POLLING_DELAY);
227
+ }, constants_1.POLLING_DELAY);
228
228
  });
229
229
  }
230
230
  exports.pollBuildStatus = makePollTaskStatusFunc({
@@ -171,7 +171,7 @@ async function pollFetchProject(accountId, projectName) {
171
171
  reject(err);
172
172
  }
173
173
  }
174
- }, constants_1.DEFAULT_POLLING_DELAY);
174
+ }, constants_1.POLLING_DELAY);
175
175
  });
176
176
  }
177
177
  async function ensureProjectExists(accountId, projectName, { forceCreate = false, allowCreate = true, noLogs = false, withPolling = false, uploadCommand = false, } = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.0.2",
3
+ "version": "7.0.4-experimental.0",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
@@ -8,7 +8,7 @@
8
8
  "@hubspot/local-dev-lib": "3.1.3",
9
9
  "@hubspot/serverless-dev-runtime": "7.0.1",
10
10
  "@hubspot/theme-preview-dev-server": "0.0.10",
11
- "@hubspot/ui-extensions-dev-server": "0.8.42",
11
+ "@hubspot/ui-extensions-dev-server": "0.8.40",
12
12
  "archiver": "^7.0.1",
13
13
  "chalk": "^4.1.2",
14
14
  "chokidar": "^3.0.1",
@@ -55,9 +55,6 @@
55
55
  "ts-node": "^10.9.2",
56
56
  "typescript": "^5.6.2"
57
57
  },
58
- "optionalDependencies": {
59
- "@hubspot/cms-dev-server": "^0.18.10"
60
- },
61
58
  "scripts": {
62
59
  "build": "ts-node ./scripts/build.ts",
63
60
  "lint": "eslint . && prettier --list-different ./**/*.{js,json}",