@hubspot/cli 7.1.1 → 7.2.0-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.
- 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.d.ts +7 -0
- package/commands/project/dev.js +96 -75
- 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 +35 -16
- package/lib/LocalDevManager.d.ts +2 -2
- package/lib/buildAccount.d.ts +2 -3
- package/lib/constants.d.ts +0 -3
- package/lib/constants.js +1 -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 +2 -1
- 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/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 +5 -4
- 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 +14 -0
- package/commands/secret/listSecrets.d.ts +0 -1
- package/commands/secret/listSecrets.js +0 -39
package/lib/projects/upload.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ type ProjectUploadResult<T> = {
|
|
|
5
5
|
result?: T;
|
|
6
6
|
uploadError?: unknown;
|
|
7
7
|
};
|
|
8
|
-
export declare function handleProjectUpload<T>(accountId: number, projectConfig: ProjectConfig, projectDir: string, callbackFunc: ProjectUploadCallbackFunction<T>, uploadMessage: string, sendIR?: boolean): Promise<ProjectUploadResult<T>>;
|
|
8
|
+
export declare function handleProjectUpload<T>(accountId: number, projectConfig: ProjectConfig, projectDir: string, callbackFunc: ProjectUploadCallbackFunction<T>, uploadMessage: string, sendIR?: boolean, skipValidation?: boolean): Promise<ProjectUploadResult<T>>;
|
|
9
9
|
export {};
|
package/lib/projects/upload.js
CHANGED
|
@@ -58,7 +58,7 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
|
|
|
58
58
|
}
|
|
59
59
|
return { buildId, error };
|
|
60
60
|
}
|
|
61
|
-
async function handleProjectUpload(accountId, projectConfig, projectDir, callbackFunc, uploadMessage, sendIR = false) {
|
|
61
|
+
async function handleProjectUpload(accountId, projectConfig, projectDir, callbackFunc, uploadMessage, sendIR = false, skipValidation = false) {
|
|
62
62
|
const srcDir = path_1.default.resolve(projectDir, projectConfig.srcDir);
|
|
63
63
|
const filenames = fs_extra_1.default.readdirSync(srcDir);
|
|
64
64
|
if (!filenames || filenames.length === 0) {
|
|
@@ -84,7 +84,7 @@ async function handleProjectUpload(accountId, projectConfig, projectDir, callbac
|
|
|
84
84
|
projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
|
|
85
85
|
platformVersion: projectConfig.platformVersion,
|
|
86
86
|
accountId,
|
|
87
|
-
});
|
|
87
|
+
}, { skipValidation });
|
|
88
88
|
logger_1.logger.debug(node_util_1.default.inspect(intermediateRepresentation, false, null, true));
|
|
89
89
|
}
|
|
90
90
|
catch (e) {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
|
|
2
1
|
import { ProjectTemplate } from '../../types/Projects';
|
|
3
2
|
type CreateProjectPromptResponse = {
|
|
4
3
|
name: string;
|
|
5
4
|
dest: string;
|
|
6
|
-
|
|
5
|
+
projectTemplate?: ProjectTemplate;
|
|
7
6
|
};
|
|
8
|
-
export declare function createProjectPrompt(
|
|
9
|
-
name
|
|
10
|
-
dest
|
|
11
|
-
template
|
|
12
|
-
|
|
13
|
-
}, skipTemplatePrompt?: boolean): Promise<CreateProjectPromptResponse>;
|
|
7
|
+
export declare function createProjectPrompt(promptOptions: {
|
|
8
|
+
name?: string;
|
|
9
|
+
dest?: string;
|
|
10
|
+
template?: string;
|
|
11
|
+
}, projectTemplates?: ProjectTemplate[]): Promise<CreateProjectPromptResponse>;
|
|
14
12
|
export {};
|
|
@@ -7,52 +7,17 @@ exports.createProjectPrompt = createProjectPrompt;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
|
-
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
11
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
12
|
-
const constants_1 = require("../constants");
|
|
13
10
|
const promptUtils_1 = require("./promptUtils");
|
|
14
11
|
const lang_1 = require("../lang");
|
|
15
|
-
const exitCodes_1 = require("../enums/exitCodes");
|
|
16
12
|
const i18nKey = 'lib.prompts.createProjectPrompt';
|
|
17
|
-
|
|
18
|
-
function hasAllProperties(projectList) {
|
|
19
|
-
return projectList.every(config => PROJECT_TEMPLATE_PROPERTIES.every(p => Object.prototype.hasOwnProperty.call(config, p)));
|
|
20
|
-
}
|
|
21
|
-
async function createTemplateOptions(templateSource, githubRef) {
|
|
22
|
-
const hasCustomTemplateSource = Boolean(templateSource);
|
|
23
|
-
const branch = hasCustomTemplateSource
|
|
24
|
-
? constants_1.DEFAULT_PROJECT_TEMPLATE_BRANCH
|
|
25
|
-
: githubRef;
|
|
26
|
-
let config;
|
|
27
|
-
try {
|
|
28
|
-
config = await (0, github_1.fetchFileFromRepository)(templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'config.json', branch);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.missingConfigFileTemplateSource`));
|
|
32
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
33
|
-
}
|
|
34
|
-
if (!config || !config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]) {
|
|
35
|
-
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.noProjectsInConfig`));
|
|
36
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
37
|
-
}
|
|
38
|
-
if (!hasAllProperties(config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS])) {
|
|
39
|
-
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.missingPropertiesInConfig`));
|
|
40
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
41
|
-
}
|
|
42
|
-
return config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS];
|
|
43
|
-
}
|
|
44
|
-
function findTemplate(projectTemplates, templateNameOrLabel) {
|
|
13
|
+
function findTemplateByNameOrLabel(projectTemplates, templateNameOrLabel) {
|
|
45
14
|
return projectTemplates.find(t => t.name === templateNameOrLabel || t.label === templateNameOrLabel);
|
|
46
15
|
}
|
|
47
|
-
async function createProjectPrompt(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
projectTemplates
|
|
52
|
-
selectedTemplate =
|
|
53
|
-
promptOptions.template &&
|
|
54
|
-
findTemplate(projectTemplates, promptOptions.template);
|
|
55
|
-
}
|
|
16
|
+
async function createProjectPrompt(promptOptions, projectTemplates) {
|
|
17
|
+
const createProjectFromTemplate = !!projectTemplates && projectTemplates.length > 0;
|
|
18
|
+
const providedTemplateIsValid = createProjectFromTemplate &&
|
|
19
|
+
!!promptOptions.template &&
|
|
20
|
+
!!findTemplateByNameOrLabel(projectTemplates, promptOptions.template);
|
|
56
21
|
const result = await (0, promptUtils_1.promptUser)([
|
|
57
22
|
{
|
|
58
23
|
name: 'name',
|
|
@@ -70,7 +35,7 @@ async function createProjectPrompt(githubRef, promptOptions, skipTemplatePrompt
|
|
|
70
35
|
message: (0, lang_1.i18n)(`${i18nKey}.enterDest`),
|
|
71
36
|
when: !promptOptions.dest,
|
|
72
37
|
default: answers => {
|
|
73
|
-
const projectName = (0, path_2.sanitizeFileName)(
|
|
38
|
+
const projectName = (0, path_2.sanitizeFileName)(promptOptions.name || answers.name);
|
|
74
39
|
return path_1.default.resolve((0, path_2.getCwd)(), projectName);
|
|
75
40
|
},
|
|
76
41
|
validate: (input) => {
|
|
@@ -90,27 +55,34 @@ async function createProjectPrompt(githubRef, promptOptions, skipTemplatePrompt
|
|
|
90
55
|
},
|
|
91
56
|
},
|
|
92
57
|
{
|
|
93
|
-
name: '
|
|
58
|
+
name: 'projectTemplate',
|
|
94
59
|
message: () => {
|
|
95
|
-
return promptOptions.template &&
|
|
96
|
-
!findTemplate(projectTemplates, promptOptions.template)
|
|
60
|
+
return promptOptions.template && !providedTemplateIsValid
|
|
97
61
|
? (0, lang_1.i18n)(`${i18nKey}.errors.invalidTemplate`, {
|
|
98
62
|
template: promptOptions.template,
|
|
99
63
|
})
|
|
100
64
|
: (0, lang_1.i18n)(`${i18nKey}.selectTemplate`);
|
|
101
65
|
},
|
|
102
|
-
when:
|
|
66
|
+
when: createProjectFromTemplate && !providedTemplateIsValid,
|
|
103
67
|
type: 'list',
|
|
104
|
-
choices:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
68
|
+
choices: createProjectFromTemplate
|
|
69
|
+
? projectTemplates.map(template => {
|
|
70
|
+
return {
|
|
71
|
+
name: template.label,
|
|
72
|
+
value: template,
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
: undefined,
|
|
110
76
|
},
|
|
111
77
|
]);
|
|
112
|
-
if (
|
|
113
|
-
result.
|
|
78
|
+
if (!result.name) {
|
|
79
|
+
result.name = promptOptions.name;
|
|
80
|
+
}
|
|
81
|
+
if (!result.dest) {
|
|
82
|
+
result.dest = promptOptions.dest;
|
|
83
|
+
}
|
|
84
|
+
if (providedTemplateIsValid) {
|
|
85
|
+
result.projectTemplate = findTemplateByNameOrLabel(projectTemplates, promptOptions.template);
|
|
114
86
|
}
|
|
115
87
|
return result;
|
|
116
88
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentTemplate } from '../../types/Projects';
|
|
2
2
|
type ProjectAddPromptResponse = {
|
|
3
|
-
|
|
3
|
+
componentTemplate: ComponentTemplate;
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
6
|
-
export declare function projectAddPrompt(components:
|
|
6
|
+
export declare function projectAddPrompt(components: ComponentTemplate[], promptOptions?: {
|
|
7
7
|
name?: string;
|
|
8
8
|
type?: string;
|
|
9
9
|
}): Promise<ProjectAddPromptResponse>;
|
|
@@ -4,20 +4,23 @@ exports.projectAddPrompt = projectAddPrompt;
|
|
|
4
4
|
const promptUtils_1 = require("./promptUtils");
|
|
5
5
|
const lang_1 = require("../lang");
|
|
6
6
|
const i18nKey = 'lib.prompts.projectAddPrompt';
|
|
7
|
+
function findComponentByPathOrLabel(components, componentPathOrLabel) {
|
|
8
|
+
return components.find(c => c.path === componentPathOrLabel || c.label === componentPathOrLabel);
|
|
9
|
+
}
|
|
7
10
|
async function projectAddPrompt(components, promptOptions = {}) {
|
|
8
|
-
|
|
11
|
+
const providedTypeIsValid = !!promptOptions.type &&
|
|
12
|
+
!!findComponentByPathOrLabel(components, promptOptions.type);
|
|
13
|
+
const result = await (0, promptUtils_1.promptUser)([
|
|
9
14
|
{
|
|
10
|
-
name: '
|
|
15
|
+
name: 'componentTemplate',
|
|
11
16
|
message: () => {
|
|
12
|
-
return promptOptions.type &&
|
|
13
|
-
!components.find(t => t.path === promptOptions.type)
|
|
17
|
+
return promptOptions.type && !providedTypeIsValid
|
|
14
18
|
? (0, lang_1.i18n)(`${i18nKey}.errors.invalidType`, {
|
|
15
19
|
type: promptOptions.type,
|
|
16
20
|
})
|
|
17
21
|
: (0, lang_1.i18n)(`${i18nKey}.selectType`);
|
|
18
22
|
},
|
|
19
|
-
when: !
|
|
20
|
-
!components.find(t => t.path === promptOptions.type),
|
|
23
|
+
when: !providedTypeIsValid,
|
|
21
24
|
type: 'list',
|
|
22
25
|
choices: components.map(type => {
|
|
23
26
|
return {
|
|
@@ -38,4 +41,11 @@ async function projectAddPrompt(components, promptOptions = {}) {
|
|
|
38
41
|
},
|
|
39
42
|
},
|
|
40
43
|
]);
|
|
44
|
+
if (!result.name) {
|
|
45
|
+
result.name = promptOptions.name;
|
|
46
|
+
}
|
|
47
|
+
if (providedTypeIsValid) {
|
|
48
|
+
result.componentTemplate = findComponentByPathOrLabel(components, promptOptions.type);
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
41
51
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
2
|
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
3
|
+
import { ProjectDevTargetAccountPromptResponse } from '../../types/Prompts';
|
|
4
|
+
export declare function selectSandboxTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
5
|
+
export declare function selectDeveloperTestTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
5
6
|
export declare function confirmDefaultAccountPrompt(accountName: string, accountType: string): Promise<boolean>;
|
|
6
7
|
export declare function confirmUseExistingDeveloperTestAccountPrompt(account: DeveloperTestAccount): Promise<boolean>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { SandboxAccountType } from '../../types/Sandboxes';
|
|
1
2
|
type SandboxTypePromptResponse = {
|
|
2
|
-
type:
|
|
3
|
+
type: SandboxAccountType;
|
|
3
4
|
};
|
|
4
5
|
type DeleteSandboxPromptResponse = {
|
|
5
6
|
account: string;
|
|
6
7
|
};
|
|
7
8
|
export declare function sandboxTypePrompt(): Promise<SandboxTypePromptResponse>;
|
|
8
|
-
export declare function deleteSandboxPrompt(promptParentAccount?: boolean): Promise<DeleteSandboxPromptResponse
|
|
9
|
+
export declare function deleteSandboxPrompt(promptParentAccount?: boolean): Promise<DeleteSandboxPromptResponse | undefined>;
|
|
9
10
|
export {};
|
|
@@ -52,7 +52,7 @@ function deleteSandboxPrompt(promptParentAccount = false) {
|
|
|
52
52
|
? mapNonSandboxAccountChoices(accountsList)
|
|
53
53
|
: mapSandboxAccountChoices(accountsList);
|
|
54
54
|
if (!choices.length) {
|
|
55
|
-
return;
|
|
55
|
+
return Promise.resolve(undefined);
|
|
56
56
|
}
|
|
57
57
|
return (0, promptUtils_1.promptUser)([
|
|
58
58
|
{
|
package/lib/sandboxSync.js
CHANGED
|
@@ -26,8 +26,12 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
26
26
|
const isDevSandbox = (0, accountTypes_1.isDevelopmentSandbox)(accountConfig);
|
|
27
27
|
if (!accountId || !parentAccountId) {
|
|
28
28
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.failure.invalidUser`, {
|
|
29
|
-
accountName:
|
|
30
|
-
|
|
29
|
+
accountName: accountId
|
|
30
|
+
? (0, ui_1.uiAccountDescription)(accountId)
|
|
31
|
+
: id.toString(),
|
|
32
|
+
parentAccountName: parentAccountId
|
|
33
|
+
? (0, ui_1.uiAccountDescription)(parentAccountId)
|
|
34
|
+
: parentId.toString(),
|
|
31
35
|
}));
|
|
32
36
|
}
|
|
33
37
|
SpinniesManager_1.default.init({
|
package/lib/sandboxes.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { AccountType, CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
2
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
3
|
-
import { SandboxSyncTask } from '../types/Sandboxes';
|
|
3
|
+
import { SandboxSyncTask, SandboxAccountType } from '../types/Sandboxes';
|
|
4
4
|
export declare const SYNC_TYPES: {
|
|
5
5
|
readonly OBJECT_RECORDS: "object-records";
|
|
6
6
|
};
|
|
7
7
|
export declare const SANDBOX_TYPE_MAP: {
|
|
8
|
-
|
|
9
|
-
readonly developer: "DEVELOPMENT_SANDBOX";
|
|
10
|
-
readonly development: "DEVELOPMENT_SANDBOX";
|
|
11
|
-
readonly standard: "STANDARD_SANDBOX";
|
|
8
|
+
[key: string]: SandboxAccountType;
|
|
12
9
|
};
|
|
13
10
|
export declare const SANDBOX_API_TYPE_MAP: {
|
|
14
11
|
readonly STANDARD_SANDBOX: 1;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
|
|
2
|
+
type MockResponse = {
|
|
3
|
+
status: number;
|
|
4
|
+
data: {
|
|
5
|
+
message?: string;
|
|
6
|
+
errorType?: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
subCategory?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const makeHubSpotHttpError: (message: string, response: MockResponse) => HubSpotHttpError;
|
|
12
|
+
export {};
|
package/lib/testUtils.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeHubSpotHttpError = void 0;
|
|
4
|
+
const HubSpotHttpError_1 = require("@hubspot/local-dev-lib/models/HubSpotHttpError");
|
|
5
|
+
const makeHubSpotHttpError = (message, response) => {
|
|
6
|
+
return new HubSpotHttpError_1.HubSpotHttpError(message, {
|
|
7
|
+
cause: { isAxiosError: true, response },
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
exports.makeHubSpotHttpError = makeHubSpotHttpError;
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ 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
10
|
export declare function uiCommandReference(command: string): string;
|
|
11
|
-
export declare function uiFeatureHighlight(commands: string[], title
|
|
12
|
-
export declare function uiBetaTag(message: string, log?: boolean):
|
|
11
|
+
export declare function uiFeatureHighlight(commands: string[], title?: string): void;
|
|
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;
|
|
15
15
|
export declare function uiDeprecatedDescription(message: string, command: string, url?: string): void;
|
package/lib/ui/index.js
CHANGED
|
@@ -100,6 +100,7 @@ function uiBetaTag(message, log = true) {
|
|
|
100
100
|
const result = `${terminalUISupport.color ? chalk_1.default.hex(exports.UI_COLORS.SORBET)(tag) : tag} ${message}`;
|
|
101
101
|
if (log) {
|
|
102
102
|
logger_1.logger.log(result);
|
|
103
|
+
return;
|
|
103
104
|
}
|
|
104
105
|
else {
|
|
105
106
|
return result;
|
package/lib/upload.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function getUploadableFileList(src: string, convertFields: boolean): Promise<string[]>;
|
package/lib/upload.js
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
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
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
6
|
+
exports.getUploadableFileList = getUploadableFileList;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = require("@hubspot/local-dev-lib/fs");
|
|
9
|
+
const ignoreRules_1 = require("@hubspot/local-dev-lib/ignoreRules");
|
|
10
|
+
const handleFieldsJS_1 = require("@hubspot/local-dev-lib/cms/handleFieldsJS");
|
|
11
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
12
|
+
const cmsFieldPrompt_1 = require("./prompts/cmsFieldPrompt");
|
|
13
|
+
const index_1 = require("./errorHandlers/index");
|
|
11
14
|
/*
|
|
12
15
|
* Walks the src folder for files, filters them based on ignore filter.
|
|
13
16
|
* If convertFields is true then will check for any JS fields conflicts (i.e., JS fields file and fields.json file) and prompt to resolve
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
async function getUploadableFileList(src, convertFields) {
|
|
16
19
|
let filePaths = [];
|
|
17
20
|
try {
|
|
18
|
-
filePaths = await walk(src);
|
|
21
|
+
filePaths = await (0, fs_1.walk)(src);
|
|
19
22
|
}
|
|
20
23
|
catch (e) {
|
|
21
|
-
logError(e);
|
|
24
|
+
(0, index_1.logError)(e);
|
|
22
25
|
}
|
|
23
26
|
const allowedFiles = filePaths
|
|
24
27
|
.filter(file => {
|
|
25
|
-
if (!isAllowedExtension(file)) {
|
|
28
|
+
if (!(0, path_2.isAllowedExtension)(file)) {
|
|
26
29
|
return false;
|
|
27
30
|
}
|
|
28
31
|
return true;
|
|
29
32
|
})
|
|
30
|
-
.filter(createIgnoreFilter());
|
|
33
|
+
.filter((0, ignoreRules_1.createIgnoreFilter)(false));
|
|
31
34
|
if (!convertFields) {
|
|
32
35
|
return allowedFiles;
|
|
33
36
|
}
|
|
34
37
|
const uploadableFiles = [];
|
|
35
38
|
let skipFiles = [];
|
|
36
39
|
for (const filePath of allowedFiles) {
|
|
37
|
-
const fileName =
|
|
40
|
+
const fileName = path_1.default.basename(filePath);
|
|
38
41
|
if (skipFiles.includes(filePath))
|
|
39
42
|
continue;
|
|
40
|
-
const isConvertable = isConvertableFieldJs(src, filePath, convertFields);
|
|
43
|
+
const isConvertable = (0, handleFieldsJS_1.isConvertableFieldJs)(src, filePath, convertFields);
|
|
41
44
|
if (isConvertable || fileName == 'fields.json') {
|
|
42
45
|
// This prompt checks if there are multiple field files in the folder and gets user to choose.
|
|
43
|
-
const [choice, updatedSkipFiles] = await fieldsJsPrompt(filePath, src, skipFiles);
|
|
46
|
+
const [choice, updatedSkipFiles] = await (0, cmsFieldPrompt_1.fieldsJsPrompt)(filePath, src, skipFiles);
|
|
44
47
|
skipFiles = updatedSkipFiles;
|
|
45
48
|
// If they chose something other than the current file, move on.
|
|
46
49
|
if (choice !== filePath)
|
|
@@ -49,7 +52,4 @@ const getUploadableFileList = async (src, convertFields) => {
|
|
|
49
52
|
uploadableFiles.push(filePath);
|
|
50
53
|
}
|
|
51
54
|
return uploadableFiles;
|
|
52
|
-
}
|
|
53
|
-
module.exports = {
|
|
54
|
-
getUploadableFileList,
|
|
55
|
-
};
|
|
55
|
+
}
|
package/lib/validation.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare function validateCmsPublishMode(options: Arguments<{
|
|
|
10
10
|
cmsPublishMode?: CmsPublishMode;
|
|
11
11
|
}>): boolean;
|
|
12
12
|
export declare function fileExists(_path: string): boolean;
|
|
13
|
-
export declare function checkAndConvertToJson(_path: string):
|
|
13
|
+
export declare function checkAndConvertToJson(_path: string): unknown | null;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-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",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@hubspot/local-dev-lib": "3.3.
|
|
9
|
-
"@hubspot/project-parsing-lib": "0.0.
|
|
8
|
+
"@hubspot/local-dev-lib": "3.3.2",
|
|
9
|
+
"@hubspot/project-parsing-lib": "0.0.12-experimental.0",
|
|
10
10
|
"@hubspot/serverless-dev-runtime": "7.0.2",
|
|
11
11
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|
|
12
12
|
"@hubspot/ui-extensions-dev-server": "0.8.42",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/archiver": "^6.0.3",
|
|
35
|
+
"@types/cli-progress": "^3.11.6",
|
|
35
36
|
"@types/express": "^5.0.0",
|
|
36
37
|
"@types/findup-sync": "^4.0.5",
|
|
37
38
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"lint": "eslint . && prettier --list-different ./**/*.{js,json}",
|
|
65
66
|
"list-all-commands": "yarn ts-node ./scripts/get-all-commands.ts",
|
|
66
67
|
"prettier:write": "prettier --write ./**/*.{ts,js,json}",
|
|
67
|
-
"test": "jest",
|
|
68
|
+
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
|
|
68
69
|
"test-cli": "yarn build && yarn --cwd 'acceptance-tests' test-ci",
|
|
69
70
|
"test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",
|
|
70
71
|
"test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
|
package/types/Projects.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export type ProjectTemplate = {
|
|
|
7
7
|
insertPath: string;
|
|
8
8
|
};
|
|
9
9
|
export type ComponentTemplate = {
|
|
10
|
-
label: string;
|
|
11
10
|
path: string;
|
|
11
|
+
label: string;
|
|
12
12
|
insertPath: string;
|
|
13
13
|
};
|
|
14
14
|
export type ProjectConfig = {
|
|
@@ -32,11 +32,6 @@ export type ProjectPollStatusFunctionText = {
|
|
|
32
32
|
TYPE_KEY: string;
|
|
33
33
|
SUBTASK_NAME_KEY: string;
|
|
34
34
|
};
|
|
35
|
-
export type ProjectAddComponentData = {
|
|
36
|
-
path: string;
|
|
37
|
-
label: string;
|
|
38
|
-
insertPath: string;
|
|
39
|
-
};
|
|
40
35
|
export type ProjectTemplateRepoConfig = {
|
|
41
36
|
projects?: ProjectTemplate[];
|
|
42
37
|
components?: ComponentTemplate[];
|
package/types/Prompts.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
1
2
|
export type GenericPromptResponse = {
|
|
2
3
|
[key: string]: any;
|
|
3
4
|
};
|
|
@@ -22,4 +23,10 @@ export type PromptConfig<T extends GenericPromptResponse> = {
|
|
|
22
23
|
mask?: string;
|
|
23
24
|
filter?: (input: string) => string;
|
|
24
25
|
};
|
|
26
|
+
export type ProjectDevTargetAccountPromptResponse = {
|
|
27
|
+
targetAccountId: number | null;
|
|
28
|
+
createNestedAccount: boolean;
|
|
29
|
+
parentAccountId?: number | null;
|
|
30
|
+
notInConfigAccount?: DeveloperTestAccount | null;
|
|
31
|
+
};
|
|
25
32
|
export {};
|
package/types/Sandboxes.d.ts
CHANGED
package/types/Yargs.d.ts
CHANGED
|
@@ -9,6 +9,20 @@ export type ConfigArgs = {
|
|
|
9
9
|
c?: string;
|
|
10
10
|
config?: string;
|
|
11
11
|
};
|
|
12
|
+
export type AccountArgs = {
|
|
13
|
+
a?: string;
|
|
14
|
+
account?: string;
|
|
15
|
+
};
|
|
16
|
+
export type EnvironmentArgs = {
|
|
17
|
+
'use-env'?: string;
|
|
18
|
+
};
|
|
19
|
+
export type OverwriteArgs = Options & {
|
|
20
|
+
o?: boolean;
|
|
21
|
+
overwrite?: boolean;
|
|
22
|
+
};
|
|
12
23
|
export type StringArgType = Options & {
|
|
13
24
|
type: 'string';
|
|
14
25
|
};
|
|
26
|
+
export type TestingArgs = {
|
|
27
|
+
qa?: boolean;
|
|
28
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
5
|
-
const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
|
|
6
|
-
const { fetchSecrets } = require('@hubspot/local-dev-lib/api/secrets');
|
|
7
|
-
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
8
|
-
const { uiAccountDescription } = require('../../lib/ui');
|
|
9
|
-
const { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
10
|
-
const { i18n } = require('../../lib/lang');
|
|
11
|
-
const i18nKey = 'commands.secret.subcommands.list';
|
|
12
|
-
exports.command = 'list';
|
|
13
|
-
exports.describe = i18n(`${i18nKey}.describe`);
|
|
14
|
-
exports.handler = async (options) => {
|
|
15
|
-
const { derivedAccountId } = options;
|
|
16
|
-
trackCommandUsage('secrets-list', null, derivedAccountId);
|
|
17
|
-
try {
|
|
18
|
-
const { data: { results }, } = await fetchSecrets(derivedAccountId);
|
|
19
|
-
const groupLabel = i18n(`${i18nKey}.groupLabel`, {
|
|
20
|
-
accountIdentifier: uiAccountDescription(derivedAccountId),
|
|
21
|
-
});
|
|
22
|
-
logger.group(groupLabel);
|
|
23
|
-
results.forEach(secret => logger.log(secret));
|
|
24
|
-
logger.groupEnd(groupLabel);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
logger.error(i18n(`${i18nKey}.errors.list`));
|
|
28
|
-
logError(err, new ApiErrorContext({
|
|
29
|
-
request: 'add secret',
|
|
30
|
-
accountId: derivedAccountId,
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.builder = yargs => {
|
|
35
|
-
addConfigOptions(yargs);
|
|
36
|
-
addAccountOptions(yargs);
|
|
37
|
-
addUseEnvironmentOptions(yargs);
|
|
38
|
-
return yargs;
|
|
39
|
-
};
|