@hubspot/cli 7.4.8 → 7.4.9-beta.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.
Files changed (206) hide show
  1. package/commands/account/auth.d.ts +3 -7
  2. package/commands/account/auth.js +19 -9
  3. package/commands/account/clean.d.ts +3 -7
  4. package/commands/account/clean.js +16 -9
  5. package/commands/account/createOverride.d.ts +3 -7
  6. package/commands/account/createOverride.js +23 -6
  7. package/commands/account/info.d.ts +3 -7
  8. package/commands/account/info.js +13 -5
  9. package/commands/account/list.d.ts +3 -7
  10. package/commands/account/list.js +15 -8
  11. package/commands/account/remove.d.ts +3 -7
  12. package/commands/account/remove.js +21 -9
  13. package/commands/account/removeOverride.d.ts +3 -7
  14. package/commands/account/removeOverride.js +23 -6
  15. package/commands/account/rename.d.ts +3 -7
  16. package/commands/account/rename.js +16 -9
  17. package/commands/account/use.d.ts +5 -9
  18. package/commands/account/use.js +14 -6
  19. package/commands/account.d.ts +3 -4
  20. package/commands/account.js +35 -58
  21. package/commands/cms/convertFields.d.ts +7 -1
  22. package/commands/cms/convertFields.js +57 -41
  23. package/commands/cms/getReactModule.d.ts +7 -1
  24. package/commands/cms/getReactModule.js +52 -34
  25. package/commands/cms/lighthouseScore.d.ts +8 -1
  26. package/commands/cms/lighthouseScore.js +129 -100
  27. package/commands/cms.d.ts +3 -1
  28. package/commands/cms.js +24 -15
  29. package/commands/completion.d.ts +3 -1
  30. package/commands/completion.js +25 -12
  31. package/commands/config/migrate.d.ts +1 -1
  32. package/commands/config/migrate.js +16 -12
  33. package/commands/create/api-sample.d.ts +3 -1
  34. package/commands/create/api-sample.js +34 -38
  35. package/commands/create/app.d.ts +3 -1
  36. package/commands/create/app.js +9 -7
  37. package/commands/create/function.d.ts +3 -1
  38. package/commands/create/function.js +11 -10
  39. package/commands/create/index.d.ts +5 -1
  40. package/commands/create/index.js +23 -11
  41. package/commands/create/module.d.ts +3 -1
  42. package/commands/create/module.js +14 -13
  43. package/commands/create/react-app.d.ts +3 -1
  44. package/commands/create/react-app.js +10 -7
  45. package/commands/create/template.d.ts +3 -1
  46. package/commands/create/template.js +14 -14
  47. package/commands/create/vue-app.d.ts +3 -1
  48. package/commands/create/vue-app.js +10 -7
  49. package/commands/create/webpack-serverless.d.ts +3 -1
  50. package/commands/create/webpack-serverless.js +10 -7
  51. package/commands/create/website-theme.d.ts +3 -1
  52. package/commands/create/website-theme.js +10 -9
  53. package/commands/create.d.ts +4 -24
  54. package/commands/create.js +63 -74
  55. package/commands/customObject/create.d.ts +4 -9
  56. package/commands/customObject/create.js +17 -10
  57. package/commands/customObject/schema/create.d.ts +4 -9
  58. package/commands/customObject/schema/create.js +18 -11
  59. package/commands/customObject/schema/delete.d.ts +4 -9
  60. package/commands/customObject/schema/delete.js +17 -10
  61. package/commands/customObject/schema/fetch-all.d.ts +4 -9
  62. package/commands/customObject/schema/fetch-all.js +17 -10
  63. package/commands/customObject/schema/fetch.d.ts +4 -9
  64. package/commands/customObject/schema/fetch.js +17 -10
  65. package/commands/customObject/schema/list.d.ts +4 -8
  66. package/commands/customObject/schema/list.js +17 -10
  67. package/commands/customObject/schema/update.d.ts +4 -9
  68. package/commands/customObject/schema/update.js +18 -11
  69. package/commands/customObject/schema.d.ts +3 -5
  70. package/commands/customObject/schema.js +27 -54
  71. package/commands/customObject.d.ts +3 -4
  72. package/commands/customObject.js +20 -45
  73. package/commands/feedback.d.ts +4 -1
  74. package/commands/feedback.js +40 -47
  75. package/commands/fetch.d.ts +12 -1
  76. package/commands/fetch.js +49 -33
  77. package/commands/filemanager/fetch.d.ts +4 -9
  78. package/commands/filemanager/fetch.js +18 -11
  79. package/commands/filemanager/upload.d.ts +4 -9
  80. package/commands/filemanager/upload.js +17 -11
  81. package/commands/filemanager.d.ts +3 -4
  82. package/commands/filemanager.js +20 -41
  83. package/commands/function/deploy.d.ts +6 -1
  84. package/commands/function/deploy.js +70 -50
  85. package/commands/function/list.d.ts +6 -1
  86. package/commands/function/list.js +44 -32
  87. package/commands/function/server.d.ts +10 -1
  88. package/commands/function/server.js +49 -38
  89. package/commands/function.d.ts +5 -1
  90. package/commands/function.js +24 -10
  91. package/commands/hubdb/clear.d.ts +4 -9
  92. package/commands/hubdb/clear.js +17 -10
  93. package/commands/hubdb/create.d.ts +4 -9
  94. package/commands/hubdb/create.js +17 -10
  95. package/commands/hubdb/delete.d.ts +4 -9
  96. package/commands/hubdb/delete.js +17 -10
  97. package/commands/hubdb/fetch.d.ts +4 -9
  98. package/commands/hubdb/fetch.js +17 -10
  99. package/commands/hubdb.d.ts +3 -2
  100. package/commands/hubdb.js +23 -45
  101. package/commands/lint.d.ts +6 -4
  102. package/commands/lint.js +44 -43
  103. package/commands/logs.d.ts +10 -1
  104. package/commands/logs.js +53 -44
  105. package/commands/module/marketplace-validate.d.ts +6 -1
  106. package/commands/module/marketplace-validate.js +39 -27
  107. package/commands/module.d.ts +3 -1
  108. package/commands/module.js +22 -10
  109. package/commands/project/cloneApp.d.ts +1 -1
  110. package/commands/project/create.js +3 -3
  111. package/commands/project/deploy.d.ts +1 -0
  112. package/commands/project/deploy.js +40 -12
  113. package/commands/project/dev/index.d.ts +1 -4
  114. package/commands/project/dev/index.js +44 -15
  115. package/commands/project/dev/unifiedFlow.d.ts +2 -1
  116. package/commands/project/dev/unifiedFlow.js +52 -20
  117. package/commands/project/migrate.d.ts +1 -0
  118. package/commands/project/profile/add.d.ts +7 -0
  119. package/commands/project/profile/add.js +190 -0
  120. package/commands/project/profile/remove.d.ts +6 -0
  121. package/commands/project/profile/remove.js +119 -0
  122. package/commands/project/profile.d.ts +3 -0
  123. package/commands/project/profile.js +25 -0
  124. package/commands/project/upload.d.ts +1 -0
  125. package/commands/project/upload.js +38 -8
  126. package/commands/project.js +2 -0
  127. package/commands/sandbox/create.d.ts +4 -9
  128. package/commands/sandbox/create.js +18 -11
  129. package/commands/sandbox/delete.d.ts +4 -9
  130. package/commands/sandbox/delete.js +18 -11
  131. package/commands/sandbox.d.ts +3 -4
  132. package/commands/sandbox.js +20 -43
  133. package/commands/secret/addSecret.d.ts +4 -9
  134. package/commands/secret/addSecret.js +17 -10
  135. package/commands/secret/deleteSecret.d.ts +4 -9
  136. package/commands/secret/deleteSecret.js +17 -10
  137. package/commands/secret/listSecret.d.ts +4 -9
  138. package/commands/secret/listSecret.js +17 -10
  139. package/commands/secret/updateSecret.d.ts +4 -9
  140. package/commands/secret/updateSecret.js +17 -10
  141. package/commands/secret.d.ts +3 -4
  142. package/commands/secret.js +25 -48
  143. package/commands/theme/generate-selectors.d.ts +3 -7
  144. package/commands/theme/generate-selectors.js +14 -6
  145. package/commands/theme/marketplace-validate.d.ts +4 -9
  146. package/commands/theme/marketplace-validate.js +17 -10
  147. package/commands/theme/preview.d.ts +4 -9
  148. package/commands/theme/preview.js +16 -9
  149. package/commands/theme.d.ts +3 -4
  150. package/commands/theme.js +23 -46
  151. package/commands/upload.d.ts +12 -1
  152. package/commands/upload.js +118 -97
  153. package/commands/watch.d.ts +14 -1
  154. package/commands/watch.js +76 -65
  155. package/lang/en.d.ts +654 -558
  156. package/lang/en.js +443 -353
  157. package/lang/en.lyaml +23 -13
  158. package/lib/app/migrate.d.ts +23 -0
  159. package/lib/app/migrate.js +14 -3
  160. package/lib/app/migrate_legacy.js +5 -5
  161. package/lib/configMigrate.js +24 -10
  162. package/lib/constants.d.ts +6 -0
  163. package/lib/constants.js +7 -1
  164. package/lib/errorHandlers/suppressError.js +12 -19
  165. package/lib/filesystem.d.ts +1 -1
  166. package/lib/interpolation.d.ts +2 -3
  167. package/lib/lang.d.ts +2 -3
  168. package/lib/middleware/configMiddleware.js +8 -0
  169. package/lib/projectProfiles.d.ts +6 -0
  170. package/lib/projectProfiles.js +65 -0
  171. package/lib/projects/buildAndDeploy.js +17 -2
  172. package/lib/projects/localDev/AppDevModeInterface.d.ts +25 -0
  173. package/lib/projects/localDev/AppDevModeInterface.js +117 -0
  174. package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
  175. package/lib/projects/localDev/DevServerManagerV2.js +19 -15
  176. package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
  177. package/lib/projects/localDev/LocalDevLogger.js +158 -0
  178. package/lib/projects/localDev/LocalDevManager.js +2 -3
  179. package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
  180. package/lib/projects/localDev/LocalDevProcess.js +171 -0
  181. package/lib/projects/localDev/LocalDevState.d.ts +37 -0
  182. package/lib/projects/localDev/LocalDevState.js +78 -0
  183. package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
  184. package/lib/projects/localDev/LocalDevWatcher.js +56 -0
  185. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
  186. package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
  187. package/lib/projects/localDev/helpers.d.ts +1 -1
  188. package/lib/projects/localDev/helpers.js +2 -1
  189. package/lib/projects/upload.d.ts +2 -1
  190. package/lib/projects/upload.js +2 -2
  191. package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
  192. package/lib/prompts/createTemplatePrompt.d.ts +22 -4
  193. package/lib/testUtils.d.ts +3 -3
  194. package/lib/testUtils.js +8 -9
  195. package/lib/upload.d.ts +1 -1
  196. package/lib/validation.js +4 -5
  197. package/lib/yargsUtils.d.ts +4 -0
  198. package/lib/yargsUtils.js +6 -0
  199. package/package.json +5 -3
  200. package/types/Cms.d.ts +30 -0
  201. package/types/Cms.js +2 -0
  202. package/types/LocalDev.d.ts +24 -0
  203. package/types/LocalDev.js +2 -0
  204. package/types/Yargs.d.ts +8 -1
  205. package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
  206. package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
