@hubspot/cli 7.8.0-experimental.0 → 7.8.2-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/bin/cli.js +0 -2
- package/commands/__tests__/getStarted.test.js +2 -2
- package/commands/__tests__/mcp.test.js +1 -1
- package/commands/__tests__/project.test.js +0 -3
- package/commands/app/__tests__/migrate.test.js +0 -1
- package/commands/app/migrate.js +4 -5
- package/commands/app/secret/add.js +2 -1
- package/commands/app/secret/delete.js +2 -1
- package/commands/app/secret/list.js +2 -1
- package/commands/app/secret/update.js +2 -1
- package/commands/app/secret.js +2 -1
- package/commands/app.js +2 -2
- package/commands/config/set.js +0 -1
- package/commands/feedback.js +1 -1
- package/commands/getStarted.d.ts +1 -3
- package/commands/getStarted.js +66 -18
- package/commands/mcp/__tests__/setup.test.js +2 -2
- package/commands/mcp/setup.js +11 -2
- package/commands/mcp.js +3 -3
- package/commands/project/__tests__/create.test.js +6 -6
- package/commands/project/__tests__/deploy.test.js +0 -3
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -4
- package/commands/project/__tests__/logs.test.js +0 -3
- package/commands/project/__tests__/migrate.test.js +1 -2
- package/commands/project/__tests__/migrateApp.test.js +1 -2
- package/commands/project/__tests__/profile.test.js +1 -1
- package/commands/project/add.js +1 -5
- package/commands/project/create.js +3 -9
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/index.js +4 -3
- package/commands/project/dev/unifiedFlow.js +6 -4
- package/commands/project/download.js +1 -2
- package/commands/project/installDeps.js +1 -2
- package/commands/project/listBuilds.js +2 -2
- package/commands/project/logs.js +2 -2
- package/commands/project/migrate.js +28 -10
- package/commands/project/migrateApp.js +1 -2
- package/commands/project/open.js +1 -2
- package/commands/project/profile/add.js +3 -3
- package/commands/project/profile/delete.js +1 -2
- package/commands/project/profile.js +2 -3
- package/commands/project/upload.js +2 -2
- package/commands/project/validate.js +1 -1
- package/commands/project/watch.js +2 -2
- package/commands/project.js +1 -2
- package/commands/sandbox/delete.js +1 -1
- package/commands/testAccount/importData.d.ts +1 -1
- package/commands/testAccount/importData.js +1 -1
- package/commands/testAccount.js +1 -1
- package/lang/en.d.ts +15 -4
- package/lang/en.js +18 -6
- package/lib/__tests__/hasFeature.test.js +145 -7
- package/lib/app/__tests__/migrate.test.js +14 -51
- package/lib/app/migrate.d.ts +2 -8
- package/lib/app/migrate.js +5 -80
- package/lib/constants.d.ts +8 -0
- package/lib/constants.js +8 -0
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +0 -9
- package/lib/hasFeature.js +6 -0
- package/lib/links.d.ts +1 -0
- package/lib/links.js +10 -3
- package/lib/mcp/setup.js +1 -1
- package/lib/middleware/fireAlarmMiddleware.js +15 -5
- package/lib/projects/__tests__/LocalDevProcess.test.js +227 -16
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +16 -21
- package/lib/projects/__tests__/deploy.test.js +71 -6
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +4 -2
- package/lib/projects/create/__tests__/v3.test.js +79 -4
- package/lib/projects/create/v3.js +11 -8
- package/lib/projects/localDev/AppDevModeInterface.js +5 -5
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +22 -0
- package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
- package/lib/projects/localDev/LocalDevProcess.js +90 -19
- package/lib/projects/localDev/LocalDevState.d.ts +9 -8
- package/lib/projects/localDev/LocalDevState.js +18 -17
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +2 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +55 -23
- package/lib/projects/localDev/helpers/project.d.ts +2 -2
- package/lib/projects/localDev/helpers/project.js +10 -7
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +4 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +10 -0
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
- package/lib/prompts/projectAddPrompt.js +2 -1
- package/lib/prompts/promptUtils.js +3 -0
- package/lib/prompts/selectProjectTemplatePrompt.js +2 -0
- package/lib/theme/__tests__/migrate.test.d.ts +1 -0
- package/lib/theme/__tests__/migrate.test.js +233 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +90 -0
- package/lib/ui/SpinniesManager.js +105 -8
- package/lib/usageTracking.js +2 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +1 -1
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +3 -3
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +5 -5
- package/mcp-server/tools/project/DeployProjectTool.js +1 -1
- package/mcp-server/tools/project/DocFetchTool.js +2 -2
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +7 -7
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +11 -5
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +2 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +1 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +14 -12
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +9 -8
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +1 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/constants.d.ts +1 -1
- package/mcp-server/tools/project/constants.js +9 -3
- package/mcp-server/utils/__tests__/cliConfig.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/cliConfig.test.js +110 -0
- package/mcp-server/utils/cliConfig.d.ts +1 -0
- package/mcp-server/utils/cliConfig.js +12 -0
- package/package.json +4 -9
- package/types/LocalDev.d.ts +19 -3
- package/ui/components/HorizontalSelectPrompt.js +1 -1
- package/ui/index.js +1 -1
- package/commands/getStartedV2.d.ts +0 -9
- package/commands/getStartedV2.js +0 -39
- package/ui/components/Ascii.d.ts +0 -10
- package/ui/components/Ascii.js +0 -11
- package/ui/views/GetStarted.d.ts +0 -7
- package/ui/views/GetStarted.js +0 -157
package/ui/views/GetStarted.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import { useTerminalSize } from '../lib/useTerminalSize.js';
|
|
5
|
-
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
6
|
-
import { Box, Text } from 'ink';
|
|
7
|
-
import figures from 'figures';
|
|
8
|
-
import { AlertBox, InfoBox, } from '../components/StatusMessageBoxes.js';
|
|
9
|
-
import { commands } from '../../lang/en.js';
|
|
10
|
-
import Ascii from '../components/Ascii.js';
|
|
11
|
-
import { HorizontalSelectPrompt } from '../components/HorizontalSelectPrompt.js';
|
|
12
|
-
import { INK_COLORS } from '../styles.js';
|
|
13
|
-
import { TextInput, Spinner, ConfirmInput, ThemeProvider, extendTheme, defaultTheme, Badge, } from '@inkjs/ui';
|
|
14
|
-
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
15
|
-
import path from 'path';
|
|
16
|
-
import { cloneGithubRepo } from '@hubspot/local-dev-lib/github';
|
|
17
|
-
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, PROJECT_CONFIG_FILE, } from '../../lib/constants.js';
|
|
18
|
-
import { getProjectConfig, validateProjectConfig, writeProjectConfig, } from '../../lib/projects/config.js';
|
|
19
|
-
import { getProjectPackageJsonLocations, installPackages, } from '../../lib/dependencyManagement.js';
|
|
20
|
-
import { handleProjectUpload } from '../../lib/projects/upload.js';
|
|
21
|
-
import { useV3Api } from '../../lib/projects/platformVersion.js';
|
|
22
|
-
import { pollProjectBuildAndDeploy } from '../../lib/projects/pollProjectBuildAndDeploy.js';
|
|
23
|
-
import { getProjectBuildDetailUrl, getProjectDeployDetailUrl, } from '../../lib/projects/urls.js';
|
|
24
|
-
import { BoxWithTitle } from '../components/BoxWithTitle.js';
|
|
25
|
-
export function getGetStarted(props) {
|
|
26
|
-
return _jsx(GetStarted, { ...props });
|
|
27
|
-
}
|
|
28
|
-
const customTheme = extendTheme(defaultTheme, {
|
|
29
|
-
components: {
|
|
30
|
-
Spinner: {
|
|
31
|
-
styles: {
|
|
32
|
-
frame: () => ({
|
|
33
|
-
color: '#FF7A59',
|
|
34
|
-
}),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
export function GetStarted({ args }) {
|
|
40
|
-
const { derivedAccountId } = args;
|
|
41
|
-
const toolTips = [
|
|
42
|
-
'Run hs doctor to diagnose common cli installation problems',
|
|
43
|
-
'Use hs project add to quickly add new features to your project',
|
|
44
|
-
'Unified apps are coming to the cli soon',
|
|
45
|
-
'Use hs test-account create to create and seed test accounts',
|
|
46
|
-
];
|
|
47
|
-
const accountName = uiAccountDescription(derivedAccountId);
|
|
48
|
-
const { columns, rows } = useTerminalSize();
|
|
49
|
-
const templateSource = 'robrown-hubspot/hubspot-project-components-ua-app-objects-beta';
|
|
50
|
-
const projectTemplate = {
|
|
51
|
-
name: 'private-app-get-started-template',
|
|
52
|
-
label: 'CRM getting started project with private apps',
|
|
53
|
-
path: 'projects/private-app-get-started-template',
|
|
54
|
-
};
|
|
55
|
-
const repo = templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
56
|
-
const cloneRepo = async () => {
|
|
57
|
-
await cloneGithubRepo(repo, projectSource, {
|
|
58
|
-
sourceDir: projectTemplate.path,
|
|
59
|
-
tag: undefined,
|
|
60
|
-
hideLogs: true,
|
|
61
|
-
});
|
|
62
|
-
setIsCloned(true);
|
|
63
|
-
};
|
|
64
|
-
const [projectType, setProjectType] = useState('');
|
|
65
|
-
const [showProjectTypeError, setShowProjectTypeError] = useState(false);
|
|
66
|
-
const [projectName, setProjectName] = useState('');
|
|
67
|
-
const [projectSource, setProjectSource] = useState('');
|
|
68
|
-
const [isCloned, setIsCloned] = useState(false);
|
|
69
|
-
const [isConfigUpdated, setIsConfigUpdated] = useState(false);
|
|
70
|
-
const [areDepsInstalled, setAreDepsInstalled] = useState(false);
|
|
71
|
-
const [isUploading, setIsUploading] = useState(null);
|
|
72
|
-
const [isUploaded, setIsUploaded] = useState(false);
|
|
73
|
-
const [projectPollResult, setProjectPollResult] = useState(null);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (projectType === 'CMS') {
|
|
76
|
-
setShowProjectTypeError(true);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
setShowProjectTypeError(false);
|
|
80
|
-
}
|
|
81
|
-
}, [projectType]);
|
|
82
|
-
const updateProjectConfig = () => {
|
|
83
|
-
const projectConfigPath = path.join(projectSource, PROJECT_CONFIG_FILE);
|
|
84
|
-
const parsedConfigFile = JSON.parse(fs.readFileSync(projectConfigPath).toString());
|
|
85
|
-
writeProjectConfig(projectConfigPath, {
|
|
86
|
-
...parsedConfigFile,
|
|
87
|
-
name: projectName,
|
|
88
|
-
});
|
|
89
|
-
setIsConfigUpdated(true);
|
|
90
|
-
};
|
|
91
|
-
const installDeps = async () => {
|
|
92
|
-
const installLocations = await getProjectPackageJsonLocations(projectSource);
|
|
93
|
-
await installPackages({
|
|
94
|
-
installLocations: installLocations,
|
|
95
|
-
});
|
|
96
|
-
setAreDepsInstalled(true);
|
|
97
|
-
};
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
if (projectSource && !isCloned) {
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
cloneRepo();
|
|
102
|
-
}, 500);
|
|
103
|
-
}
|
|
104
|
-
if (projectSource && isCloned) {
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
updateProjectConfig();
|
|
107
|
-
}, 500);
|
|
108
|
-
}
|
|
109
|
-
}, [projectSource, isCloned]);
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (isConfigUpdated && !areDepsInstalled) {
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
installDeps();
|
|
114
|
-
}, 500);
|
|
115
|
-
}
|
|
116
|
-
}, [isConfigUpdated]);
|
|
117
|
-
const uploadProject = async () => {
|
|
118
|
-
const { projectConfig: newProjectConfig, projectDir: newProjectDir } = await getProjectConfig(projectSource);
|
|
119
|
-
validateProjectConfig(newProjectConfig, newProjectDir);
|
|
120
|
-
const { result, uploadError } = await handleProjectUpload({
|
|
121
|
-
accountId: derivedAccountId,
|
|
122
|
-
projectConfig: newProjectConfig,
|
|
123
|
-
projectDir: newProjectDir,
|
|
124
|
-
callbackFunc: pollProjectBuildAndDeploy,
|
|
125
|
-
uploadMessage: 'Initial upload from get-started command',
|
|
126
|
-
forceCreate: true, // Auto-create project on HubSpot
|
|
127
|
-
isUploadCommand: false,
|
|
128
|
-
sendIR: useV3Api(newProjectConfig.platformVersion),
|
|
129
|
-
skipValidation: false,
|
|
130
|
-
});
|
|
131
|
-
if (result) {
|
|
132
|
-
setIsUploaded(true);
|
|
133
|
-
setProjectPollResult(result);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const [toolTipIndex, setToolTipIndex] = useState(0);
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
const interval = setInterval(() => {
|
|
139
|
-
setToolTipIndex(prevIndex => (prevIndex + 1) % toolTips.length);
|
|
140
|
-
}, 5000);
|
|
141
|
-
return () => clearInterval(interval);
|
|
142
|
-
}, []);
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
if (isUploading === true) {
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
uploadProject();
|
|
147
|
-
}, 500);
|
|
148
|
-
}
|
|
149
|
-
}, [isUploading]);
|
|
150
|
-
return (_jsx(ThemeProvider, { theme: customTheme, children: _jsxs(Box, { flexDirection: "column", width: columns, height: rows, children: [_jsx(Ascii, { text: "HubSpot CLI", font: "Standard" }), _jsx(InfoBox, { title: commands.getStarted.startTitle, message: commands.getStarted.startDescription +
|
|
151
|
-
'\n' +
|
|
152
|
-
commands.getStarted.guideOverview(accountName) }), projectType !== 'App' && (_jsxs(Box, { flexDirection: "column", gap: 0, children: [_jsx(HorizontalSelectPrompt, { prompt: commands.getStarted.prompts.selectOption, options: ['App', 'CMS'], onSelect: setProjectType, defaultOption: 'App' }), showProjectTypeError && (_jsx(AlertBox, { title: "Bad Choice", message: "I didn't hook up the CMS flow for this demo" }))] })), projectType === 'App' && (_jsx(_Fragment, { children: _jsxs(Box, { flexDirection: "column", padding: 1, gap: 1, borderStyle: "round", borderColor: "#FF7A59", children: [_jsxs(Box, { flexDirection: "row", width: "100%", gap: 1, children: [_jsxs(Box, { flexDirection: "row", flexBasis: "50%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "Project Name:" }), projectName === '' ? (_jsx(TextInput, { placeholder: "give your project a name", onSubmit: setProjectName })) : (_jsx(Text, { children: projectName }))] }), _jsxs(Box, { flexDirection: "row", flexBasis: "50%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "Project Source:" }), projectSource === '' && projectName !== '' ? (_jsx(TextInput, { defaultValue: path.resolve(getCwd(), projectName), placeholder: path.resolve(getCwd(), projectName), onSubmit: setProjectSource })) : (_jsx(Text, { children: projectSource }))] })] }), projectSource && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: isCloned ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project downloaded"] })) : (_jsx(Spinner, { type: "dots", label: "Downloading project" })) })), projectSource && isCloned && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: isConfigUpdated ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project config updated"] })) : (_jsx(Spinner, { type: "dots", label: "Updating project config" })) })), isConfigUpdated && (_jsxs(Box, { flexDirection: "column", width: "100%", gap: 0, children: [_jsxs(Box, { flexDirection: "row", width: "100%", gap: 1, children: [_jsx(Badge, { color: INK_COLORS.SUCCESS_GREEN, children: "Success" }), _jsx(Text, { children: commands.project.create.logs.success(projectName, projectSource) })] }), _jsx(Text, { children: commands.getStarted.prompts.projectCreated.title }), _jsx(Text, { children: commands.getStarted.prompts.projectCreated.description })] })), isConfigUpdated && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: areDepsInstalled ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project dependencies installed"] })) : (_jsx(Spinner, { type: "dots", label: "Installing project dependencies" })) })), areDepsInstalled && isUploading === null && (_jsxs(Box, { flexDirection: "row", width: "100%", gap: 1, children: [_jsx(Text, { color: INK_COLORS.WARNING_YELLOW, children: "Would you like to upload your project to HubSpot?" }), isUploading === null ? (_jsx(ConfirmInput, { onConfirm: () => {
|
|
153
|
-
setIsUploading(true);
|
|
154
|
-
}, onCancel: () => {
|
|
155
|
-
setIsUploading(false);
|
|
156
|
-
} })) : (_jsx(Text, { color: INK_COLORS.SUCCESS_GREEN, children: isUploading }))] })), isUploading === true && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: isUploaded ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project uploaded, built, and deployed"] })) : (_jsx(Spinner, { type: "dots", label: "Uploading, building, and deploying project" })) })), projectPollResult && (_jsxs(Box, { flexDirection: "column", width: "100%", gap: 1, children: [_jsxs(Box, { flexDirection: "row", alignSelf: "center", width: "100%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "View build in HubSpot:" }), _jsx(Text, { color: INK_COLORS.INFO_BLUE, children: getProjectBuildDetailUrl(projectName, projectPollResult.buildId, derivedAccountId) })] }), _jsxs(Box, { flexDirection: "row", alignSelf: "center", width: "100%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "View deploy in HubSpot:" }), _jsx(Text, { color: INK_COLORS.INFO_BLUE, children: getProjectDeployDetailUrl(projectName, projectPollResult.deployResult?.deployId || 0, derivedAccountId) })] })] }))] }) })), _jsx(BoxWithTitle, { title: "Tips", message: toolTips[toolTipIndex], borderColor: "gray" })] }) }));
|
|
157
|
-
}
|