@hubspot/cli 7.0.1 → 7.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +7 -2
- package/commands/account/info.d.ts +7 -0
- package/commands/account/info.js +28 -25
- package/commands/account/remove.js +4 -4
- package/commands/account/use.js +3 -3
- package/commands/auth.js +3 -3
- package/commands/function/deploy.js +1 -1
- package/commands/init.js +1 -1
- package/commands/logs.js +1 -7
- package/commands/project/cloneApp.js +1 -1
- package/commands/project/create.js +6 -0
- package/commands/project/dev.js +4 -3
- package/commands/project/installDeps.js +2 -4
- package/commands/project/migrateApp.js +1 -1
- package/commands/project/upload.js +4 -4
- package/commands/project/watch.js +4 -4
- package/commands/sandbox/create.js +7 -18
- package/commands/sandbox/delete.js +6 -10
- package/commands/theme/preview.js +3 -2
- package/lang/en.lyaml +11 -4
- package/lib/DevServerManager.d.ts +40 -1
- package/lib/DevServerManager.js +39 -30
- package/lib/LocalDevManager.d.ts +58 -1
- package/lib/LocalDevManager.js +162 -121
- package/lib/buildAccount.d.ts +12 -0
- package/lib/buildAccount.js +110 -95
- package/lib/commonOpts.d.ts +4 -8
- package/lib/commonOpts.js +2 -14
- package/lib/constants.d.ts +1 -7
- package/lib/constants.js +2 -8
- package/lib/dependencyManagement.d.ts +9 -4
- package/lib/dependencyManagement.js +45 -49
- package/lib/developerTestAccounts.d.ts +1 -0
- package/lib/developerTestAccounts.js +1 -0
- package/lib/errorHandlers/index.js +5 -2
- package/lib/localDev.d.ts +17 -1
- package/lib/localDev.js +203 -203
- package/lib/polling.d.ts +13 -5
- package/lib/polling.js +21 -7
- package/lib/projects/buildAndDeploy.d.ts +1 -7
- package/lib/projects/buildAndDeploy.js +3 -3
- package/lib/projects/index.js +9 -4
- package/lib/projects/structure.d.ts +5 -71
- package/lib/projects/structure.js +27 -10
- package/lib/projects/upload.d.ts +4 -3
- package/lib/projects/upload.js +3 -5
- package/lib/prompts/createProjectPrompt.js +8 -1
- package/lib/prompts/installPublicAppPrompt.d.ts +1 -1
- package/lib/prompts/personalAccessKeyPrompt.d.ts +1 -1
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +2 -2
- package/lib/sandboxSync.d.ts +4 -1
- package/lib/sandboxSync.js +67 -68
- package/lib/sandboxes.d.ts +20 -1
- package/lib/sandboxes.js +77 -175
- package/lib/serverlessLogs.d.ts +4 -1
- package/lib/serverlessLogs.js +64 -60
- package/lib/ui/serverlessFunctionLogs.d.ts +8 -0
- package/lib/ui/serverlessFunctionLogs.js +1 -3
- package/lib/validation.d.ts +2 -0
- package/lib/validation.js +5 -8
- package/package.json +8 -7
- package/types/Projects.d.ts +74 -0
- package/types/Projects.js +7 -0
- package/types/Sandboxes.d.ts +3 -0
- package/types/Sandboxes.js +2 -0
- package/types/Yargs.d.ts +14 -0
- package/types/Yargs.js +2 -0
package/lib/DevServerManager.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
3
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
+
const lang_1 = require("./lang");
|
|
5
|
+
const promptUtils_1 = require("./prompts/promptUtils");
|
|
6
|
+
const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
|
|
7
|
+
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
8
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
+
const Projects_1 = require("../types/Projects");
|
|
12
11
|
const i18nKey = 'lib.DevServerManager';
|
|
13
12
|
const SERVER_KEYS = {
|
|
14
13
|
privateApp: 'privateApp',
|
|
15
14
|
publicApp: 'publicApp',
|
|
16
15
|
};
|
|
17
16
|
class DevServerManager {
|
|
17
|
+
initialized;
|
|
18
|
+
started;
|
|
19
|
+
componentsByType;
|
|
20
|
+
devServers;
|
|
18
21
|
constructor() {
|
|
19
22
|
this.initialized = false;
|
|
20
23
|
this.started = false;
|
|
21
24
|
this.componentsByType = {};
|
|
22
|
-
this.server = null;
|
|
23
|
-
this.path = null;
|
|
24
25
|
this.devServers = {
|
|
25
26
|
[SERVER_KEYS.privateApp]: {
|
|
26
|
-
componentType:
|
|
27
|
-
serverInterface: DevModeInterface,
|
|
27
|
+
componentType: Projects_1.ComponentTypes.PrivateApp,
|
|
28
|
+
serverInterface: ui_extensions_dev_server_1.DevModeInterface,
|
|
28
29
|
},
|
|
29
30
|
[SERVER_KEYS.publicApp]: {
|
|
30
|
-
componentType:
|
|
31
|
-
serverInterface: DevModeInterface,
|
|
31
|
+
componentType: Projects_1.ComponentTypes.PublicApp,
|
|
32
|
+
serverInterface: ui_extensions_dev_server_1.DevModeInterface,
|
|
32
33
|
},
|
|
33
34
|
};
|
|
34
35
|
}
|
|
@@ -42,7 +43,7 @@ class DevServerManager {
|
|
|
42
43
|
await callback(devServer.serverInterface, compatibleComponents);
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
|
-
logger.debug(i18n(`${i18nKey}.noCompatibleComponents`, { serverKey }));
|
|
46
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.noCompatibleComponents`, { serverKey }));
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -51,24 +52,30 @@ class DevServerManager {
|
|
|
51
52
|
if (!acc[component.type]) {
|
|
52
53
|
acc[component.type] = {};
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
if ('name' in component.config && component.config.name) {
|
|
56
|
+
acc[component.type][component.config.name] = component;
|
|
57
|
+
}
|
|
55
58
|
return acc;
|
|
56
59
|
}, {});
|
|
57
60
|
}
|
|
58
|
-
async setup({ components, onUploadRequired, accountId, setActiveApp }) {
|
|
61
|
+
async setup({ components, onUploadRequired, accountId, setActiveApp, }) {
|
|
59
62
|
this.componentsByType = this.arrangeComponentsByType(components);
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
let env;
|
|
64
|
+
const accountConfig = (0, config_1.getAccountConfig)(accountId);
|
|
65
|
+
if (accountConfig) {
|
|
66
|
+
env = accountConfig.env;
|
|
67
|
+
}
|
|
68
|
+
await (0, portManager_1.startPortManagerServer)();
|
|
62
69
|
await this.iterateDevServers(async (serverInterface, compatibleComponents) => {
|
|
63
70
|
if (serverInterface.setup) {
|
|
64
71
|
await serverInterface.setup({
|
|
65
72
|
components: compatibleComponents,
|
|
66
73
|
onUploadRequired,
|
|
67
|
-
promptUser,
|
|
68
|
-
logger,
|
|
74
|
+
promptUser: promptUtils_1.promptUser,
|
|
75
|
+
logger: logger_1.logger,
|
|
69
76
|
urls: {
|
|
70
|
-
api: getHubSpotApiOrigin(env),
|
|
71
|
-
web: getHubSpotWebsiteOrigin(env),
|
|
77
|
+
api: (0, urls_1.getHubSpotApiOrigin)(env),
|
|
78
|
+
web: (0, urls_1.getHubSpotWebsiteOrigin)(env),
|
|
72
79
|
},
|
|
73
80
|
setActiveApp,
|
|
74
81
|
});
|
|
@@ -76,24 +83,24 @@ class DevServerManager {
|
|
|
76
83
|
});
|
|
77
84
|
this.initialized = true;
|
|
78
85
|
}
|
|
79
|
-
async start({ accountId, projectConfig }) {
|
|
86
|
+
async start({ accountId, projectConfig, }) {
|
|
80
87
|
if (this.initialized) {
|
|
81
88
|
await this.iterateDevServers(async (serverInterface) => {
|
|
82
89
|
if (serverInterface.start) {
|
|
83
90
|
await serverInterface.start({
|
|
84
91
|
accountId,
|
|
85
92
|
projectConfig,
|
|
86
|
-
requestPorts,
|
|
93
|
+
requestPorts: portManager_1.requestPorts,
|
|
87
94
|
});
|
|
88
95
|
}
|
|
89
96
|
});
|
|
90
97
|
}
|
|
91
98
|
else {
|
|
92
|
-
throw new Error(i18n(`${i18nKey}.notInitialized`));
|
|
99
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.notInitialized`));
|
|
93
100
|
}
|
|
94
101
|
this.started = true;
|
|
95
102
|
}
|
|
96
|
-
fileChange({ filePath, event }) {
|
|
103
|
+
async fileChange({ filePath, event, }) {
|
|
97
104
|
if (this.started) {
|
|
98
105
|
this.iterateDevServers(async (serverInterface) => {
|
|
99
106
|
if (serverInterface.fileChange) {
|
|
@@ -109,8 +116,10 @@ class DevServerManager {
|
|
|
109
116
|
await serverInterface.cleanup();
|
|
110
117
|
}
|
|
111
118
|
});
|
|
112
|
-
await stopPortManagerServer();
|
|
119
|
+
await (0, portManager_1.stopPortManagerServer)();
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
}
|
|
116
|
-
|
|
123
|
+
const Manager = new DevServerManager();
|
|
124
|
+
exports.default = Manager;
|
|
125
|
+
module.exports = Manager;
|
package/lib/LocalDevManager.d.ts
CHANGED
|
@@ -1 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
import { FSWatcher } from 'chokidar';
|
|
2
|
+
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
+
import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
|
|
4
|
+
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
5
|
+
import { Component, ProjectConfig } from '../types/Projects';
|
|
6
|
+
type LocalDevManagerConstructorOptions = {
|
|
7
|
+
targetAccountId: number;
|
|
8
|
+
parentAccountId: number;
|
|
9
|
+
projectConfig: ProjectConfig;
|
|
10
|
+
projectDir: string;
|
|
11
|
+
projectId: number;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
deployedBuild: Build;
|
|
14
|
+
isGithubLinked: boolean;
|
|
15
|
+
runnableComponents: Component[];
|
|
16
|
+
env: Environment;
|
|
17
|
+
};
|
|
18
|
+
declare class LocalDevManager {
|
|
19
|
+
targetAccountId: number;
|
|
20
|
+
targetProjectAccountId: number;
|
|
21
|
+
projectConfig: ProjectConfig;
|
|
22
|
+
projectDir: string;
|
|
23
|
+
projectId: number;
|
|
24
|
+
debug: boolean;
|
|
25
|
+
deployedBuild: Build;
|
|
26
|
+
isGithubLinked: boolean;
|
|
27
|
+
watcher: FSWatcher | null;
|
|
28
|
+
uploadWarnings: {
|
|
29
|
+
[key: string]: boolean;
|
|
30
|
+
};
|
|
31
|
+
runnableComponents: Component[];
|
|
32
|
+
activeApp: Component | null;
|
|
33
|
+
activePublicAppData: PublicApp | null;
|
|
34
|
+
env: Environment;
|
|
35
|
+
publicAppActiveInstalls: number | null;
|
|
36
|
+
projectSourceDir: string;
|
|
37
|
+
mostRecentUploadWarning: string | null;
|
|
38
|
+
constructor(options: LocalDevManagerConstructorOptions);
|
|
39
|
+
setActiveApp(appUid?: string): Promise<void>;
|
|
40
|
+
setActivePublicAppData(): Promise<void>;
|
|
41
|
+
checkActivePublicAppInstalls(): Promise<void>;
|
|
42
|
+
start(): Promise<void>;
|
|
43
|
+
stop(showProgress?: boolean): Promise<void>;
|
|
44
|
+
checkPublicAppInstallation(): Promise<void>;
|
|
45
|
+
updateKeypressListeners(): void;
|
|
46
|
+
getUploadCommand(): string;
|
|
47
|
+
logUploadWarning(reason?: string): void;
|
|
48
|
+
monitorConsoleOutput(): void;
|
|
49
|
+
compareLocalProjectToDeployed(): void;
|
|
50
|
+
startWatching(): void;
|
|
51
|
+
stopWatching(): Promise<void>;
|
|
52
|
+
handleWatchEvent(filePath: string, event: string, configPaths: string[]): void;
|
|
53
|
+
devServerSetup(): Promise<boolean>;
|
|
54
|
+
devServerStart(): Promise<void>;
|
|
55
|
+
devServerFileChange(filePath: string, event: string): void;
|
|
56
|
+
devServerCleanup(): Promise<boolean>;
|
|
57
|
+
}
|
|
58
|
+
export default LocalDevManager;
|