@@ -0,0 +1,37 @@
1
+ import { Build } from '@hubspot/local-dev-lib/types/Build';
2
+ import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
3
+ import { Environment } from '@hubspot/local-dev-lib/types/Config';
4
+ import { ProjectConfig } from '../../../types/Projects';
5
+ import { LocalDevStateConstructorOptions, LocalDevStateListener } from '../../../types/LocalDev';
6
+ declare class LocalDevState {
7
+ private _targetProjectAccountId;
8
+ private _targetTestingAccountId;
9
+ private _projectConfig;
10
+ private _projectDir;
11
+ private _projectId;
12
+ private _debug;
13
+ private _deployedBuild?;
14
+ private _isGithubLinked;
15
+ private _projectNodes;
16
+ private _env;
17
+ private _listeners;
18
+ constructor({ targetProjectAccountId, targetTestingAccountId, projectConfig, projectDir, projectId, debug, deployedBuild, isGithubLinked, initialProjectNodes, env, }: LocalDevStateConstructorOptions);
19
+ private runListeners;
20
+ get targetProjectAccountId(): number;
21
+ get targetTestingAccountId(): number;
22
+ get projectConfig(): ProjectConfig;
23
+ get projectDir(): string;
24
+ get projectId(): number;
25
+ get debug(): boolean;
26
+ get deployedBuild(): Build | undefined;
27
+ get isGithubLinked(): boolean;
28
+ get projectNodes(): {
29
+ [key: string]: IntermediateRepresentationNodeLocalDev;
30
+ };
31
+ set projectNodes(nodes: {
32
+ [key: string]: IntermediateRepresentationNodeLocalDev;
33
+ });
34
+ get env(): Environment;
35
+ addListener<K extends keyof LocalDevState>(key: K, listener: LocalDevStateListener<K>): void;
36
+ }
37
+ export default LocalDevState;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class LocalDevState {
4
+ _targetProjectAccountId;
5
+ _targetTestingAccountId;
6
+ _projectConfig;
7
+ _projectDir;
8
+ _projectId;
9
+ _debug;
10
+ _deployedBuild;
11
+ _isGithubLinked;
12
+ _projectNodes;
13
+ _env;
14
+ _listeners;
15
+ constructor({ targetProjectAccountId, targetTestingAccountId, projectConfig, projectDir, projectId, debug, deployedBuild, isGithubLinked, initialProjectNodes, env, }) {
16
+ this._targetProjectAccountId = targetProjectAccountId;
17
+ this._targetTestingAccountId = targetTestingAccountId;
18
+ this._projectConfig = projectConfig;
19
+ this._projectDir = projectDir;
20
+ this._projectId = projectId;
21
+ this._debug = debug || false;
22
+ this._deployedBuild = deployedBuild;
23
+ this._isGithubLinked = isGithubLinked;
24
+ this._projectNodes = initialProjectNodes;
25
+ this._env = env;
26
+ this._listeners = {};
27
+ }
28
+ runListeners(key) {
29
+ if (this._listeners[key] && this._listeners[key].length) {
30
+ this._listeners[key].forEach(listener => listener(this[key]));
31
+ }
32
+ }
33
+ get targetProjectAccountId() {
34
+ return this._targetProjectAccountId;
35
+ }
36
+ get targetTestingAccountId() {
37
+ return this._targetTestingAccountId;
38
+ }
39
+ get projectConfig() {
40
+ return {
41
+ ...this._projectConfig,
42
+ };
43
+ }
44
+ get projectDir() {
45
+ return this._projectDir;
46
+ }
47
+ get projectId() {
48
+ return this._projectId;
49
+ }
50
+ get debug() {
51
+ return this._debug;
52
+ }
53
+ get deployedBuild() {
54
+ return (this._deployedBuild && {
55
+ ...this._deployedBuild,
56
+ });
57
+ }
58
+ get isGithubLinked() {
59
+ return this._isGithubLinked;
60
+ }
61
+ get projectNodes() {
62
+ return { ...this._projectNodes };
63
+ }
64
+ set projectNodes(nodes) {
65
+ this._projectNodes = nodes;
66
+ this.runListeners('projectNodes');
67
+ }
68
+ get env() {
69
+ return this._env;
70
+ }
71
+ addListener(key, listener) {
72
+ if (!this._listeners[key]) {
73
+ this._listeners[key] = [];
74
+ }
75
+ this._listeners[key].push(listener);
76
+ }
77
+ }
78
+ exports.default = LocalDevState;
@@ -0,0 +1,10 @@
1
+ import LocalDevProcess from './LocalDevProcess';
2
+ declare class LocalDevWatcher {
3
+ private localDevProcess;
4
+ private watcher;
5
+ constructor(localDevProcess: LocalDevProcess);
6
+ private handleWatchEvent;
7
+ start(): void;
8
+ stop(): Promise<void>;
9
+ }
10
+ export default LocalDevWatcher;
@@ -0,0 +1,56 @@
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
+ const path_1 = __importDefault(require("path"));
7
+ const chokidar_1 = __importDefault(require("chokidar"));
8
+ const constants_1 = require("../../constants");
9
+ const WATCH_EVENTS = {
10
+ add: 'add',
11
+ change: 'change',
12
+ unlink: 'unlink',
13
+ unlinkDir: 'unlinkDir',
14
+ };
15
+ class LocalDevWatcher {
16
+ localDevProcess;
17
+ watcher;
18
+ constructor(localDevProcess) {
19
+ this.localDevProcess = localDevProcess;
20
+ this.watcher = null;
21
+ }
22
+ async handleWatchEvent(filePath, event, configPaths) {
23
+ await this.localDevProcess.updateProjectNodes();
24
+ if (configPaths.includes(filePath)) {
25
+ this.localDevProcess.logger.uploadWarning();
26
+ }
27
+ else {
28
+ this.localDevProcess.handleFileChange(filePath, event);
29
+ }
30
+ }
31
+ start() {
32
+ this.watcher = chokidar_1.default.watch(this.localDevProcess.projectDir, {
33
+ ignoreInitial: true,
34
+ ignored: ['**/dist'],
35
+ });
36
+ const configPaths = Object.values(this.localDevProcess.projectNodes).map(component => component.localDev.componentConfigPath);
37
+ const projectConfigPath = path_1.default.join(this.localDevProcess.projectDir, constants_1.PROJECT_CONFIG_FILE);
38
+ configPaths.push(projectConfigPath);
39
+ this.watcher.on('add', filePath => {
40
+ this.handleWatchEvent(filePath, WATCH_EVENTS.add, configPaths);
41
+ });
42
+ this.watcher.on('change', filePath => {
43
+ this.handleWatchEvent(filePath, WATCH_EVENTS.change, configPaths);
44
+ });
45
+ this.watcher.on('unlink', filePath => {
46
+ this.handleWatchEvent(filePath, WATCH_EVENTS.unlink, configPaths);
47
+ });
48
+ this.watcher.on('unlinkDir', filePath => {
49
+ this.handleWatchEvent(filePath, WATCH_EVENTS.unlinkDir, configPaths);
50
+ });
51
+ }
52
+ async stop() {
53
+ await this.watcher?.close();
54
+ }
55
+ }
56
+ exports.default = LocalDevWatcher;
@@ -0,0 +1,17 @@
1
+ import LocalDevProcess from './LocalDevProcess';
2
+ declare class LocalDevWebsocketServer {
3
+ private server?;
4
+ private _websocket?;
5
+ private debug?;
6
+ private localDevProcess;
7
+ constructor(localDevProcess: LocalDevProcess, debug?: boolean);
8
+ private websocket;
9
+ private log;
10
+ private logError;
11
+ private sendMessage;
12
+ private setupMessageHandlers;
13
+ private setupStateListeners;
14
+ start(): Promise<void>;
15
+ shutdown(): void;
16
+ }
17
+ export default LocalDevWebsocketServer;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ws_1 = require("ws");
4
+ const portManager_1 = require("@hubspot/local-dev-lib/portManager");
5
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
6
+ const constants_1 = require("../../constants");
7
+ const en_1 = require("../../../lang/en");
8
+ const SERVER_INSTANCE_ID = 'local-dev-ui-websocket-server';
9
+ const LOG_PREFIX = '[LocalDevWebsocketServer]';
10
+ class LocalDevWebsocketServer {
11
+ server;
12
+ _websocket;
13
+ debug;
14
+ localDevProcess;
15
+ constructor(localDevProcess, debug) {
16
+ this.localDevProcess = localDevProcess;
17
+ this.debug = debug;
18
+ }
19
+ websocket() {
20
+ if (!this._websocket) {
21
+ throw new Error(en_1.lib.LocalDevWebsocketServer.errors.notInitialized(LOG_PREFIX));
22
+ }
23
+ return this._websocket;
24
+ }
25
+ log(message) {
26
+ if (this.debug) {
27
+ logger_1.logger.log(LOG_PREFIX, message);
28
+ }
29
+ }
30
+ logError(message) {
31
+ if (this.debug) {
32
+ logger_1.logger.error(LOG_PREFIX, message);
33
+ }
34
+ }
35
+ sendMessage(message) {
36
+ this.websocket().send(JSON.stringify(message));
37
+ }
38
+ setupMessageHandlers() {
39
+ this.websocket().on('message', data => {
40
+ try {
41
+ const message = JSON.parse(data.toString());
42
+ if (!message.type) {
43
+ this.logError(en_1.lib.LocalDevWebsocketServer.errors.missingTypeField(data.toString()));
44
+ return;
45
+ }
46
+ switch (message.type) {
47
+ case constants_1.LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES.UPLOAD:
48
+ this.localDevProcess.uploadProject();
49
+ break;
50
+ case constants_1.LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES.INSTALL_DEPS:
51
+ break;
52
+ case constants_1.LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES.APP_INSTALLED:
53
+ break;
54
+ default:
55
+ this.logError(en_1.lib.LocalDevWebsocketServer.errors.unknownMessageType(message.type));
56
+ }
57
+ }
58
+ catch (e) {
59
+ this.logError(en_1.lib.LocalDevWebsocketServer.errors.invalidJSON(data.toString()));
60
+ }
61
+ });
62
+ }
63
+ setupStateListeners() {
64
+ this.localDevProcess.addStateListener('projectNodes', nodes => {
65
+ this.sendMessage({
66
+ type: constants_1.LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES.UPDATE_PROJECT_NODES,
67
+ data: nodes,
68
+ });
69
+ });
70
+ }
71
+ async start() {
72
+ const portManagerIsRunning = await (0, portManager_1.isPortManagerServerRunning)();
73
+ if (!portManagerIsRunning) {
74
+ throw new Error(en_1.lib.LocalDevWebsocketServer.errors.portManagerNotRunning(LOG_PREFIX));
75
+ }
76
+ const portData = await (0, portManager_1.requestPorts)([{ instanceId: SERVER_INSTANCE_ID }]);
77
+ const port = portData[SERVER_INSTANCE_ID];
78
+ this.server = new ws_1.WebSocketServer({ port });
79
+ this.log(en_1.lib.LocalDevWebsocketServer.logs.startup(port));
80
+ this.server.on('connection', ws => {
81
+ this._websocket = ws;
82
+ this.setupMessageHandlers();
83
+ this.setupStateListeners();
84
+ });
85
+ }
86
+ shutdown() {
87
+ this.server?.close();
88
+ this.server = undefined;
89
+ this._websocket = undefined;
90
+ }
91
+ }
92
+ exports.default = LocalDevWebsocketServer;
@@ -14,6 +14,6 @@ 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, sendIR?: boolean): Promise<Build>;
17
+ export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIR?: boolean, profile?: string): Promise<Build>;
18
18
  export declare function getAccountHomeUrl(accountId: number): string;
