@hubspot/local-dev-lib 3.1.3 → 3.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/api/github.d.ts +1 -0
- package/api/projects.d.ts +2 -1
- package/api/projects.js +11 -1
- package/config/CLIConfiguration.d.ts +2 -1
- package/config/CLIConfiguration.js +46 -13
- package/config/index.d.ts +2 -0
- package/config/index.js +13 -1
- package/constants/config.d.ts +4 -1
- package/constants/config.js +5 -2
- package/lang/en.json +4 -0
- package/lib/archive.d.ts +1 -0
- package/lib/github.d.ts +1 -0
- package/package.json +19 -19
- package/types/Http.d.ts +1 -0
package/api/github.d.ts
CHANGED
package/api/projects.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { HubSpotPromise, QueryParams } from '../types/Http';
|
|
3
4
|
import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse } from '../types/Project';
|
|
4
5
|
import { Build, FetchProjectBuildsResponse } from '../types/Build';
|
|
@@ -16,7 +17,7 @@ export declare function fetchPlatformVersions(accountId: number): HubSpotPromise
|
|
|
16
17
|
export declare function fetchProjectBuilds(accountId: number, projectName: string, params?: QueryParams): HubSpotPromise<FetchProjectBuildsResponse>;
|
|
17
18
|
export declare function getBuildStatus(accountId: number, projectName: string, buildId: number): HubSpotPromise<Build>;
|
|
18
19
|
export declare function getBuildStructure(accountId: number, projectName: string, buildId: number): HubSpotPromise<ComponentStructureResponse>;
|
|
19
|
-
export declare function deployProject(accountId: number, projectName: string, buildId: number): HubSpotPromise<ProjectDeployResponse>;
|
|
20
|
+
export declare function deployProject(accountId: number, projectName: string, buildId: number, useNewDeployApi?: boolean): HubSpotPromise<ProjectDeployResponse>;
|
|
20
21
|
export declare function getDeployStatus(accountId: number, projectName: string, deployId: number): HubSpotPromise<Deploy>;
|
|
21
22
|
export declare function getDeployStructure(accountId: number, projectName: string, deployId: number): HubSpotPromise<ComponentStructureResponse>;
|
|
22
23
|
export declare function fetchProjectSettings(accountId: number, projectName: string): HubSpotPromise<ProjectSettings>;
|
package/api/projects.js
CHANGED
|
@@ -9,6 +9,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const PROJECTS_API_PATH = 'dfs/v1/projects';
|
|
10
10
|
const DEVELOPER_FILE_SYSTEM_PATH = 'dfs/v1';
|
|
11
11
|
const PROJECTS_DEPLOY_API_PATH = 'dfs/deploy/v1';
|
|
12
|
+
const PROJECTS_DEPLOY_API_PATH_V3 = 'dfs/deploy/v3';
|
|
12
13
|
const PROJECTS_LOGS_API_PATH = 'dfs/logging/v1';
|
|
13
14
|
const DEVELOPER_PROJECTS_API_PATH = 'developer/projects/v1';
|
|
14
15
|
const MIGRATIONS_API_PATH = 'dfs/migrations/v1';
|
|
@@ -115,7 +116,16 @@ function getBuildStructure(accountId, projectName, buildId) {
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
exports.getBuildStructure = getBuildStructure;
|
|
118
|
-
function deployProject(accountId, projectName, buildId) {
|
|
119
|
+
function deployProject(accountId, projectName, buildId, useNewDeployApi = false) {
|
|
120
|
+
if (useNewDeployApi) {
|
|
121
|
+
return http_1.http.post(accountId, {
|
|
122
|
+
url: `${PROJECTS_DEPLOY_API_PATH_V3}/deploys/queue/async`,
|
|
123
|
+
data: {
|
|
124
|
+
projectName,
|
|
125
|
+
targetBuildId: buildId,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
119
129
|
return http_1.http.post(accountId, {
|
|
120
130
|
url: `${PROJECTS_DEPLOY_API_PATH}/deploys/queue/async`,
|
|
121
131
|
data: {
|
|
@@ -20,7 +20,8 @@ declare class _CLIConfiguration {
|
|
|
20
20
|
isConfigFlagEnabled(flag: keyof CLIConfig_NEW, defaultValue?: boolean): boolean;
|
|
21
21
|
getAccountId(nameOrId?: string | number): number | null;
|
|
22
22
|
getDefaultAccount(): string | number | null;
|
|
23
|
-
|
|
23
|
+
getDefaultAccountOverrideFilePath(): string | null;
|
|
24
|
+
getCWDAccountOverride(): string | number | null;
|
|
24
25
|
getAccountIndex(accountId: number): number;
|
|
25
26
|
getConfigForAccount(accountId?: number): CLIAccount_NEW | null;
|
|
26
27
|
getConfigAccounts(): Array<CLIAccount_NEW> | null;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.CLIConfiguration = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
9
|
+
const path_1 = require("../lib/path");
|
|
4
10
|
const logger_1 = require("../lib/logger");
|
|
5
11
|
const environment_1 = require("./environment");
|
|
6
12
|
const environment_2 = require("../lib/environment");
|
|
@@ -179,20 +185,47 @@ class _CLIConfiguration {
|
|
|
179
185
|
return account ? account.accountId : null;
|
|
180
186
|
}
|
|
181
187
|
getDefaultAccount() {
|
|
182
|
-
return this.
|
|
183
|
-
? this.config.defaultAccount
|
|
184
|
-
: null;
|
|
188
|
+
return this.getCWDAccountOverride() || this.config?.defaultAccount || null;
|
|
185
189
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
getDefaultAccountOverrideFilePath() {
|
|
191
|
+
return (0, findup_sync_1.default)([config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME], {
|
|
192
|
+
cwd: (0, path_1.getCwd)(),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
getCWDAccountOverride() {
|
|
196
|
+
const defaultOverrideFile = this.getDefaultAccountOverrideFilePath();
|
|
197
|
+
if (!defaultOverrideFile) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
let source;
|
|
201
|
+
try {
|
|
202
|
+
source = fs_1.default.readFileSync(defaultOverrideFile, 'utf8');
|
|
203
|
+
}
|
|
204
|
+
catch (e) {
|
|
205
|
+
if (e instanceof Error) {
|
|
206
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.getCWDAccountOverride.readFileError`, {
|
|
207
|
+
error: e.message,
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
const accountId = Number(source);
|
|
213
|
+
if (isNaN(accountId)) {
|
|
214
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.getCWDAccountOverride.errorHeader`, {
|
|
215
|
+
hsAccountFile: defaultOverrideFile,
|
|
216
|
+
}), {
|
|
217
|
+
cause: config_1.DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
const account = this.config?.accounts?.find(account => account.accountId === accountId);
|
|
221
|
+
if (!account) {
|
|
222
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.getCWDAccountOverride.errorHeader`, {
|
|
223
|
+
hsAccountFile: defaultOverrideFile,
|
|
224
|
+
}), {
|
|
225
|
+
cause: config_1.DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return account.name || account.accountId;
|
|
196
229
|
}
|
|
197
230
|
getAccountIndex(accountId) {
|
|
198
231
|
return this.config
|
package/config/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export declare function getAccountType(accountType?: AccountType, sandboxAccount
|
|
|
33
33
|
export declare function getConfigDefaultAccount(): string | number | null | undefined;
|
|
34
34
|
export declare function getConfigAccounts(): Array<CLIAccount_NEW> | Array<CLIAccount_DEPRECATED> | null | undefined;
|
|
35
35
|
export declare function updateDefaultCmsPublishMode(cmsPublishMode: CmsPublishMode): void | CLIConfig_NEW | null;
|
|
36
|
+
export declare function getCWDAccountOverride(): string | number | null | undefined;
|
|
37
|
+
export declare function getDefaultAccountOverrideFilePath(): string | null | undefined;
|
|
36
38
|
export declare const getConfigAccountId: typeof config_DEPRECATED.getConfigAccountId;
|
|
37
39
|
export declare const getOrderedAccount: typeof config_DEPRECATED.getOrderedAccount;
|
|
38
40
|
export declare const getOrderedConfig: typeof config_DEPRECATED.getOrderedConfig;
|
package/config/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.updateDefaultCmsPublishMode = exports.getConfigAccounts = exports.getConfigDefaultAccount = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.configFileExists = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
|
|
26
|
+
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.getDefaultAccountOverrideFilePath = exports.getCWDAccountOverride = exports.updateDefaultCmsPublishMode = exports.getConfigAccounts = exports.getConfigDefaultAccount = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.configFileExists = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
|
|
27
27
|
const config_DEPRECATED = __importStar(require("./config_DEPRECATED"));
|
|
28
28
|
const CLIConfiguration_1 = require("./CLIConfiguration");
|
|
29
29
|
const configFile_1 = require("./configFile");
|
|
@@ -251,6 +251,18 @@ function updateDefaultCmsPublishMode(cmsPublishMode) {
|
|
|
251
251
|
return config_DEPRECATED.updateDefaultCmsPublishMode(cmsPublishMode);
|
|
252
252
|
}
|
|
253
253
|
exports.updateDefaultCmsPublishMode = updateDefaultCmsPublishMode;
|
|
254
|
+
function getCWDAccountOverride() {
|
|
255
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
256
|
+
return CLIConfiguration_1.CLIConfiguration.getCWDAccountOverride();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
exports.getCWDAccountOverride = getCWDAccountOverride;
|
|
260
|
+
function getDefaultAccountOverrideFilePath() {
|
|
261
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
262
|
+
return CLIConfiguration_1.CLIConfiguration.getDefaultAccountOverrideFilePath();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.getDefaultAccountOverrideFilePath = getDefaultAccountOverrideFilePath;
|
|
254
266
|
// These functions are not supported with the new config setup
|
|
255
267
|
exports.getConfigAccountId = config_DEPRECATED.getConfigAccountId;
|
|
256
268
|
exports.getOrderedAccount = config_DEPRECATED.getOrderedAccount;
|
package/constants/config.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare const DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = "hubspot.config.yml";
|
|
2
|
-
export declare const HUBSPOT_CONFIGURATION_FOLDER = ".
|
|
2
|
+
export declare const HUBSPOT_CONFIGURATION_FOLDER = ".hscli";
|
|
3
3
|
export declare const HUBSPOT_CONFIGURATION_FILE = "config.yml";
|
|
4
|
+
export declare const DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME = ".hsaccount";
|
|
5
|
+
export declare const DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID = "DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID";
|
|
6
|
+
export declare const DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND = "DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND";
|
|
4
7
|
export declare const MIN_HTTP_TIMEOUT = 3000;
|
|
5
8
|
export declare const HUBSPOT_ACCOUNT_TYPES: {
|
|
6
9
|
readonly DEVELOPMENT_SANDBOX: "DEVELOPMENT_SANDBOX";
|
package/constants/config.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HUBSPOT_ACCOUNT_TYPE_STRINGS = exports.HUBSPOT_ACCOUNT_TYPES = exports.MIN_HTTP_TIMEOUT = exports.HUBSPOT_CONFIGURATION_FILE = exports.HUBSPOT_CONFIGURATION_FOLDER = exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = void 0;
|
|
3
|
+
exports.HUBSPOT_ACCOUNT_TYPE_STRINGS = exports.HUBSPOT_ACCOUNT_TYPES = exports.MIN_HTTP_TIMEOUT = exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND = exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID = exports.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME = exports.HUBSPOT_CONFIGURATION_FILE = exports.HUBSPOT_CONFIGURATION_FOLDER = exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = void 0;
|
|
4
4
|
const lang_1 = require("../utils/lang");
|
|
5
5
|
exports.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = 'hubspot.config.yml';
|
|
6
|
-
exports.HUBSPOT_CONFIGURATION_FOLDER = '.
|
|
6
|
+
exports.HUBSPOT_CONFIGURATION_FOLDER = '.hscli';
|
|
7
7
|
exports.HUBSPOT_CONFIGURATION_FILE = 'config.yml';
|
|
8
|
+
exports.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME = '.hsaccount';
|
|
9
|
+
exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID = 'DEFAULT_ACCOUNT_OVERRIDE_ERROR_INVALID_ID';
|
|
10
|
+
exports.DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND = 'DEFAULT_ACCOUNT_OVERRIDE_ERROR_ACCOUNT_NOT_FOUND';
|
|
8
11
|
exports.MIN_HTTP_TIMEOUT = 3000;
|
|
9
12
|
exports.HUBSPOT_ACCOUNT_TYPES = {
|
|
10
13
|
DEVELOPMENT_SANDBOX: 'DEVELOPMENT_SANDBOX',
|
package/lang/en.json
CHANGED
|
@@ -263,6 +263,10 @@
|
|
|
263
263
|
"invalidInput": "A 'defaultAccount' with value of number or string is required to update the config."
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
|
+
"getCWDAccountOverride": {
|
|
267
|
+
"errorHeader": "Error in {{ hsAccountFile }}",
|
|
268
|
+
"readFileError": "Error reading account override file."
|
|
269
|
+
},
|
|
266
270
|
"renameAccount": {
|
|
267
271
|
"errors": {
|
|
268
272
|
"invalidName": "Cannot find account with identifier {{ currentName }}"
|
package/lib/archive.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { CopySourceToDestOptions } from '../types/Archive';
|
|
3
4
|
export declare function extractZipArchive(zip: Buffer, name: string, dest: string, { sourceDir, includesRootDir, hideLogs }?: CopySourceToDestOptions): Promise<boolean>;
|
package/lib/github.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { GithubReleaseData, GithubRepoFile, RepoPath, CloneGithubRepoOptions } from '../types/Github';
|
|
3
4
|
export declare function fetchFileFromRepository<T = Buffer>(repoPath: RepoPath, filePath: string, ref: string): Promise<T>;
|
|
4
5
|
export declare function fetchReleaseData(repoPath: RepoPath, tag?: string): Promise<GithubReleaseData>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/local-dev-lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-beta.0",
|
|
4
4
|
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -57,24 +57,24 @@
|
|
|
57
57
|
"./types/*": "./types/*.d.ts"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"address": "
|
|
61
|
-
"axios": "
|
|
62
|
-
"chalk": "
|
|
63
|
-
"chokidar": "
|
|
64
|
-
"content-disposition": "
|
|
65
|
-
"cors": "
|
|
66
|
-
"debounce": "
|
|
67
|
-
"express": "
|
|
68
|
-
"extract-zip": "
|
|
69
|
-
"findup-sync": "
|
|
70
|
-
"fs-extra": "
|
|
71
|
-
"ignore": "
|
|
72
|
-
"js-yaml": "
|
|
73
|
-
"moment": "
|
|
74
|
-
"p-queue": "
|
|
75
|
-
"prettier": "
|
|
76
|
-
"semver": "
|
|
77
|
-
"unixify": "
|
|
60
|
+
"address": "2.0.2",
|
|
61
|
+
"axios": "1.7.2",
|
|
62
|
+
"chalk": "2.4.2",
|
|
63
|
+
"chokidar": "3.6.0",
|
|
64
|
+
"content-disposition": "0.5.4",
|
|
65
|
+
"cors": "2.8.5",
|
|
66
|
+
"debounce": "1.2.1",
|
|
67
|
+
"express": "4.19.2",
|
|
68
|
+
"extract-zip": "2.0.1",
|
|
69
|
+
"findup-sync": "5.0.0",
|
|
70
|
+
"fs-extra": "11.2.0",
|
|
71
|
+
"ignore": "5.3.1",
|
|
72
|
+
"js-yaml": "4.1.0",
|
|
73
|
+
"moment": "2.30.1",
|
|
74
|
+
"p-queue": "6.6.2",
|
|
75
|
+
"prettier": "3.3.1",
|
|
76
|
+
"semver": "6.3.1",
|
|
77
|
+
"unixify": "1.0.0"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=16.20.0"
|
package/types/Http.d.ts
CHANGED