@hubspot/cli 7.7.22-experimental.0 → 7.7.23-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/config/set.d.ts +1 -0
- package/commands/config/set.js +19 -9
- package/commands/testAccount/createConfig.js +1 -1
- package/lang/en.d.ts +10 -1
- package/lang/en.js +10 -1
- package/lib/__tests__/yargsUtils.test.js +12 -1
- package/lib/configOptions.d.ts +5 -0
- package/lib/configOptions.js +11 -1
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +4 -0
- package/lib/projects/add/legacyAddComponent.js +1 -1
- package/lib/projects/add/v3AddComponent.js +1 -1
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/localDev/LocalDevLogger.js +11 -2
- package/lib/projects/localDev/LocalDevProcess.d.ts +1 -0
- package/lib/projects/localDev/LocalDevProcess.js +12 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +5 -1
- package/lib/projects/urls.d.ts +1 -1
- package/lib/projects/urls.js +2 -2
- package/lib/yargsUtils.d.ts +1 -0
- package/lib/yargsUtils.js +6 -0
- package/package.json +3 -3
package/commands/config/set.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ type ConfigSetArgs = CommonArgs & ConfigArgs & {
|
|
|
5
5
|
allowUsageTracking?: boolean;
|
|
6
6
|
httpTimeout?: string;
|
|
7
7
|
allowAutoUpdates?: boolean;
|
|
8
|
+
autoOpenBrowser?: boolean;
|
|
8
9
|
};
|
|
9
10
|
declare const configSetCommand: YargsCommandModule<unknown, ConfigSetArgs>;
|
|
10
11
|
export default configSetCommand;
|
package/commands/config/set.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i18n } from '../../lib/lang.js';
|
|
|
2
2
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
3
3
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
4
4
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
5
|
-
import { setDefaultCmsPublishMode, setHttpTimeout, setAllowUsageTracking, setAllowAutoUpdates, } from '../../lib/configOptions.js';
|
|
5
|
+
import { setDefaultCmsPublishMode, setHttpTimeout, setAllowUsageTracking, setAllowAutoUpdates, setAutoOpenBrowser, } from '../../lib/configOptions.js';
|
|
6
6
|
import { commands } from '../../lang/en.js';
|
|
7
|
-
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
7
|
+
import { makeYargsBuilder, getExclusiveConflicts, } from '../../lib/yargsUtils.js';
|
|
8
8
|
const command = 'set';
|
|
9
9
|
const describe = commands.config.subcommands.set.describe;
|
|
10
10
|
async function selectOptions() {
|
|
@@ -28,7 +28,7 @@ async function selectOptions() {
|
|
|
28
28
|
return configOption;
|
|
29
29
|
}
|
|
30
30
|
async function handleConfigUpdate(accountId, args) {
|
|
31
|
-
const { allowAutoUpdates, allowUsageTracking, defaultCmsPublishMode, httpTimeout, } = args;
|
|
31
|
+
const { allowAutoUpdates, allowUsageTracking, defaultCmsPublishMode, httpTimeout, autoOpenBrowser, } = args;
|
|
32
32
|
if (typeof defaultCmsPublishMode !== 'undefined') {
|
|
33
33
|
await setDefaultCmsPublishMode({ defaultCmsPublishMode, accountId });
|
|
34
34
|
return true;
|
|
@@ -45,6 +45,10 @@ async function handleConfigUpdate(accountId, args) {
|
|
|
45
45
|
await setAllowAutoUpdates({ allowAutoUpdates, accountId });
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
|
+
else if (typeof autoOpenBrowser !== 'undefined') {
|
|
49
|
+
await setAutoOpenBrowser({ autoOpenBrowser, accountId });
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
48
52
|
return false;
|
|
49
53
|
}
|
|
50
54
|
async function handler(args) {
|
|
@@ -77,13 +81,19 @@ function configSetBuilder(yargs) {
|
|
|
77
81
|
type: 'boolean',
|
|
78
82
|
hidden: true,
|
|
79
83
|
},
|
|
84
|
+
'auto-open-browser': {
|
|
85
|
+
describe: commands.config.subcommands.set.options.autoOpenBrowser.describe,
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
hidden: true,
|
|
88
|
+
},
|
|
80
89
|
})
|
|
81
|
-
.conflicts(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
.conflicts(getExclusiveConflicts([
|
|
91
|
+
'default-cms-publish-mode',
|
|
92
|
+
'allow-usage-tracking',
|
|
93
|
+
'http-timeout',
|
|
94
|
+
'allow-auto-updates',
|
|
95
|
+
'auto-open-browser',
|
|
96
|
+
]))
|
|
87
97
|
.example([
|
|
88
98
|
[
|
|
89
99
|
'$0 config set',
|
|
@@ -7,7 +7,7 @@ import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
|
7
7
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
8
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
9
9
|
import { commands } from '../../lang/en.js';
|
|
10
|
-
import { createDeveloperTestAccountConfigPrompt
|
|
10
|
+
import { createDeveloperTestAccountConfigPrompt } from '../../lib/prompts/createDeveloperTestAccountConfigPrompt.js';
|
|
11
11
|
import { fileExists } from '../../lib/validation.js';
|
|
12
12
|
const command = 'create-config';
|
|
13
13
|
const describe = commands.testAccount.createConfig.describe;
|
package/lang/en.d.ts
CHANGED
|
@@ -252,6 +252,9 @@ Global configuration replaces hubspot.config.yml, and you will be prompted to mi
|
|
|
252
252
|
readonly allowAutoUpdates: {
|
|
253
253
|
readonly describe: "Enable or disable auto updates";
|
|
254
254
|
};
|
|
255
|
+
readonly autoOpenBrowser: {
|
|
256
|
+
readonly describe: "Enable or disable automatic opening of the browser";
|
|
257
|
+
};
|
|
255
258
|
};
|
|
256
259
|
};
|
|
257
260
|
};
|
|
@@ -2459,7 +2462,8 @@ export declare const lib: {
|
|
|
2459
2462
|
readonly running: (projectName: string, accountIdentifier: string) => string;
|
|
2460
2463
|
readonly quitHelper: `Press ${string} to stop the local dev server`;
|
|
2461
2464
|
readonly viewProjectLink: (name: string, accountId: number) => string;
|
|
2462
|
-
readonly viewLocalDevUILink: (accountId: number) => string;
|
|
2465
|
+
readonly viewLocalDevUILink: (accountId: number, showWelcomeScreen: boolean) => string;
|
|
2466
|
+
readonly localDevUIAutoMessage: (accountId: number, showWelcomeScreen: boolean) => string;
|
|
2463
2467
|
readonly viewTestAccountLink: "View developer test account in HubSpot";
|
|
2464
2468
|
readonly exitingStart: "Stopping local dev server ...";
|
|
2465
2469
|
readonly exitingSucceed: "Successfully exited";
|
|
@@ -2791,6 +2795,11 @@ Run ${string} to upgrade to version ${string}`;
|
|
|
2791
2795
|
readonly promptMessage: "Enter http timeout duration";
|
|
2792
2796
|
readonly success: (timeout: string) => string;
|
|
2793
2797
|
};
|
|
2798
|
+
readonly setAutoOpenBrowser: {
|
|
2799
|
+
readonly fieldName: "auto open browser";
|
|
2800
|
+
readonly enabled: "Auto opening your browser has been enabled";
|
|
2801
|
+
readonly disabled: "Auto opening your browser has been disabled";
|
|
2802
|
+
};
|
|
2794
2803
|
};
|
|
2795
2804
|
readonly commonOpts: {
|
|
2796
2805
|
readonly options: {
|
package/lang/en.js
CHANGED
|
@@ -253,6 +253,9 @@ export const commands = {
|
|
|
253
253
|
allowAutoUpdates: {
|
|
254
254
|
describe: 'Enable or disable auto updates',
|
|
255
255
|
},
|
|
256
|
+
autoOpenBrowser: {
|
|
257
|
+
describe: 'Enable or disable automatic opening of the browser',
|
|
258
|
+
},
|
|
256
259
|
},
|
|
257
260
|
},
|
|
258
261
|
},
|
|
@@ -2451,7 +2454,8 @@ export const lib = {
|
|
|
2451
2454
|
running: (projectName, accountIdentifier) => chalk.hex(UI_COLORS.SORBET)(`Running ${chalk.bold(projectName)} locally on ${accountIdentifier}, waiting for changes ...`),
|
|
2452
2455
|
quitHelper: `Press ${chalk.bold('q')} to stop the local dev server`,
|
|
2453
2456
|
viewProjectLink: (name, accountId) => uiLink('View project in HubSpot', getProjectDetailUrl(name, accountId) || ''),
|
|
2454
|
-
viewLocalDevUILink: (accountId) => uiLink('View local dev session in HubSpot', getLocalDevUiUrl(accountId)),
|
|
2457
|
+
viewLocalDevUILink: (accountId, showWelcomeScreen) => uiLink('View local dev session in HubSpot', getLocalDevUiUrl(accountId, showWelcomeScreen)),
|
|
2458
|
+
localDevUIAutoMessage: (accountId, showWelcomeScreen) => `Opening your ${uiLink('local dev session in HubSpot', getLocalDevUiUrl(accountId, showWelcomeScreen))}...`,
|
|
2455
2459
|
viewTestAccountLink: 'View developer test account in HubSpot',
|
|
2456
2460
|
exitingStart: 'Stopping local dev server ...',
|
|
2457
2461
|
exitingSucceed: 'Successfully exited',
|
|
@@ -2780,6 +2784,11 @@ export const lib = {
|
|
|
2780
2784
|
promptMessage: 'Enter http timeout duration',
|
|
2781
2785
|
success: (timeout) => `HTTP timeout set to: ${timeout}`,
|
|
2782
2786
|
},
|
|
2787
|
+
setAutoOpenBrowser: {
|
|
2788
|
+
fieldName: 'auto open browser',
|
|
2789
|
+
enabled: 'Auto opening your browser has been enabled',
|
|
2790
|
+
disabled: 'Auto opening your browser has been disabled',
|
|
2791
|
+
},
|
|
2783
2792
|
},
|
|
2784
2793
|
commonOpts: {
|
|
2785
2794
|
options: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasFlag, makeYargsBuilder } from '../yargsUtils.js';
|
|
1
|
+
import { hasFlag, makeYargsBuilder, getExclusiveConflicts, } from '../yargsUtils.js';
|
|
2
2
|
import * as commonOpts from '../commonOpts.js';
|
|
3
3
|
vi.mock('../commonOpts');
|
|
4
4
|
const argvWithFlag = ['hs', 'command', '--test'];
|
|
@@ -36,4 +36,15 @@ describe('lib/yargsUtils', () => {
|
|
|
36
36
|
expect(commonOpts.addCustomHelpOutput).toHaveBeenCalled();
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
describe('getExclusiveConflicts()', () => {
|
|
40
|
+
it('should return an object where each option conflicts with all others', () => {
|
|
41
|
+
const options = ['option1', 'option2', 'option3'];
|
|
42
|
+
const result = getExclusiveConflicts(options);
|
|
43
|
+
expect(result).toEqual({
|
|
44
|
+
option1: ['option2', 'option3'],
|
|
45
|
+
option2: ['option1', 'option3'],
|
|
46
|
+
option3: ['option1', 'option2'],
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
});
|
package/lib/configOptions.d.ts
CHANGED
|
@@ -15,3 +15,8 @@ export declare function setHttpTimeout({ accountId, httpTimeout, }: {
|
|
|
15
15
|
accountId: number;
|
|
16
16
|
httpTimeout?: string;
|
|
17
17
|
}): Promise<void>;
|
|
18
|
+
export declare function setAutoOpenBrowser({ accountId, autoOpenBrowser, }: {
|
|
19
|
+
accountId: number;
|
|
20
|
+
autoOpenBrowser: boolean;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare function isAutoOpenBrowserEnabled(): boolean;
|
package/lib/configOptions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { updateAllowUsageTracking, updateAllowAutoUpdates, updateDefaultCmsPublishMode, updateHttpTimeout, } from '@hubspot/local-dev-lib/config';
|
|
1
|
+
import { updateAllowUsageTracking, updateAllowAutoUpdates, updateDefaultCmsPublishMode, updateHttpTimeout, isConfigFlagEnabled, updateAutoOpenBrowser, } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { CMS_PUBLISH_MODE } from '@hubspot/local-dev-lib/constants/files';
|
|
3
3
|
import { commaSeparatedValues } from '@hubspot/local-dev-lib/text';
|
|
4
4
|
import { trackCommandUsage } from './usageTracking.js';
|
|
@@ -95,3 +95,13 @@ export async function setHttpTimeout({ accountId, httpTimeout, }) {
|
|
|
95
95
|
updateHttpTimeout(newHttpTimeout);
|
|
96
96
|
uiLogger.success(lib.configOptions.setHttpTimeout.success(newHttpTimeout));
|
|
97
97
|
}
|
|
98
|
+
export async function setAutoOpenBrowser({ accountId, autoOpenBrowser, }) {
|
|
99
|
+
trackCommandUsage('config-set-auto-open-browser', undefined, accountId);
|
|
100
|
+
updateAutoOpenBrowser(autoOpenBrowser);
|
|
101
|
+
uiLogger.success(autoOpenBrowser
|
|
102
|
+
? lib.configOptions.setAutoOpenBrowser.enabled
|
|
103
|
+
: lib.configOptions.setAutoOpenBrowser.disabled);
|
|
104
|
+
}
|
|
105
|
+
export function isAutoOpenBrowserEnabled() {
|
|
106
|
+
return isConfigFlagEnabled('autoOpenBrowser', true);
|
|
107
|
+
}
|
package/lib/constants.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
|
88
88
|
};
|
|
89
89
|
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
90
90
|
UPLOAD: string;
|
|
91
|
+
VIEWED_WELCOME_SCREEN: string;
|
|
91
92
|
};
|
|
92
93
|
export declare const APP_INSTALLATION_STATES: {
|
|
93
94
|
readonly NOT_INSTALLED: "NOT_INSTALLED";
|
|
@@ -107,3 +108,6 @@ export declare const LOCAL_DEV_SERVER_MESSAGE_TYPES: {
|
|
|
107
108
|
readonly INITIAL: "INITIAL";
|
|
108
109
|
readonly WEBSOCKET_SERVER_CONNECTED: "WEBSOCKET_SERVER_CONNECTED";
|
|
109
110
|
};
|
|
111
|
+
export declare const CONFIG_LOCAL_STATE_FLAGS: {
|
|
112
|
+
readonly LOCAL_DEV_UI_WELCOME: "LOCAL_DEV_UI_WELCOME";
|
|
113
|
+
};
|
package/lib/constants.js
CHANGED
|
@@ -80,6 +80,7 @@ export const LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
|
|
|
80
80
|
};
|
|
81
81
|
export const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
|
|
82
82
|
UPLOAD: 'client:upload',
|
|
83
|
+
VIEWED_WELCOME_SCREEN: 'client:viewedWelcomeScreen',
|
|
83
84
|
};
|
|
84
85
|
export const APP_INSTALLATION_STATES = {
|
|
85
86
|
NOT_INSTALLED: 'NOT_INSTALLED',
|
|
@@ -99,3 +100,6 @@ export const LOCAL_DEV_SERVER_MESSAGE_TYPES = {
|
|
|
99
100
|
INITIAL: 'INITIAL',
|
|
100
101
|
WEBSOCKET_SERVER_CONNECTED: 'WEBSOCKET_SERVER_CONNECTED',
|
|
101
102
|
};
|
|
103
|
+
export const CONFIG_LOCAL_STATE_FLAGS = {
|
|
104
|
+
LOCAL_DEV_UI_WELCOME: 'LOCAL_DEV_UI_WELCOME',
|
|
105
|
+
};
|
|
@@ -5,7 +5,7 @@ import { commands } from '../../../lang/en.js';
|
|
|
5
5
|
import { getProjectComponentListFromRepo } from '../create/legacy.js';
|
|
6
6
|
import { projectAddPrompt } from '../../prompts/projectAddPrompt.js';
|
|
7
7
|
import path from 'path';
|
|
8
|
-
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, DEFAULT_PROJECT_TEMPLATE_BRANCH } from '../../constants.js';
|
|
8
|
+
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, DEFAULT_PROJECT_TEMPLATE_BRANCH, } from '../../constants.js';
|
|
9
9
|
import { cloneGithubRepo } from '@hubspot/local-dev-lib/github';
|
|
10
10
|
import { uiLogger } from '../../ui/logger.js';
|
|
11
11
|
export async function legacyAddComponent(args, projectDir, projectConfig) {
|
|
@@ -4,7 +4,7 @@ import { calculateComponentTemplateChoices, createV3App, PROJECT_WITH_APP, } fro
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import { projectAddPromptV3 } from '../../prompts/projectAddPrompt.js';
|
|
7
|
-
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, DEFAULT_PROJECT_TEMPLATE_BRANCH } from '../../constants.js';
|
|
7
|
+
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, DEFAULT_PROJECT_TEMPLATE_BRANCH, } from '../../constants.js';
|
|
8
8
|
import { handleComponentCollision } from '../components.js';
|
|
9
9
|
import { getProjectMetadata, } from '@hubspot/project-parsing-lib/src/lib/project.js';
|
|
10
10
|
import { AppKey } from '@hubspot/project-parsing-lib/src/lib/constants.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { selectProjectTemplatePrompt, } from '../../prompts/selectProjectTemplatePrompt.js';
|
|
2
2
|
import { projectNameAndDestPrompt } from '../../prompts/projectNameAndDestPrompt.js';
|
|
3
|
-
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } from '../../constants.js';
|
|
3
|
+
import { DEFAULT_PROJECT_TEMPLATE_BRANCH, HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, } from '../../constants.js';
|
|
4
4
|
import { useV3Api } from '../buildAndDeploy.js';
|
|
5
5
|
import { EMPTY_PROJECT, v3ComponentFlow } from './v3.js';
|
|
6
6
|
import { getProjectTemplateListFromRepo } from './legacy.js';
|
|
@@ -23,7 +23,7 @@ export async function handleProjectCreationFlow(args) {
|
|
|
23
23
|
projectNameAndDestPromptResponse,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
const projectTemplates = await getProjectTemplateListFromRepo(repo,
|
|
26
|
+
const projectTemplates = await getProjectTemplateListFromRepo(repo, DEFAULT_PROJECT_TEMPLATE_BRANCH);
|
|
27
27
|
if (!projectTemplates.length) {
|
|
28
28
|
uiLogger.error(commands.project.create.errors.failedToFetchProjectList);
|
|
29
29
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchRepoFile } from '@hubspot/local-dev-lib/api/github';
|
|
2
|
-
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, PROJECT_COMPONENT_TYPES, } from '../../constants.js';
|
|
2
|
+
import { DEFAULT_PROJECT_TEMPLATE_BRANCH, HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, PROJECT_COMPONENT_TYPES, } from '../../constants.js';
|
|
3
3
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
4
4
|
import { debugError } from '../../errorHandlers/index.js';
|
|
5
5
|
import { uiLogger } from '../../ui/logger.js';
|
|
@@ -12,7 +12,7 @@ export async function getConfigForPlatformVersion(platformVersion) {
|
|
|
12
12
|
if (useV3Api(platformVersion)) {
|
|
13
13
|
path = `${platformVersion}/`;
|
|
14
14
|
}
|
|
15
|
-
const { data } = await fetchRepoFile(HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, `${path}config.json`,
|
|
15
|
+
const { data } = await fetchRepoFile(HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, `${path}config.json`, DEFAULT_PROJECT_TEMPLATE_BRANCH);
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
18
|
export async function getProjectComponentListFromRepo(platformVersion) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAccountId } from '@hubspot/local-dev-lib/config';
|
|
1
|
+
import { getAccountId, hasLocalStateFlag } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { getConfigDefaultAccount } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
4
|
import { uiLogger } from '../../ui/logger.js';
|
|
@@ -6,6 +6,8 @@ import { uiBetaTag, uiLine, uiAccountDescription, uiCommandReference, } from '..
|
|
|
6
6
|
import { lib } from '../../../lang/en.js';
|
|
7
7
|
import SpinniesManager from '../../ui/SpinniesManager.js';
|
|
8
8
|
import { logError } from '../../errorHandlers/index.js';
|
|
9
|
+
import { isAutoOpenBrowserEnabled } from '../../configOptions.js';
|
|
10
|
+
import { CONFIG_LOCAL_STATE_FLAGS } from '../../constants.js';
|
|
9
11
|
class LocalDevLogger {
|
|
10
12
|
state;
|
|
11
13
|
mostRecentUploadWarning;
|
|
@@ -96,7 +98,14 @@ class LocalDevLogger {
|
|
|
96
98
|
uiLogger.log('');
|
|
97
99
|
uiLogger.log(lib.LocalDevManager.running(this.state.projectConfig.name, uiAccountDescription(this.state.targetProjectAccountId)));
|
|
98
100
|
uiLogger.log(lib.LocalDevManager.viewProjectLink(this.state.projectConfig.name, this.state.targetProjectAccountId));
|
|
99
|
-
|
|
101
|
+
const showWelcomeScreen = !hasLocalStateFlag(CONFIG_LOCAL_STATE_FLAGS.LOCAL_DEV_UI_WELCOME);
|
|
102
|
+
if (!isAutoOpenBrowserEnabled()) {
|
|
103
|
+
uiLogger.log(lib.LocalDevManager.viewLocalDevUILink(this.state.targetTestingAccountId, showWelcomeScreen));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
uiLogger.log('');
|
|
107
|
+
uiLogger.log(lib.LocalDevManager.localDevUIAutoMessage(this.state.targetTestingAccountId, showWelcomeScreen));
|
|
108
|
+
}
|
|
100
109
|
uiLogger.log('');
|
|
101
110
|
uiLogger.log(lib.LocalDevManager.quitHelper);
|
|
102
111
|
uiLine();
|
|
@@ -24,6 +24,7 @@ declare class LocalDevProcess {
|
|
|
24
24
|
private getIntermediateRepresentation;
|
|
25
25
|
private updateProjectNodes;
|
|
26
26
|
private updateProjectNodesAfterUpload;
|
|
27
|
+
private openLocalDevUi;
|
|
27
28
|
handleFileChange(filePath: string, event: string): Promise<void>;
|
|
28
29
|
handleConfigFileChange(): Promise<void>;
|
|
29
30
|
start(): Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { translateForLocalDev } from '@hubspot/project-parsing-lib';
|
|
2
|
+
import { hasLocalStateFlag } from '@hubspot/local-dev-lib/config';
|
|
2
3
|
import path from 'path';
|
|
4
|
+
import open from 'open';
|
|
3
5
|
import LocalDevState from './LocalDevState.js';
|
|
4
6
|
import LocalDevLogger from './LocalDevLogger.js';
|
|
5
7
|
import DevServerManagerV2 from './DevServerManagerV2.js';
|
|
@@ -8,6 +10,9 @@ import { mapToUserFriendlyName } from '@hubspot/project-parsing-lib/src/lib/tran
|
|
|
8
10
|
import { getProjectConfig } from '../config.js';
|
|
9
11
|
import { handleProjectUpload } from '../upload.js';
|
|
10
12
|
import { pollProjectBuildAndDeploy } from '../buildAndDeploy.js';
|
|
13
|
+
import { getLocalDevUiUrl } from '../urls.js';
|
|
14
|
+
import { CONFIG_LOCAL_STATE_FLAGS } from '../../constants.js';
|
|
15
|
+
import { isAutoOpenBrowserEnabled } from '../../configOptions.js';
|
|
11
16
|
class LocalDevProcess {
|
|
12
17
|
state;
|
|
13
18
|
_logger;
|
|
@@ -119,6 +124,10 @@ class LocalDevProcess {
|
|
|
119
124
|
this.state.projectNodesAtLastUpload =
|
|
120
125
|
intermediateRepresentation.intermediateNodesIndexedByUid;
|
|
121
126
|
}
|
|
127
|
+
openLocalDevUi() {
|
|
128
|
+
const showWelcomeScreen = !hasLocalStateFlag(CONFIG_LOCAL_STATE_FLAGS.LOCAL_DEV_UI_WELCOME);
|
|
129
|
+
open(getLocalDevUiUrl(this.state.targetTestingAccountId, showWelcomeScreen));
|
|
130
|
+
}
|
|
122
131
|
async handleFileChange(filePath, event) {
|
|
123
132
|
await this.updateProjectNodes();
|
|
124
133
|
try {
|
|
@@ -144,6 +153,9 @@ class LocalDevProcess {
|
|
|
144
153
|
process.exit(EXIT_CODES.ERROR);
|
|
145
154
|
}
|
|
146
155
|
this.logger.startupMessage();
|
|
156
|
+
if (isAutoOpenBrowserEnabled()) {
|
|
157
|
+
this.openLocalDevUi();
|
|
158
|
+
}
|
|
147
159
|
await this.startDevServers();
|
|
148
160
|
this.logger.monitorConsoleOutput();
|
|
149
161
|
// Verify that there are no mismatches between components in the local project
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { WebSocketServer } from 'ws';
|
|
2
2
|
import { isPortManagerServerRunning, requestPorts, } from '@hubspot/local-dev-lib/portManager';
|
|
3
3
|
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
|
-
import {
|
|
4
|
+
import { addLocalStateFlag } from '@hubspot/local-dev-lib/config';
|
|
5
|
+
import { LOCAL_DEV_UI_MESSAGE_SEND_TYPES, LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES, LOCAL_DEV_SERVER_MESSAGE_TYPES, CONFIG_LOCAL_STATE_FLAGS, } from '../../constants.js';
|
|
5
6
|
import { lib } from '../../../lang/en.js';
|
|
6
7
|
const SERVER_INSTANCE_ID = 'local-dev-ui-websocket-server';
|
|
7
8
|
const LOG_PREFIX = '[LocalDevWebsocketServer]';
|
|
@@ -64,6 +65,9 @@ class LocalDevWebsocketServer {
|
|
|
64
65
|
case LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES.UPLOAD:
|
|
65
66
|
this.handleUpload();
|
|
66
67
|
break;
|
|
68
|
+
case LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES.VIEWED_WELCOME_SCREEN:
|
|
69
|
+
addLocalStateFlag(CONFIG_LOCAL_STATE_FLAGS.LOCAL_DEV_UI_WELCOME);
|
|
70
|
+
break;
|
|
67
71
|
default:
|
|
68
72
|
this.logError(lib.LocalDevWebsocketServer.errors.unknownMessageType(message.type));
|
|
69
73
|
}
|
package/lib/projects/urls.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare function getProjectSettingsUrl(projectName: string, accountId: nu
|
|
|
5
5
|
export declare function getProjectActivityUrl(projectName: string, accountId: number): string;
|
|
6
6
|
export declare function getProjectBuildDetailUrl(projectName: string, buildId: number, accountId: number): string;
|
|
7
7
|
export declare function getProjectDeployDetailUrl(projectName: string, deployId: number, accountId: number): string;
|
|
8
|
-
export declare function getLocalDevUiUrl(accountId: number): string;
|
|
8
|
+
export declare function getLocalDevUiUrl(accountId: number, showWelcomeScreen?: boolean): string;
|
package/lib/projects/urls.js
CHANGED
|
@@ -34,6 +34,6 @@ export function getProjectBuildDetailUrl(projectName, buildId, accountId) {
|
|
|
34
34
|
export function getProjectDeployDetailUrl(projectName, deployId, accountId) {
|
|
35
35
|
return `${getProjectActivityUrl(projectName, accountId)}/deploy/${deployId}`;
|
|
36
36
|
}
|
|
37
|
-
export function getLocalDevUiUrl(accountId) {
|
|
38
|
-
return `${getBaseUrl(accountId)}/developer-projects-local-dev/${accountId}`;
|
|
37
|
+
export function getLocalDevUiUrl(accountId, showWelcomeScreen) {
|
|
38
|
+
return `${getBaseUrl(accountId)}/developer-projects-local-dev/${accountId}${showWelcomeScreen ? '?welcome' : ''}`;
|
|
39
39
|
}
|
package/lib/yargsUtils.d.ts
CHANGED
package/lib/yargsUtils.js
CHANGED
|
@@ -34,3 +34,9 @@ export function makeYargsBuilder(callback, command, describe, options = {}) {
|
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
export function getExclusiveConflicts(options) {
|
|
38
|
+
return options.reduce((acc, curr) => {
|
|
39
|
+
acc[curr] = options.filter(s => s !== curr);
|
|
40
|
+
return acc;
|
|
41
|
+
}, {});
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.7.
|
|
3
|
+
"version": "7.7.23-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
|
"type": "module",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@hubspot/local-dev-lib": "3.
|
|
10
|
-
"@hubspot/project-parsing-lib": "0.
|
|
9
|
+
"@hubspot/local-dev-lib": "3.16.0",
|
|
10
|
+
"@hubspot/project-parsing-lib": "0.5.3",
|
|
11
11
|
"@hubspot/serverless-dev-runtime": "7.0.6",
|
|
12
12
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|
|
13
13
|
"@hubspot/ui-extensions-dev-server": "0.9.4",
|