19
19
  export declare function hasSandboxes(account: CLIAccount): Promise<boolean>;
@@ -253,7 +253,7 @@ function projectUploadCallback(accountId, projectConfig, tempFile, buildId) {
253
253
  }
254
254
  // Create an initial build if the project was newly created in the account
255
255
  // Return the newly deployed build
256
- async function createInitialBuildForNewProject(projectConfig, projectDir, targetAccountId, sendIR) {
256
+ async function createInitialBuildForNewProject(projectConfig, projectDir, targetAccountId, sendIR, profile) {
257
257
  const { result: initialUploadResult, uploadError } = await (0, upload_1.handleProjectUpload)({
258
258
  accountId: targetAccountId,
259
259
  projectConfig,
@@ -264,6 +264,7 @@ async function createInitialBuildForNewProject(projectConfig, projectDir, target
264
264
  forceCreate: true,
265
265
  skipValidation: true,
266
266
  sendIR,
267
+ profile,
267
268
  });
268
269
  if (uploadError) {
269
270
  if ((0, index_1.isSpecifiedError)(uploadError, {
@@ -15,6 +15,7 @@ type HandleProjectUploadArg<T> = {
15
15
  isUploadCommand?: boolean;
16
16
  sendIR?: boolean;
17
17
  skipValidation?: boolean;
18
+ profile?: string;
18
19
  };
19
- export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
20
+ export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
20
21
  export {};
@@ -46,7 +46,7 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
46
46
  }
47
47
  return { buildId, error };
48
48
  }
49
- async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, }) {
49
+ async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, }) {
50
50
  const srcDir = path_1.default.resolve(projectDir, projectConfig.srcDir);
51
51
  const filenames = fs_extra_1.default.readdirSync(srcDir);
52
52
  if (!filenames || filenames.length === 0) {
@@ -66,7 +66,7 @@ async function handleProjectUpload({ accountId, projectConfig, projectDir, callb
66
66
  projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
67
67
  platformVersion: projectConfig.platformVersion,
68
68
  accountId,
69
- }, { skipValidation });
69
+ }, { skipValidation, profile });
70
70
  logger_1.uiLogger.debug(node_util_1.default.inspect(intermediateRepresentation, false, null, true));
71
71
  }
72
72
  catch (e) {
@@ -1,12 +1,4 @@
1
- type SampleChoice = {
2
- name: string;
3
- description: string;
4
- id: string;
5
- languages: string[];
6
- };
7
- type SampleConfig = {
8
- samples: SampleChoice[];
9
- };
1
+ import { ApiSampleConfig } from '../../types/Cms';
10
2
  type SampleTypePromptResponse = {
11
3
  sampleType?: string;
12
4
  };
@@ -14,5 +6,5 @@ type LanguagePromptResponse = {
14
6
  sampleLanguage?: string;
15
7
  };
16
8
  type CreateApiSamplePromptResponse = SampleTypePromptResponse & LanguagePromptResponse;
17
- export declare function createApiSamplePrompt(samplesConfig: SampleConfig): Promise<CreateApiSamplePromptResponse>;
9
+ export declare function createApiSamplePrompt(samplesConfig: ApiSampleConfig): Promise<CreateApiSamplePromptResponse>;
18
10
  export {};
@@ -1,7 +1,25 @@
1
- declare const templateTypeChoices: {
2
- name: string;
3
- value: string;
4
- }[];
1
+ declare const templateTypeChoices: [{
2
+ readonly name: "page";
3
+ readonly value: "page-template";
4
+ }, {
5
+ readonly name: "email";
6
+ readonly value: "email-template";
7
+ }, {
8
+ readonly name: "partial";
9
+ readonly value: "partial";
10
+ }, {
11
+ readonly name: "global partial";
12
+ readonly value: "global-partial";
13
+ }, {
14
+ readonly name: "blog listing";
15
+ readonly value: "blog-listing-template";
16
+ }, {
17
+ readonly name: "blog post";
18
+ readonly value: "blog-post-template";
19
+ }, {
20
+ readonly name: "search results";
21
+ readonly value: "search-template";
22
+ }];
5
23
  interface CreateTemplatePromptResponse {
6
24
  templateType: (typeof templateTypeChoices)[number]['value'];
7
25
  }
@@ -1,4 +1,4 @@
1
- import { AxiosResponse } from 'axios';
1
+ import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
2
2
  import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
3
3
  type MockErrorResponse = {
4
4
  status: number;
@@ -9,6 +9,6 @@ type MockErrorResponse = {
9
9
  subCategory?: string;
10
10
  };
11
11
  };
12
- export declare const mockHubSpotHttpResponse: (data: any) => AxiosResponse;
13
- export declare const mockHubSpotHttpError: (message: string, response: MockErrorResponse) => HubSpotHttpError;
12
+ export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
13
+ export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
14
14
  export {};
package/lib/testUtils.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockHubSpotHttpError = exports.mockHubSpotHttpResponse = void 0;
3
+ exports.mockHubSpotHttpResponse = mockHubSpotHttpResponse;
4
+ exports.mockHubSpotHttpError = mockHubSpotHttpError;
4
5
  const axios_1 = require("axios");
5
6
  const HubSpotHttpError_1 = require("@hubspot/local-dev-lib/models/HubSpotHttpError");
6
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- const mockHubSpotHttpResponse = (data) => {
8
- return {
8
+ function mockHubSpotHttpResponse(data) {
9
+ return Promise.resolve({
9
10
  data,
10
11
  status: 200,
11
12
  statusText: 'OK',
@@ -13,12 +14,10 @@ const mockHubSpotHttpResponse = (data) => {
13
14
  config: {
14
15
  headers: new axios_1.AxiosHeaders(),
15
16
  },
16
- };
17
- };
18
- exports.mockHubSpotHttpResponse = mockHubSpotHttpResponse;
19
- const mockHubSpotHttpError = (message, response) => {
17
+ });
18
+ }
19
+ function mockHubSpotHttpError(message, response) {
20
20
  return new HubSpotHttpError_1.HubSpotHttpError(message, {
21
21
  cause: { isAxiosError: true, response },
22
22
  });
23
- };
24
- exports.mockHubSpotHttpError = mockHubSpotHttpError;
23
+ }
package/lib/upload.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function getUploadableFileList(src: string, convertFields: boolean): Promise<string[]>;
1
+ export declare function getUploadableFileList(src: string, convertFields?: boolean): Promise<string[]>;
package/lib/validation.js CHANGED
@@ -145,28 +145,27 @@ function validateCmsPublishMode(options) {
145
145
  return false;
146
146
  }
147
147
  function fileExists(_path) {
148
- let isFile;
149
148
  try {
150
149
  const absoluteSrcPath = path.resolve((0, path_1.getCwd)(), _path);
151
150
  if (!absoluteSrcPath)
152
151
  return false;
153
152
  const stats = fs.statSync(absoluteSrcPath);
154
- isFile = stats.isFile();
153
+ const isFile = stats.isFile();
155
154
  if (!isFile) {
156
- logger_1.logger.error(`The path "${_path}" is not a path to a file`);
157
155
  return false;
158
156
  }
159
157
  }
160
158
  catch (e) {
161
- logger_1.logger.error(`The path "${_path}" is not a path to a file`);
162
159
  return false;
163
160
  }
164
161
  return true;
165
162
  }
166
163
  function checkAndConvertToJson(_path) {
167
164
  const filePath = (0, path_1.getAbsoluteFilePath)(_path);
168
- if (!fileExists(filePath))
165
+ if (!fileExists(filePath)) {
166
+ logger_1.logger.error(`The path "${_path}" is not a path to a file`);
169
167
  return null;
168
+ }
170
169
  if ((0, path_1.getExt)(_path) !== 'json') {
171
170
  logger_1.logger.error(`The file "${_path}" must be a valid JSON file`);
172
171
  return null;
@@ -6,4 +6,8 @@ export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>,
6
6
  useConfigOptions?: boolean;
7
7
  useEnvironmentOptions?: boolean;
8
8
  useTestingOptions?: boolean;
9
+ useCmsPublishModeOptions?: boolean | {
10
+ read?: boolean;
11
+ write?: boolean;
12
+ };
9
13
  }): (yargs: Argv) => Promise<Argv<T>>;
package/lib/yargsUtils.js CHANGED
@@ -32,6 +32,12 @@ function makeYargsBuilder(callback, command, describe, options = {}) {
32
32
  if (options.useTestingOptions) {
33
33
  (0, commonOpts_1.addTestingOptions)(yargs);
34
34
  }
35
+ if (options.useCmsPublishModeOptions) {
36
+ const opts = typeof options.useCmsPublishModeOptions === 'object'
37
+ ? options.useCmsPublishModeOptions
38
+ : { write: true };
39
+ (0, commonOpts_1.addCmsPublishModeOptions)(yargs, opts);
40
+ }
35
41
  const result = callback(yargs);
36
42
  // Must go last to pick up available options
37
43
  await (0, commonOpts_1.addCustomHelpOutput)(result, command, describe);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.4.8",
3
+ "version": "7.4.9-beta.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
- "@hubspot/local-dev-lib": "3.5.5",
9
- "@hubspot/project-parsing-lib": "0.1.7",
8
+ "@hubspot/local-dev-lib": "3.6.0",
9
+ "@hubspot/project-parsing-lib": "0.2.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.52",
@@ -28,6 +28,7 @@
28
28
  "table": "6.9.0",
29
29
  "tmp": "0.2.3",
30
30
  "update-notifier": "5.1.0",
31
+ "ws": "^8.18.2",
31
32
  "yargs": "17.7.2",
32
33
  "yargs-parser": "21.1.1"
33
34
  },
@@ -41,6 +42,7 @@
41
42
  "@types/js-yaml": "^4.0.9",
42
43
  "@types/semver": "^7.5.8",
43
44
  "@types/tmp": "^0.2.6",
45
+ "@types/ws": "^8.18.1",
44
46
  "@types/yargs": "^17.0.33",
45
47
  "@typescript-eslint/eslint-plugin": "^8.30.1",
46
48
  "@typescript-eslint/parser": "^8.11.0",
package/types/Cms.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { CommonArgs, ConfigArgs } from './Yargs';
2
+ export type CreateArgs = CommonArgs & ConfigArgs & {
3
+ branch?: string;
4
+ type: string;
5
+ dest: string;
6
+ name: string;
7
+ internal?: boolean;
8
+ };
9
+ export type CmsAssetOperationArgs = {
10
+ assetType: string;
11
+ name: string;
12
+ dest: string;
13
+ getInternalVersion: boolean;
14
+ commandArgs: CreateArgs;
15
+ };
16
+ export type CreatableCmsAsset = {
17
+ hidden: boolean;
18
+ dest: (args: CmsAssetOperationArgs) => string;
19
+ validate?: (args: CmsAssetOperationArgs) => boolean;
20
+ execute: (args: CmsAssetOperationArgs) => Promise<void>;
21
+ };
22
+ export type ApiSampleChoice = {
23
+ name: string;
24
+ description: string;
25
+ id: string;
26
+ languages: string[];
27
+ };
28
+ export type ApiSampleConfig = {
29
+ samples: ApiSampleChoice[];
30
+ };
package/types/Cms.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
2
+ import { Build } from '@hubspot/local-dev-lib/types/Build';
3
+ import { Environment } from '@hubspot/local-dev-lib/types/Config';
4
+ import { ProjectConfig } from './Projects';
5
+ import LocalDevState from '../lib/projects/localDev/LocalDevState';
6
+ export type LocalDevStateConstructorOptions = {
7
+ targetProjectAccountId: number;
8
+ targetTestingAccountId: number;
9
+ projectConfig: ProjectConfig;
10
+ projectDir: string;
11
+ projectId: number;
12
+ debug?: boolean;
13
+ deployedBuild?: Build;
14
+ isGithubLinked: boolean;
15
+ initialProjectNodes: {
16
+ [key: string]: IntermediateRepresentationNodeLocalDev;
17
+ };
18
+ env: Environment;
19
+ };
20
+ export type LocalDevWebsocketMessage = {
21
+ type: string;
22
+ data: unknown;
23
+ };
24
+ export type LocalDevStateListener<K extends keyof LocalDevState> = (value: LocalDevState[K]) => void;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/types/Yargs.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Options, CommandModule, Argv } from 'yargs';
2
+ import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
2
3
  export type CommonArgs = {
3
4
  derivedAccountId: number;
4
5
  providedAccountId?: number;
@@ -23,10 +24,16 @@ export type OverwriteArgs = Options & {
23
24
  export type StringArgType = Options & {
24
25
  type: 'string';
25
26
  };
26
- export type ProjectDevArgs = CommonArgs & ConfigArgs & EnvironmentArgs;
27
+ export type ProjectDevArgs = CommonArgs & ConfigArgs & EnvironmentArgs & {
28
+ profile?: string;
29
+ };
27
30
  export type TestingArgs = {
28
31
  qa?: boolean;
29
32
  };
33
+ export type CmsPublishModeArgs = {
34
+ 'cms-publish-mode'?: CmsPublishMode;
35
+ m?: CmsPublishMode;
36
+ };
30
37
  export interface YargsCommandModule<T, U> extends CommandModule<T, U> {
31
38
  builder: (yargs: Argv) => Promise<Argv<U>>;
32
39
  }