@hubspot/cli 7.2.1-experimental.0 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/account/info.d.ts +1 -1
- package/commands/account/info.js +8 -5
- package/commands/auth.d.ts +9 -0
- package/commands/auth.js +89 -83
- package/commands/init.d.ts +11 -0
- package/commands/init.js +114 -100
- package/commands/list.d.ts +9 -0
- package/commands/list.js +63 -57
- package/commands/mv.d.ts +10 -0
- package/commands/mv.js +32 -32
- package/commands/open.d.ts +10 -0
- package/commands/open.js +37 -34
- package/commands/project/create.js +2 -0
- package/commands/project/dev/unifiedFlow.js +1 -1
- package/commands/remove.d.ts +9 -0
- package/commands/remove.js +25 -23
- package/lang/en.lyaml +15 -10
- package/lib/LocalDevManager.js +1 -1
- package/lib/LocalDevManagerV2.js +1 -1
- package/lib/commonOpts.d.ts +1 -0
- package/lib/commonOpts.js +30 -0
- package/lib/localDev.d.ts +1 -1
- package/lib/localDev.js +2 -2
- package/lib/prompts/accountNamePrompt.d.ts +2 -3
- package/lib/prompts/createProjectPrompt.js +14 -12
- package/lib/prompts/personalAccessKeyPrompt.d.ts +4 -4
- package/lib/ui/index.d.ts +2 -2
- package/lib/ui/index.js +8 -8
- package/lib/ui/supportHyperlinks.js +2 -2
- package/lib/ui/supportsColor.js +2 -2
- package/lib/usageTracking.d.ts +1 -1
- package/lib/yargsUtils.d.ts +9 -0
- package/lib/yargsUtils.js +40 -0
- package/package.json +3 -3
- package/lib/hasFlag.d.ts +0 -1
- package/lib/hasFlag.js +0 -15
package/lib/localDev.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export declare function createSandboxForLocalDev(accountId: number, accountConfi
|
|
|
14
14
|
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
15
15
|
export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
|
|
16
16
|
export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig, targetAccountId: number, shouldCreateWithoutConfirmation: boolean, hasPublicApps: boolean): Promise<Project>;
|
|
17
|
-
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>;
|
|
18
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,12 +1,11 @@
|
|
|
1
1
|
import { PromptConfig } from '../../types/Prompts';
|
|
2
2
|
import { AccountType } from '@hubspot/local-dev-lib/types/Accounts';
|
|
3
|
-
type AccountNamePromptResponse = {
|
|
3
|
+
export type AccountNamePromptResponse = {
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function getCliAccountNamePromptConfig(defaultName?: string): PromptConfig<AccountNamePromptResponse>;
|
|
7
|
-
export declare function cliAccountNamePrompt(defaultName
|
|
7
|
+
export declare function cliAccountNamePrompt(defaultName?: string): Promise<AccountNamePromptResponse>;
|
|
8
8
|
export declare function hubspotAccountNamePrompt({ accountType, currentPortalCount, }: {
|
|
9
9
|
accountType: AccountType;
|
|
10
10
|
currentPortalCount?: number;
|
|
11
11
|
}): Promise<AccountNamePromptResponse>;
|
|
12
|
-
export {};
|
|
@@ -9,7 +9,20 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
10
|
const promptUtils_1 = require("./promptUtils");
|
|
11
11
|
const lang_1 = require("../lang");
|
|
12
|
+
const constants_1 = require("../constants");
|
|
12
13
|
const i18nKey = 'lib.prompts.createProjectPrompt';
|
|
14
|
+
function validateProjectDirectory(input) {
|
|
15
|
+
if (!input) {
|
|
16
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.destRequired`);
|
|
17
|
+
}
|
|
18
|
+
if (fs_1.default.existsSync(path_1.default.resolve((0, path_2.getCwd)(), path_1.default.join(input, constants_1.PROJECT_CONFIG_FILE)))) {
|
|
19
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidDest`);
|
|
20
|
+
}
|
|
21
|
+
if (!(0, path_2.isValidPath)(input)) {
|
|
22
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidCharacters`);
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
13
26
|
function findTemplateByNameOrLabel(projectTemplates, templateNameOrLabel) {
|
|
14
27
|
return projectTemplates.find(t => t.name === templateNameOrLabel || t.label === templateNameOrLabel);
|
|
15
28
|
}
|
|
@@ -38,18 +51,7 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
|
|
|
38
51
|
const projectName = (0, path_2.sanitizeFileName)(promptOptions.name || answers.name);
|
|
39
52
|
return path_1.default.resolve((0, path_2.getCwd)(), projectName);
|
|
40
53
|
},
|
|
41
|
-
validate:
|
|
42
|
-
if (!input) {
|
|
43
|
-
return (0, lang_1.i18n)(`${i18nKey}.errors.destRequired`);
|
|
44
|
-
}
|
|
45
|
-
if (fs_1.default.existsSync(input)) {
|
|
46
|
-
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidDest`);
|
|
47
|
-
}
|
|
48
|
-
if (!(0, path_2.isValidPath)(input)) {
|
|
49
|
-
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidCharacters`);
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
},
|
|
54
|
+
validate: validateProjectDirectory,
|
|
53
55
|
filter: input => {
|
|
54
56
|
return (0, path_2.untildify)(input);
|
|
55
57
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AccountNamePromptResponse } from './accountNamePrompt';
|
|
1
2
|
import { PromptConfig } from '../../types/Prompts';
|
|
2
|
-
type PersonalAccessKeyPromptResponse = {
|
|
3
|
+
export type PersonalAccessKeyPromptResponse = {
|
|
3
4
|
personalAccessKey: string;
|
|
4
5
|
env: string;
|
|
5
6
|
};
|
|
@@ -15,6 +16,7 @@ type ClientSecretPromptResponse = {
|
|
|
15
16
|
type ScopesPromptResponse = {
|
|
16
17
|
scopes: string[];
|
|
17
18
|
};
|
|
19
|
+
export type OauthPromptResponse = AccountNamePromptResponse & AccountIdPromptResponse & ClientIdPromptResponse & ClientSecretPromptResponse & ScopesPromptResponse;
|
|
18
20
|
/**
|
|
19
21
|
* Displays notification to user that we are about to open the browser,
|
|
20
22
|
* then opens their browser to the personal-access-key shortlink
|
|
@@ -23,7 +25,5 @@ export declare function personalAccessKeyPrompt({ env, account, }: {
|
|
|
23
25
|
env: string;
|
|
24
26
|
account?: number;
|
|
25
27
|
}): Promise<PersonalAccessKeyPromptResponse>;
|
|
26
|
-
export declare const OAUTH_FLOW: (PromptConfig<
|
|
27
|
-
name: string;
|
|
28
|
-
}> | PromptConfig<AccountIdPromptResponse> | PromptConfig<ClientIdPromptResponse> | PromptConfig<ClientSecretPromptResponse> | PromptConfig<ScopesPromptResponse>)[];
|
|
28
|
+
export declare const OAUTH_FLOW: (PromptConfig<AccountNamePromptResponse> | PromptConfig<AccountIdPromptResponse> | PromptConfig<ClientIdPromptResponse> | PromptConfig<ClientSecretPromptResponse> | PromptConfig<ScopesPromptResponse>)[];
|
|
29
29
|
export {};
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare function uiLine(): void;
|
|
|
7
7
|
export declare function uiLink(linkText: string, url: string): string;
|
|
8
8
|
export declare function uiAccountDescription(accountId?: number | null, bold?: boolean): string;
|
|
9
9
|
export declare function uiInfoSection(title: string, logContent: () => void): void;
|
|
10
|
-
export declare function uiCommandReference(command: string): string;
|
|
11
|
-
export declare function uiFeatureHighlight(
|
|
10
|
+
export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
|
|
11
|
+
export declare function uiFeatureHighlight(features: string[], title?: string): void;
|
|
12
12
|
export declare function uiBetaTag(message: string, log?: boolean): string | undefined;
|
|
13
13
|
export declare function uiDeprecatedTag(message: string): void;
|
|
14
14
|
export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
|
package/lib/ui/index.js
CHANGED
|
@@ -70,21 +70,21 @@ function uiInfoSection(title, logContent) {
|
|
|
70
70
|
logger_1.logger.log('');
|
|
71
71
|
uiLine();
|
|
72
72
|
}
|
|
73
|
-
function uiCommandReference(command) {
|
|
73
|
+
function uiCommandReference(command, withQuotes = true) {
|
|
74
74
|
const terminalUISupport = getTerminalUISupport();
|
|
75
|
-
const commandReference = `\`${command}
|
|
75
|
+
const commandReference = withQuotes ? `\`${command}\`` : command;
|
|
76
76
|
return chalk_1.default.bold(terminalUISupport.color
|
|
77
77
|
? chalk_1.default.hex(exports.UI_COLORS.MARIGOLD_DARK)(commandReference)
|
|
78
78
|
: commandReference);
|
|
79
79
|
}
|
|
80
|
-
function uiFeatureHighlight(
|
|
80
|
+
function uiFeatureHighlight(features, title) {
|
|
81
81
|
const i18nKey = 'lib.ui.featureHighlight';
|
|
82
82
|
uiInfoSection(title ? title : (0, lang_1.i18n)(`${i18nKey}.defaultTitle`), () => {
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
const message = (0, lang_1.i18n)(`${
|
|
86
|
-
command: uiCommandReference((0, lang_1.i18n)(`${
|
|
87
|
-
link: uiLink((0, lang_1.i18n)(`${
|
|
83
|
+
features.forEach((c, i) => {
|
|
84
|
+
const featureKey = `${i18nKey}.featureKeys.${c}`;
|
|
85
|
+
const message = (0, lang_1.i18n)(`${featureKey}.message`, {
|
|
86
|
+
command: uiCommandReference((0, lang_1.i18n)(`${featureKey}.command`)),
|
|
87
|
+
link: uiLink((0, lang_1.i18n)(`${featureKey}.linkText`), (0, lang_1.i18n)(`${featureKey}.url`)),
|
|
88
88
|
});
|
|
89
89
|
if (i !== 0) {
|
|
90
90
|
logger_1.logger.log('');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.supportsHyperlinkModule = void 0;
|
|
4
|
-
const
|
|
4
|
+
const yargsUtils_1 = require("../yargsUtils");
|
|
5
5
|
//See https://github.com/jamestalmage/supports-hyperlinks (License: https://github.com/jamestalmage/supports-hyperlinks/blob/master/license)
|
|
6
6
|
function parseVersion(versionString) {
|
|
7
7
|
if (/^\d{3,4}$/.test(versionString)) {
|
|
@@ -22,7 +22,7 @@ function parseVersion(versionString) {
|
|
|
22
22
|
}
|
|
23
23
|
function supportsHyperlink(stream) {
|
|
24
24
|
const { env } = process;
|
|
25
|
-
if ((0,
|
|
25
|
+
if ((0, yargsUtils_1.hasFlag)('noHyperlinks')) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
if (stream && !stream.isTTY) {
|
package/lib/ui/supportsColor.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.supportsColor = void 0;
|
|
|
7
7
|
const process_1 = __importDefault(require("process"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const tty_1 = __importDefault(require("tty"));
|
|
10
|
-
const
|
|
10
|
+
const yargsUtils_1 = require("../yargsUtils");
|
|
11
11
|
const { env } = process_1.default;
|
|
12
12
|
function translateLevel(level) {
|
|
13
13
|
if (level === 0) {
|
|
@@ -33,7 +33,7 @@ function _supportsColor(haveStream, { streamIsTTY } = {}) {
|
|
|
33
33
|
if (env.TERM === 'dumb') {
|
|
34
34
|
return min;
|
|
35
35
|
}
|
|
36
|
-
if ((0,
|
|
36
|
+
if ((0, yargsUtils_1.hasFlag)('noColor')) {
|
|
37
37
|
return 0;
|
|
38
38
|
}
|
|
39
39
|
if (process_1.default.platform === 'win32') {
|
package/lib/usageTracking.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ type Meta = {
|
|
|
16
16
|
export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
|
|
17
17
|
export declare function trackHelpUsage(command: string): Promise<void>;
|
|
18
18
|
export declare function trackConvertFieldsUsage(command: string): Promise<void>;
|
|
19
|
-
export declare function trackAuthAction(command: string, authType: string, step: string, accountId
|
|
19
|
+
export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): Promise<void>;
|
|
20
20
|
export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
|
|
21
21
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Argv } from 'yargs';
|
|
2
|
+
export declare function hasFlag(flag: string, argv?: string[]): boolean;
|
|
3
|
+
export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>, command: string, describe: string, options: {
|
|
4
|
+
useGlobalOptions?: boolean;
|
|
5
|
+
useAccountOptions?: boolean;
|
|
6
|
+
useConfigOptions?: boolean;
|
|
7
|
+
useUseEnvironmentOptions?: boolean;
|
|
8
|
+
useTestingOptions?: boolean;
|
|
9
|
+
}): (yargs: Argv) => Promise<Argv<T>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
exports.hasFlag = hasFlag;
|
|
7
|
+
exports.makeYargsBuilder = makeYargsBuilder;
|
|
8
|
+
const process_1 = __importDefault(require("process"));
|
|
9
|
+
const commonOpts_1 = require("./commonOpts");
|
|
10
|
+
// See https://github.com/sindresorhus/has-flag/blob/main/index.js (License: https://github.com/sindresorhus/has-flag/blob/main/license)
|
|
11
|
+
function hasFlag(flag, argv = process_1.default.argv) {
|
|
12
|
+
const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
|
|
13
|
+
const position = argv.indexOf(prefix + flag);
|
|
14
|
+
const terminatorPosition = argv.indexOf('--');
|
|
15
|
+
return (position !== -1 &&
|
|
16
|
+
(terminatorPosition === -1 || position < terminatorPosition));
|
|
17
|
+
}
|
|
18
|
+
function makeYargsBuilder(callback, command, describe, options) {
|
|
19
|
+
return async function (yargs) {
|
|
20
|
+
if (options.useGlobalOptions) {
|
|
21
|
+
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
22
|
+
}
|
|
23
|
+
if (options.useAccountOptions) {
|
|
24
|
+
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
25
|
+
}
|
|
26
|
+
if (options.useConfigOptions) {
|
|
27
|
+
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
28
|
+
}
|
|
29
|
+
if (options.useUseEnvironmentOptions) {
|
|
30
|
+
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
31
|
+
}
|
|
32
|
+
if (options.useTestingOptions) {
|
|
33
|
+
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
34
|
+
}
|
|
35
|
+
const result = callback(yargs);
|
|
36
|
+
// Must go last to pick up available options
|
|
37
|
+
await (0, commonOpts_1.addCustomHelpOutput)(result, command, describe);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.2.1
|
|
3
|
+
"version": "7.2.1",
|
|
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",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@hubspot/local-dev-lib": "3.3.2",
|
|
9
|
-
"@hubspot/project-parsing-lib": "0.1.
|
|
9
|
+
"@hubspot/project-parsing-lib": "0.1.1",
|
|
10
10
|
"@hubspot/serverless-dev-runtime": "7.0.2",
|
|
11
11
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|
|
12
|
-
"@hubspot/ui-extensions-dev-server": "0.8.
|
|
12
|
+
"@hubspot/ui-extensions-dev-server": "0.8.50",
|
|
13
13
|
"archiver": "7.0.1",
|
|
14
14
|
"chalk": "4.1.2",
|
|
15
15
|
"chokidar": "3.6.0",
|
package/lib/hasFlag.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function hasFlag(flag: string, argv?: string[]): boolean;
|
package/lib/hasFlag.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
exports.hasFlag = hasFlag;
|
|
7
|
-
const process_1 = __importDefault(require("process"));
|
|
8
|
-
// See https://github.com/sindresorhus/has-flag/blob/main/index.js (License: https://github.com/sindresorhus/has-flag/blob/main/license)
|
|
9
|
-
function hasFlag(flag, argv = process_1.default.argv) {
|
|
10
|
-
const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
|
|
11
|
-
const position = argv.indexOf(prefix + flag);
|
|
12
|
-
const terminatorPosition = argv.indexOf('--');
|
|
13
|
-
return (position !== -1 &&
|
|
14
|
-
(terminatorPosition === -1 || position < terminatorPosition));
|
|
15
|
-
}
|