@hubspot/cli 6.3.0 → 6.4.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/bin/cli.js +2 -0
- package/commands/doctor.d.ts +8 -0
- package/commands/doctor.js +60 -0
- package/commands/init.js +20 -7
- package/commands/lint.d.ts +4 -1
- package/commands/lint.js +11 -2
- package/commands/project/installDeps.js +5 -5
- package/commands/project/logs.js +1 -1
- package/commands/theme/preview.js +38 -20
- package/lang/en.lyaml +68 -0
- package/lib/DevServerManager.js +2 -5
- package/lib/commonOpts.d.ts +3 -2
- package/lib/commonOpts.js +2 -2
- package/lib/dependencyManagement.d.ts +3 -1
- package/lib/dependencyManagement.js +19 -0
- package/lib/doctor/Diagnosis.d.ts +27 -0
- package/lib/doctor/Diagnosis.js +119 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +61 -0
- package/lib/doctor/DiagnosticInfoBuilder.js +158 -0
- package/lib/doctor/Doctor.d.ts +21 -0
- package/lib/doctor/Doctor.js +328 -0
- package/lib/errorHandlers/index.d.ts +14 -1
- package/lib/errorHandlers/index.js +43 -50
- package/lib/errorHandlers/suppressError.d.ts +2 -1
- package/lib/errorHandlers/suppressError.js +32 -37
- package/lib/interpolation.d.ts +3 -0
- package/lib/interpolation.js +4 -3
- package/lib/links.d.ts +9 -0
- package/lib/links.js +99 -97
- package/lib/projects.d.ts +4 -1
- package/lib/projects.js +5 -3
- package/lib/ui/SpinniesManager.d.ts +39 -1
- package/lib/ui/SpinniesManager.js +66 -35
- package/lib/ui/git.d.ts +1 -1
- package/lib/ui/git.js +17 -17
- package/lib/ui/index.d.ts +16 -1
- package/lib/ui/index.js +87 -114
- package/lib/ui/serverlessFunctionLogs.js +28 -19
- package/lib/ui/spinniesUtils.d.ts +31 -0
- package/lib/ui/spinniesUtils.js +45 -31
- package/lib/ui/supportHyperlinks.d.ts +6 -0
- package/lib/ui/supportHyperlinks.js +10 -10
- package/lib/ui/supportsColor.d.ts +16 -0
- package/lib/ui/supportsColor.js +19 -17
- package/lib/ui/table.d.ts +3 -1
- package/lib/ui/table.js +17 -11
- package/lib/usageTracking.d.ts +2 -1
- package/lib/usageTracking.js +2 -0
- package/package.json +10 -5
|
@@ -1,87 +1,80 @@
|
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
6
|
+
exports.ApiErrorContext = void 0;
|
|
7
|
+
exports.logError = logError;
|
|
8
|
+
exports.debugError = debugError;
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
11
|
+
const suppressError_1 = require("./suppressError");
|
|
12
|
+
const lang_1 = require("../lang");
|
|
13
|
+
const util_1 = __importDefault(require("util"));
|
|
10
14
|
const i18nKey = 'lib.errorHandlers.index';
|
|
11
|
-
function logError(error, context
|
|
15
|
+
function logError(error, context) {
|
|
12
16
|
debugError(error, context);
|
|
13
|
-
if (shouldSuppressError(error, context)
|
|
14
|
-
shouldSuppressError(error, error.context)) {
|
|
17
|
+
if ((0, suppressError_1.shouldSuppressError)(error, context)) {
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
17
|
-
if (isHubSpotHttpError(error) && context) {
|
|
18
|
-
error.
|
|
19
|
-
|
|
20
|
-
if (isHubSpotHttpError(error) || isFileSystemError(error)) {
|
|
21
|
-
if (isValidationError(error) || isMissingScopeError(error)) {
|
|
22
|
-
logger.error(error.formattedValidationErrors());
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
logger.error(error.message);
|
|
20
|
+
if ((0, index_1.isHubSpotHttpError)(error) && 'context' in error) {
|
|
21
|
+
if ((0, suppressError_1.shouldSuppressError)(error, error.context)) {
|
|
22
|
+
return;
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if ((0, index_1.isHubSpotHttpError)(error) && context) {
|
|
26
|
+
error.updateContext(context);
|
|
27
|
+
}
|
|
28
|
+
if ((0, index_1.isHubSpotHttpError)(error) && (0, index_1.isValidationError)(error)) {
|
|
29
|
+
logger_1.logger.error(error.formattedValidationErrors());
|
|
30
30
|
}
|
|
31
|
-
else if (error
|
|
31
|
+
else if (isErrorWithMessageOrReason(error)) {
|
|
32
32
|
const message = [];
|
|
33
33
|
[error.message, error.reason].forEach(msg => {
|
|
34
34
|
if (msg) {
|
|
35
35
|
message.push(msg);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
logger.error(message.join(' '));
|
|
38
|
+
logger_1.logger.error(message.join(' '));
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
// Unknown errors
|
|
42
|
-
logger.error(i18n(`${i18nKey}.unknownErrorOccurred`));
|
|
42
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.unknownErrorOccurred`));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* @param {Error} error
|
|
49
|
-
* @param {ApiErrorContext} context
|
|
50
|
-
*/
|
|
51
|
-
function debugError(error, context = {}) {
|
|
52
|
-
if (isHubSpotHttpError(error)) {
|
|
53
|
-
logger.debug(error.toString());
|
|
45
|
+
function debugError(error, context) {
|
|
46
|
+
if ((0, index_1.isHubSpotHttpError)(error)) {
|
|
47
|
+
logger_1.logger.debug(error.toString());
|
|
54
48
|
}
|
|
55
49
|
else {
|
|
56
|
-
logger.debug(i18n(`${i18nKey}.errorOccurred`, { error }));
|
|
50
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errorOccurred`, { error: String(error) }));
|
|
57
51
|
}
|
|
58
|
-
if (error
|
|
59
|
-
logger.debug(i18n(`${i18nKey}.errorCause`, {
|
|
60
|
-
cause:
|
|
61
|
-
? error.cause
|
|
62
|
-
: util.inspect(error.cause, false, null, true),
|
|
52
|
+
if (error instanceof Error) {
|
|
53
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errorCause`, {
|
|
54
|
+
cause: util_1.default.inspect(error.cause, false, null, true),
|
|
63
55
|
}));
|
|
64
56
|
}
|
|
65
57
|
if (context) {
|
|
66
|
-
logger.debug(i18n(`${i18nKey}.errorContext`, {
|
|
67
|
-
context:
|
|
58
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errorContext`, {
|
|
59
|
+
context: util_1.default.inspect(context, false, null, true),
|
|
68
60
|
}));
|
|
69
61
|
}
|
|
70
62
|
}
|
|
71
63
|
class ApiErrorContext {
|
|
64
|
+
accountId;
|
|
65
|
+
request;
|
|
66
|
+
payload;
|
|
67
|
+
projectName;
|
|
72
68
|
constructor(props = {}) {
|
|
73
|
-
/** @type {number} */
|
|
74
69
|
this.accountId = props.accountId;
|
|
75
|
-
/** @type {string} */
|
|
76
70
|
this.request = props.request || '';
|
|
77
|
-
/** @type {string} */
|
|
78
71
|
this.payload = props.payload || '';
|
|
79
|
-
/** @type {string} */
|
|
80
72
|
this.projectName = props.projectName || '';
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
exports.ApiErrorContext = ApiErrorContext;
|
|
76
|
+
function isErrorWithMessageOrReason(error) {
|
|
77
|
+
return (typeof error === 'object' &&
|
|
78
|
+
error !== null &&
|
|
79
|
+
('message' in error || 'reason' in error));
|
|
80
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ApiErrorContext } from './index';
|
|
2
|
+
export declare function shouldSuppressError(err: unknown, context?: ApiErrorContext): boolean;
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
3
|
+
exports.shouldSuppressError = shouldSuppressError;
|
|
4
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
5
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const lang_1 = require("../lang");
|
|
8
|
+
const ui_1 = require("../ui");
|
|
9
9
|
const i18nKey = 'lib.errorHandlers.suppressErrors';
|
|
10
10
|
function createPlatformVersionError(err, subCategory) {
|
|
11
11
|
let translationKey = 'unspecifiedPlatformVersion';
|
|
12
12
|
let platformVersion = 'unspecified platformVersion';
|
|
13
|
-
const errorContext = err.
|
|
13
|
+
const errorContext = err.data.context;
|
|
14
14
|
switch (subCategory) {
|
|
15
|
-
case
|
|
15
|
+
case constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED:
|
|
16
16
|
translationKey = 'platformVersionRetired';
|
|
17
17
|
if (errorContext && errorContext[subCategory]) {
|
|
18
18
|
platformVersion = errorContext[subCategory];
|
|
19
19
|
}
|
|
20
20
|
break;
|
|
21
|
-
case
|
|
22
|
-
PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST,
|
|
23
|
-
]:
|
|
21
|
+
case constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST:
|
|
24
22
|
translationKey = 'nonExistentPlatformVersion';
|
|
25
23
|
if (errorContext && errorContext[subCategory]) {
|
|
26
24
|
platformVersion = errorContext[subCategory];
|
|
@@ -29,48 +27,45 @@ function createPlatformVersionError(err, subCategory) {
|
|
|
29
27
|
default:
|
|
30
28
|
break;
|
|
31
29
|
}
|
|
32
|
-
uiLine();
|
|
33
|
-
logger.error(i18n(`${i18nKey}.platformVersionErrors.header`));
|
|
34
|
-
logger.log(i18n(`${i18nKey}.platformVersionErrors.${translationKey}`, {
|
|
30
|
+
(0, ui_1.uiLine)();
|
|
31
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.platformVersionErrors.header`));
|
|
32
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.platformVersionErrors.${translationKey}`, {
|
|
35
33
|
platformVersion,
|
|
36
34
|
}));
|
|
37
|
-
logger.log(i18n(`${i18nKey}.platformVersionErrors.updateProject`));
|
|
38
|
-
logger.log(i18n(`${i18nKey}.platformVersionErrors.betaLink`, {
|
|
39
|
-
docsLink: uiLink(i18n(`${i18nKey}.platformVersionErrors.docsLink`), 'https://developers.hubspot.com/docs/platform/platform-versioning'),
|
|
35
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.platformVersionErrors.updateProject`));
|
|
36
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.platformVersionErrors.betaLink`, {
|
|
37
|
+
docsLink: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.platformVersionErrors.docsLink`), 'https://developers.hubspot.com/docs/platform/platform-versioning'),
|
|
40
38
|
}));
|
|
41
|
-
uiLine();
|
|
39
|
+
(0, ui_1.uiLine)();
|
|
42
40
|
}
|
|
43
|
-
function shouldSuppressError(err, context
|
|
44
|
-
if (isMissingScopeError(err)) {
|
|
45
|
-
logger.error(i18n(`${i18nKey}.missingScopeError`, {
|
|
46
|
-
accountName: context
|
|
47
|
-
? uiAccountDescription(context.accountId)
|
|
41
|
+
function shouldSuppressError(err, context) {
|
|
42
|
+
if ((0, index_1.isMissingScopeError)(err)) {
|
|
43
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.missingScopeError`, {
|
|
44
|
+
accountName: context?.accountId
|
|
45
|
+
? (0, ui_1.uiAccountDescription)(context.accountId)
|
|
48
46
|
: '',
|
|
49
|
-
request: context
|
|
50
|
-
authCommand: uiCommandReference('hs auth'),
|
|
47
|
+
request: context?.request || 'request',
|
|
48
|
+
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
51
49
|
}));
|
|
52
50
|
return true;
|
|
53
51
|
}
|
|
54
|
-
if (isSpecifiedError(err, {
|
|
55
|
-
subCategory: PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED,
|
|
52
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
53
|
+
subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED,
|
|
56
54
|
})) {
|
|
57
|
-
createPlatformVersionError(err.data, PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED);
|
|
55
|
+
createPlatformVersionError(err.data, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED);
|
|
58
56
|
return true;
|
|
59
57
|
}
|
|
60
|
-
if (isSpecifiedError(err, {
|
|
61
|
-
subCategory: PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED,
|
|
58
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
59
|
+
subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED,
|
|
62
60
|
})) {
|
|
63
|
-
createPlatformVersionError(err.data, PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED);
|
|
61
|
+
createPlatformVersionError(err.data, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED);
|
|
64
62
|
return true;
|
|
65
63
|
}
|
|
66
|
-
if (isSpecifiedError(err, {
|
|
67
|
-
subCategory: PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST,
|
|
64
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
65
|
+
subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST,
|
|
68
66
|
})) {
|
|
69
|
-
createPlatformVersionError(err.data, PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST);
|
|
67
|
+
createPlatformVersionError(err.data, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST);
|
|
70
68
|
return true;
|
|
71
69
|
}
|
|
72
70
|
return false;
|
|
73
71
|
}
|
|
74
|
-
module.exports = {
|
|
75
|
-
shouldSuppressError,
|
|
76
|
-
};
|
package/lib/interpolation.d.ts
CHANGED
package/lib/interpolation.js
CHANGED
|
@@ -3,9 +3,10 @@ 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.helpers = void 0;
|
|
6
7
|
exports.interpolate = interpolate;
|
|
7
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
|
|
9
|
+
exports.helpers = {
|
|
9
10
|
bold: function (stringValue) {
|
|
10
11
|
return chalk_1.default.bold(stringValue);
|
|
11
12
|
},
|
|
@@ -79,8 +80,8 @@ function compileHelper(stringValue, helperIdentifier, helperFn) {
|
|
|
79
80
|
return compiledString;
|
|
80
81
|
}
|
|
81
82
|
function compileHelpers(stringValue) {
|
|
82
|
-
return Object.keys(helpers).reduce((currentStringValue, helperIdentifier) => {
|
|
83
|
-
return compileHelper(currentStringValue, helperIdentifier, helpers[helperIdentifier]);
|
|
83
|
+
return Object.keys(exports.helpers).reduce((currentStringValue, helperIdentifier) => {
|
|
84
|
+
return compileHelper(currentStringValue, helperIdentifier, exports.helpers[helperIdentifier]);
|
|
84
85
|
}, stringValue);
|
|
85
86
|
}
|
|
86
87
|
function interpolate(stringValue, interpolationData) {
|
package/lib/links.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
type SiteLink = {
|
|
2
|
+
shortcut: string;
|
|
3
|
+
alias?: string;
|
|
4
|
+
getUrl: (accountId: number, baseUrl: string) => string;
|
|
5
|
+
url?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function getSiteLinksAsArray(accountId: number): SiteLink[];
|
|
8
|
+
export declare function logSiteLinks(accountId: number): void;
|
|
9
|
+
export declare function openLink(accountId: number, shortcut: string): void;
|
|
1
10
|
export {};
|
package/lib/links.js
CHANGED
|
@@ -1,107 +1,109 @@
|
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
6
|
+
exports.getSiteLinksAsArray = getSiteLinksAsArray;
|
|
7
|
+
exports.logSiteLinks = logSiteLinks;
|
|
8
|
+
exports.openLink = openLink;
|
|
9
|
+
const open_1 = __importDefault(require("open"));
|
|
10
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
11
|
+
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
12
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
13
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
14
|
+
const table_1 = require("./ui/table");
|
|
15
|
+
const SITE_LINKS = {
|
|
16
|
+
APPS_MARKETPLACE: {
|
|
17
|
+
shortcut: 'apps-marketplace',
|
|
18
|
+
alias: 'apm',
|
|
19
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/ecosystem/${accountId}/marketplace/apps`,
|
|
20
|
+
},
|
|
21
|
+
ASSET_MARKETPLACE: {
|
|
22
|
+
shortcut: 'asset-marketplace',
|
|
23
|
+
alias: 'asm',
|
|
24
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/ecosystem/${accountId}/marketplace/products`,
|
|
25
|
+
},
|
|
26
|
+
CONTENT_STAGING: {
|
|
27
|
+
shortcut: 'content-staging',
|
|
28
|
+
alias: 'cs',
|
|
29
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/content/${accountId}/staging`,
|
|
30
|
+
},
|
|
31
|
+
DESIGN_MANAGER: {
|
|
32
|
+
shortcut: 'design-manager',
|
|
33
|
+
alias: 'dm',
|
|
34
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/design-manager/${accountId}`,
|
|
35
|
+
},
|
|
36
|
+
DOCS: {
|
|
37
|
+
shortcut: 'docs',
|
|
38
|
+
getUrl: () => 'https://developers.hubspot.com',
|
|
39
|
+
},
|
|
40
|
+
FILE_MANAGER: {
|
|
41
|
+
shortcut: 'file-manager',
|
|
42
|
+
alias: 'fm',
|
|
43
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/files/${accountId}`,
|
|
44
|
+
},
|
|
45
|
+
FORUMS: {
|
|
46
|
+
shortcut: 'forums',
|
|
47
|
+
getUrl: () => 'https://community.hubspot.com',
|
|
48
|
+
},
|
|
49
|
+
HUBDB: {
|
|
50
|
+
shortcut: 'hubdb',
|
|
51
|
+
alias: 'hdb',
|
|
52
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/hubdb/${accountId}`,
|
|
53
|
+
},
|
|
54
|
+
SETTINGS: {
|
|
55
|
+
shortcut: 'settings',
|
|
56
|
+
alias: 's',
|
|
57
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/settings/${accountId}`,
|
|
58
|
+
},
|
|
59
|
+
SETTINGS_NAVIGATION: {
|
|
60
|
+
shortcut: 'settings/navigation',
|
|
61
|
+
alias: 'sn',
|
|
62
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/menus/${accountId}/edit/`,
|
|
63
|
+
},
|
|
64
|
+
SETTINGS_WEBSITE: {
|
|
65
|
+
shortcut: 'settings/website',
|
|
66
|
+
alias: 'sw',
|
|
67
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/settings/${accountId}/website/pages/all-domains/page-templates`,
|
|
68
|
+
},
|
|
69
|
+
SETTINGS_getUrl_REDIRECTS: {
|
|
70
|
+
shortcut: 'settings/url-redirects',
|
|
71
|
+
alias: 'sur',
|
|
72
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/domains/${accountId}/url-redirects`,
|
|
73
|
+
},
|
|
74
|
+
PURCHASED_ASSETS: {
|
|
75
|
+
shortcut: 'purchased-assets',
|
|
76
|
+
alias: 'pa',
|
|
77
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/marketplace/${accountId}/manage-purchases`,
|
|
78
|
+
},
|
|
79
|
+
WEBSITE_PAGES: {
|
|
80
|
+
shortcut: 'website-pages',
|
|
81
|
+
alias: 'wp',
|
|
82
|
+
getUrl: (accountId, baseUrl) => `${baseUrl}/website/${accountId}/pages/site`,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
function getSiteLinksAsArray(accountId) {
|
|
86
|
+
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)() === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD);
|
|
87
|
+
return Object.values(SITE_LINKS)
|
|
88
|
+
.sort((a, b) => (a.shortcut < b.shortcut ? -1 : 1))
|
|
89
|
+
.map(l => ({ ...l, url: l.getUrl(accountId, baseUrl) }));
|
|
90
|
+
}
|
|
91
|
+
function logSiteLinks(accountId) {
|
|
11
92
|
const linksAsArray = getSiteLinksAsArray(accountId).map(l => [
|
|
12
93
|
`${l.shortcut}${l.alias ? ` [alias: ${l.alias}]` : ''}`,
|
|
13
94
|
'=>',
|
|
14
95
|
l.url,
|
|
15
96
|
]);
|
|
16
|
-
linksAsArray.unshift(getTableHeader(['Shortcut', '', 'Url']));
|
|
17
|
-
logger.log(getTableContents(linksAsArray));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
22
|
-
return {
|
|
23
|
-
APPS_MARKETPLACE: {
|
|
24
|
-
shortcut: 'apps-marketplace',
|
|
25
|
-
alias: 'apm',
|
|
26
|
-
url: `${baseUrl}/ecosystem/${accountId}/marketplace/apps`,
|
|
27
|
-
},
|
|
28
|
-
ASSET_MARKETPLACE: {
|
|
29
|
-
shortcut: 'asset-marketplace',
|
|
30
|
-
alias: 'asm',
|
|
31
|
-
url: `${baseUrl}/ecosystem/${accountId}/marketplace/products`,
|
|
32
|
-
},
|
|
33
|
-
CONTENT_STAGING: {
|
|
34
|
-
shortcut: 'content-staging',
|
|
35
|
-
alias: 'cs',
|
|
36
|
-
url: `${baseUrl}/content/${accountId}/staging`,
|
|
37
|
-
},
|
|
38
|
-
DESIGN_MANAGER: {
|
|
39
|
-
shortcut: 'design-manager',
|
|
40
|
-
alias: 'dm',
|
|
41
|
-
url: `${baseUrl}/design-manager/${accountId}`,
|
|
42
|
-
},
|
|
43
|
-
DOCS: {
|
|
44
|
-
shortcut: 'docs',
|
|
45
|
-
url: 'https://developers.hubspot.com',
|
|
46
|
-
},
|
|
47
|
-
FILE_MANAGER: {
|
|
48
|
-
shortcut: 'file-manager',
|
|
49
|
-
alias: 'fm',
|
|
50
|
-
url: `${baseUrl}/files/${accountId}`,
|
|
51
|
-
},
|
|
52
|
-
FORUMS: {
|
|
53
|
-
shortcut: 'forums',
|
|
54
|
-
url: 'https://community.hubspot.com',
|
|
55
|
-
},
|
|
56
|
-
HUBDB: {
|
|
57
|
-
shortcut: 'hubdb',
|
|
58
|
-
alias: 'hdb',
|
|
59
|
-
url: `${baseUrl}/hubdb/${accountId}`,
|
|
60
|
-
},
|
|
61
|
-
SETTINGS: {
|
|
62
|
-
shortcut: 'settings',
|
|
63
|
-
alias: 's',
|
|
64
|
-
url: `${baseUrl}/settings/${accountId}`,
|
|
65
|
-
},
|
|
66
|
-
SETTINGS_NAVIGATION: {
|
|
67
|
-
shortcut: 'settings/navigation',
|
|
68
|
-
alias: 'sn',
|
|
69
|
-
url: `${baseUrl}/menus/${accountId}/edit/`,
|
|
70
|
-
},
|
|
71
|
-
SETTINGS_WEBSITE: {
|
|
72
|
-
shortcut: 'settings/website',
|
|
73
|
-
alias: 'sw',
|
|
74
|
-
url: `${baseUrl}/settings/${accountId}/website/pages/all-domains/page-templates`,
|
|
75
|
-
},
|
|
76
|
-
SETTINGS_URL_REDIRECTS: {
|
|
77
|
-
shortcut: 'settings/url-redirects',
|
|
78
|
-
alias: 'sur',
|
|
79
|
-
url: `${baseUrl}/domains/${accountId}/url-redirects`,
|
|
80
|
-
},
|
|
81
|
-
PURCHASED_ASSETS: {
|
|
82
|
-
shortcut: 'purchased-assets',
|
|
83
|
-
alias: 'pa',
|
|
84
|
-
url: `${baseUrl}/marketplace/${accountId}/manage-purchases`,
|
|
85
|
-
},
|
|
86
|
-
WEBSITE_PAGES: {
|
|
87
|
-
shortcut: 'website-pages',
|
|
88
|
-
alias: 'wp',
|
|
89
|
-
url: `${baseUrl}/website/${accountId}/pages/site`,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
const openLink = (accountId, shortcut) => {
|
|
94
|
-
const match = Object.values(getSiteLinks(accountId)).find(l => l.shortcut === shortcut || (l.alias && l.alias === shortcut));
|
|
97
|
+
linksAsArray.unshift((0, table_1.getTableHeader)(['Shortcut', '', 'Url']));
|
|
98
|
+
logger_1.logger.log((0, table_1.getTableContents)(linksAsArray));
|
|
99
|
+
}
|
|
100
|
+
function openLink(accountId, shortcut) {
|
|
101
|
+
const match = Object.values(SITE_LINKS).find(l => l.shortcut === shortcut || (l.alias && l.alias === shortcut));
|
|
95
102
|
if (!match) {
|
|
96
|
-
logger.error(`We couldn't find a shortcut matching ${shortcut}. Type 'hs open list' to see a list of available shortcuts`);
|
|
103
|
+
logger_1.logger.error(`We couldn't find a shortcut matching ${shortcut}. Type 'hs open list' to see a list of available shortcuts`);
|
|
97
104
|
return;
|
|
98
105
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
getSiteLinks,
|
|
104
|
-
getSiteLinksAsArray,
|
|
105
|
-
logSiteLinks,
|
|
106
|
-
openLink,
|
|
107
|
-
};
|
|
106
|
+
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)() === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD);
|
|
107
|
+
(0, open_1.default)(match.getUrl(accountId, baseUrl), { url: true });
|
|
108
|
+
logger_1.logger.success(`We opened ${match.getUrl(accountId, baseUrl)} in your browser`);
|
|
109
|
+
}
|
package/lib/projects.d.ts
CHANGED
package/lib/projects.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectConfig = void 0;
|
|
3
4
|
// @ts-nocheck
|
|
4
5
|
const fs = require('fs-extra');
|
|
5
6
|
const path = require('path');
|
|
@@ -69,8 +70,9 @@ const getProjectConfig = async (_dir) => {
|
|
|
69
70
|
logger.error('Could not read from project config');
|
|
70
71
|
}
|
|
71
72
|
};
|
|
73
|
+
exports.getProjectConfig = getProjectConfig;
|
|
72
74
|
const createProjectConfig = async (projectPath, projectName, template, templateSource, githubRef) => {
|
|
73
|
-
const { projectConfig, projectDir } = await getProjectConfig(projectPath);
|
|
75
|
+
const { projectConfig, projectDir } = await (0, exports.getProjectConfig)(projectPath);
|
|
74
76
|
if (projectConfig) {
|
|
75
77
|
logger.warn(projectPath === projectDir
|
|
76
78
|
? 'A project already exists in that location.'
|
|
@@ -616,7 +618,7 @@ const logFeedbackMessage = buildId => {
|
|
|
616
618
|
const createProjectComponent = async (component, name, projectComponentsVersion) => {
|
|
617
619
|
const i18nKey = 'commands.project.subcommands.add';
|
|
618
620
|
const componentName = name;
|
|
619
|
-
const configInfo = await getProjectConfig();
|
|
621
|
+
const configInfo = await (0, exports.getProjectConfig)();
|
|
620
622
|
if (!configInfo.projectDir && !configInfo.projectConfig) {
|
|
621
623
|
logger.error(i18n(`${i18nKey}.error.locationInProject`));
|
|
622
624
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -660,7 +662,7 @@ const getProjectComponentsByVersion = async (projectComponentsVersion) => {
|
|
|
660
662
|
};
|
|
661
663
|
module.exports = {
|
|
662
664
|
writeProjectConfig,
|
|
663
|
-
getProjectConfig,
|
|
665
|
+
getProjectConfig: exports.getProjectConfig,
|
|
664
666
|
getIsInProject,
|
|
665
667
|
pollProjectBuildAndDeploy,
|
|
666
668
|
handleProjectUpload,
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { SpinnerOptions as BaseSpinnerOptions, VALID_STATUSES } from './spinniesUtils';
|
|
2
|
+
interface SpinnerState extends BaseSpinnerOptions {
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
declare class SpinniesManager {
|
|
6
|
+
private options;
|
|
7
|
+
private spinners;
|
|
8
|
+
private isCursorHidden;
|
|
9
|
+
private currentInterval;
|
|
10
|
+
private stream;
|
|
11
|
+
private lineCount;
|
|
12
|
+
private currentFrameIndex;
|
|
13
|
+
private spin;
|
|
14
|
+
constructor();
|
|
15
|
+
init(options?: Partial<SpinnerState>): void;
|
|
16
|
+
private resetState;
|
|
17
|
+
pick(name: string): SpinnerState | undefined;
|
|
18
|
+
add(name: string, options?: Partial<SpinnerState>): SpinnerState & {
|
|
19
|
+
name: string;
|
|
20
|
+
};
|
|
21
|
+
update(name: string, options?: Partial<SpinnerState>): SpinnerState;
|
|
22
|
+
succeed(name: string, options?: Partial<SpinnerState>): SpinnerState;
|
|
23
|
+
fail(name: string, options?: Partial<SpinnerState>): SpinnerState;
|
|
24
|
+
remove(name: string): SpinnerState;
|
|
25
|
+
stopAll(newStatus?: typeof VALID_STATUSES[number]): {
|
|
26
|
+
[key: string]: SpinnerState;
|
|
27
|
+
};
|
|
28
|
+
private hasAnySpinners;
|
|
29
|
+
hasActiveSpinners(): boolean;
|
|
30
|
+
private setSpinnerProperties;
|
|
31
|
+
private updateSpinnerState;
|
|
32
|
+
private loopStream;
|
|
33
|
+
private setStreamOutput;
|
|
34
|
+
private setRawStreamOutput;
|
|
35
|
+
private checkIfActiveSpinners;
|
|
36
|
+
private bindSigint;
|
|
37
|
+
}
|
|
38
|
+
declare const toExport: SpinniesManager;
|
|
39
|
+
export default toExport;
|