@hubspot/local-dev-lib 3.14.0-beta.1 → 3.15.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/config/CLIConfiguration.d.ts +4 -0
- package/config/CLIConfiguration.js +34 -0
- package/config/config_DEPRECATED.d.ts +6 -0
- package/config/config_DEPRECATED.js +36 -1
- package/config/index.d.ts +4 -0
- package/config/index.js +35 -1
- package/config/migrate.js +6 -0
- package/lang/en.json +5 -0
- package/package.json +1 -1
- package/types/Config.d.ts +4 -0
|
@@ -61,8 +61,12 @@ declare class _CLIConfiguration {
|
|
|
61
61
|
* @throws {Error}
|
|
62
62
|
*/
|
|
63
63
|
updateAllowUsageTracking(isEnabled: boolean): CLIConfig_NEW | null;
|
|
64
|
+
updateAutoOpenBrowser(isEnabled: boolean): CLIConfig_NEW | null;
|
|
64
65
|
isTrackingAllowed(): boolean;
|
|
65
66
|
handleLegacyCmsPublishMode(config: CLIConfig_NEW | null): CLIConfig_NEW | null;
|
|
67
|
+
hasLocalStateFlag(flag: string): boolean;
|
|
68
|
+
addLocalStateFlag(flag: string): void;
|
|
69
|
+
removeLocalStateFlag(flag: string): void;
|
|
66
70
|
}
|
|
67
71
|
export declare const CLIConfiguration: _CLIConfiguration;
|
|
68
72
|
export {};
|
|
@@ -497,6 +497,18 @@ class _CLIConfiguration {
|
|
|
497
497
|
this.config.allowUsageTracking = isEnabled;
|
|
498
498
|
return this.write();
|
|
499
499
|
}
|
|
500
|
+
updateAutoOpenBrowser(isEnabled) {
|
|
501
|
+
if (!this.config) {
|
|
502
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noConfigLoaded`));
|
|
503
|
+
}
|
|
504
|
+
if (typeof isEnabled !== 'boolean') {
|
|
505
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.updateAutoOpenBrowser.errors.invalidInput`, {
|
|
506
|
+
isEnabled: `${isEnabled}`,
|
|
507
|
+
}));
|
|
508
|
+
}
|
|
509
|
+
this.config.autoOpenBrowser = isEnabled;
|
|
510
|
+
return this.write();
|
|
511
|
+
}
|
|
500
512
|
isTrackingAllowed() {
|
|
501
513
|
if (!this.config) {
|
|
502
514
|
return true;
|
|
@@ -510,5 +522,27 @@ class _CLIConfiguration {
|
|
|
510
522
|
}
|
|
511
523
|
return config;
|
|
512
524
|
}
|
|
525
|
+
hasLocalStateFlag(flag) {
|
|
526
|
+
if (!this.config) {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
return this.config.flags?.includes(flag) || false;
|
|
530
|
+
}
|
|
531
|
+
addLocalStateFlag(flag) {
|
|
532
|
+
if (!this.config) {
|
|
533
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noConfigLoaded`));
|
|
534
|
+
}
|
|
535
|
+
if (!this.hasLocalStateFlag(flag)) {
|
|
536
|
+
this.config.flags = [...(this.config.flags || []), flag];
|
|
537
|
+
}
|
|
538
|
+
this.write();
|
|
539
|
+
}
|
|
540
|
+
removeLocalStateFlag(flag) {
|
|
541
|
+
if (!this.config) {
|
|
542
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noConfigLoaded`));
|
|
543
|
+
}
|
|
544
|
+
this.config.flags = this.config.flags?.filter(f => f !== flag) || [];
|
|
545
|
+
this.write();
|
|
546
|
+
}
|
|
513
547
|
}
|
|
514
548
|
exports.CLIConfiguration = new _CLIConfiguration();
|
|
@@ -18,6 +18,8 @@ export declare function getOrderedConfig(unorderedConfig: CLIConfig_DEPRECATED):
|
|
|
18
18
|
defaultMode?: CmsPublishMode | undefined;
|
|
19
19
|
env?: Environment | undefined;
|
|
20
20
|
httpUseLocalhost?: boolean | undefined;
|
|
21
|
+
autoOpenBrowser?: boolean | undefined;
|
|
22
|
+
flags?: string[] | undefined;
|
|
21
23
|
defaultCmsPublishMode: CmsPublishMode | undefined;
|
|
22
24
|
httpTimeout: number | undefined;
|
|
23
25
|
allowUsageTracking: boolean | undefined;
|
|
@@ -60,6 +62,7 @@ export declare function updateAllowAutoUpdates(enabled: boolean): void;
|
|
|
60
62
|
* @throws {Error}
|
|
61
63
|
*/
|
|
62
64
|
export declare function updateAllowUsageTracking(isEnabled: boolean): void;
|
|
65
|
+
export declare function updateAutoOpenBrowser(isEnabled: boolean): void;
|
|
63
66
|
/**
|
|
64
67
|
* @throws {Error}
|
|
65
68
|
*/
|
|
@@ -79,3 +82,6 @@ export declare function loadConfigFromEnvironment({ useEnv, }?: {
|
|
|
79
82
|
portals: Array<CLIAccount_DEPRECATED>;
|
|
80
83
|
} | undefined;
|
|
81
84
|
export declare function isConfigFlagEnabled(flag: keyof CLIConfig_DEPRECATED): boolean;
|
|
85
|
+
export declare function hasLocalStateFlag(flag: string): boolean;
|
|
86
|
+
export declare function addLocalStateFlag(flag: string): void;
|
|
87
|
+
export declare function removeLocalStateFlag(flag: string): void;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isConfigFlagEnabled = exports.loadConfigFromEnvironment = exports.deleteConfigFile = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.deleteAccount = exports.renameAccount = exports.updateAllowUsageTracking = exports.updateAllowAutoUpdates = exports.updateHttpTimeout = exports.updateDefaultCmsPublishMode = exports.updateDefaultAccount = exports.updateAccountConfig = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.getAccountConfig = exports.getAccountType = exports.getEnv = exports.findConfig = exports.getAndLoadConfigIfNeeded = exports.isTrackingAllowed = exports.loadConfig = exports.writeConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.accountNameExistsInConfig = exports.validateConfig = exports.getConfigPath = exports.setConfigPath = exports.getConfigAccountId = exports.getConfigDefaultAccount = exports.getConfigAccounts = exports.setConfig = exports.getConfig = void 0;
|
|
6
|
+
exports.removeLocalStateFlag = exports.addLocalStateFlag = exports.hasLocalStateFlag = exports.isConfigFlagEnabled = exports.loadConfigFromEnvironment = exports.deleteConfigFile = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.deleteAccount = exports.renameAccount = exports.updateAutoOpenBrowser = exports.updateAllowUsageTracking = exports.updateAllowAutoUpdates = exports.updateHttpTimeout = exports.updateDefaultCmsPublishMode = exports.updateDefaultAccount = exports.updateAccountConfig = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.getAccountConfig = exports.getAccountType = exports.getEnv = exports.findConfig = exports.getAndLoadConfigIfNeeded = exports.isTrackingAllowed = exports.loadConfig = exports.writeConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.accountNameExistsInConfig = exports.validateConfig = exports.getConfigPath = exports.setConfigPath = exports.getConfigAccountId = exports.getConfigDefaultAccount = exports.getConfigAccounts = exports.setConfig = exports.getConfig = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
9
|
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
@@ -517,6 +517,16 @@ function updateAllowUsageTracking(isEnabled) {
|
|
|
517
517
|
writeConfig();
|
|
518
518
|
}
|
|
519
519
|
exports.updateAllowUsageTracking = updateAllowUsageTracking;
|
|
520
|
+
function updateAutoOpenBrowser(isEnabled) {
|
|
521
|
+
if (typeof isEnabled !== 'boolean') {
|
|
522
|
+
throw new Error(`Unable to update autoOpenBrowser. The value ${isEnabled} is invalid. The value must be a boolean.`);
|
|
523
|
+
}
|
|
524
|
+
const config = getAndLoadConfigIfNeeded();
|
|
525
|
+
config.autoOpenBrowser = isEnabled;
|
|
526
|
+
setDefaultConfigPathIfUnset();
|
|
527
|
+
writeConfig();
|
|
528
|
+
}
|
|
529
|
+
exports.updateAutoOpenBrowser = updateAutoOpenBrowser;
|
|
520
530
|
/**
|
|
521
531
|
* @throws {Error}
|
|
522
532
|
*/
|
|
@@ -703,3 +713,28 @@ function handleLegacyCmsPublishMode(config) {
|
|
|
703
713
|
}
|
|
704
714
|
return config;
|
|
705
715
|
}
|
|
716
|
+
function hasLocalStateFlag(flag) {
|
|
717
|
+
if (!_config) {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
return _config.flags?.includes(flag) || false;
|
|
721
|
+
}
|
|
722
|
+
exports.hasLocalStateFlag = hasLocalStateFlag;
|
|
723
|
+
function addLocalStateFlag(flag) {
|
|
724
|
+
if (!_config) {
|
|
725
|
+
throw new Error('No config loaded');
|
|
726
|
+
}
|
|
727
|
+
if (!hasLocalStateFlag(flag)) {
|
|
728
|
+
_config.flags = [...(_config.flags || []), flag];
|
|
729
|
+
}
|
|
730
|
+
writeConfig();
|
|
731
|
+
}
|
|
732
|
+
exports.addLocalStateFlag = addLocalStateFlag;
|
|
733
|
+
function removeLocalStateFlag(flag) {
|
|
734
|
+
if (!_config) {
|
|
735
|
+
throw new Error('No config loaded');
|
|
736
|
+
}
|
|
737
|
+
_config.flags = _config.flags?.filter(f => f !== flag) || [];
|
|
738
|
+
writeConfig();
|
|
739
|
+
}
|
|
740
|
+
exports.removeLocalStateFlag = removeLocalStateFlag;
|
package/config/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare function deleteAccount(accountName: string): Promise<void | boole
|
|
|
26
26
|
export declare function updateHttpTimeout(timeout: string): void;
|
|
27
27
|
export declare function updateAllowAutoUpdates(enabled: boolean): void;
|
|
28
28
|
export declare function updateAllowUsageTracking(isEnabled: boolean): void;
|
|
29
|
+
export declare function updateAutoOpenBrowser(isEnabled: boolean): void;
|
|
29
30
|
export declare function deleteConfigFile(): void;
|
|
30
31
|
export declare function isConfigFlagEnabled(flag: keyof CLIConfig): boolean;
|
|
31
32
|
export declare function isTrackingAllowed(): boolean;
|
|
@@ -37,6 +38,9 @@ export declare function getConfigAccounts(): Array<CLIAccount_NEW> | Array<CLIAc
|
|
|
37
38
|
export declare function updateDefaultCmsPublishMode(cmsPublishMode: CmsPublishMode): void | CLIConfig_NEW | null;
|
|
38
39
|
export declare function getCWDAccountOverride(): string | number | null | undefined;
|
|
39
40
|
export declare function getDefaultAccountOverrideFilePath(): string | null | undefined;
|
|
41
|
+
export declare function hasLocalStateFlag(flag: string): boolean;
|
|
42
|
+
export declare function addLocalStateFlag(flag: string): void;
|
|
43
|
+
export declare function removeLocalStateFlag(flag: string): void;
|
|
40
44
|
export declare const getConfigAccountId: typeof config_DEPRECATED.getConfigAccountId;
|
|
41
45
|
export declare const getOrderedAccount: typeof config_DEPRECATED.getOrderedAccount;
|
|
42
46
|
export declare const getOrderedConfig: typeof config_DEPRECATED.getOrderedConfig;
|
package/config/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.getDefaultAccountOverrideFilePath = exports.getCWDAccountOverride = exports.updateDefaultCmsPublishMode = exports.getConfigAccounts = exports.getDisplayDefaultAccount = exports.getConfigDefaultAccount = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAllowUsageTracking = exports.updateAllowAutoUpdates = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.configFileExists = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
|
|
26
|
+
exports.findConfig = exports.setConfigPath = exports.setConfig = exports.getOrderedConfig = exports.getOrderedAccount = exports.getConfigAccountId = exports.removeLocalStateFlag = exports.addLocalStateFlag = exports.hasLocalStateFlag = exports.getDefaultAccountOverrideFilePath = exports.getCWDAccountOverride = exports.updateDefaultCmsPublishMode = exports.getConfigAccounts = exports.getDisplayDefaultAccount = exports.getConfigDefaultAccount = exports.getAccountType = exports.getEnv = exports.isTrackingAllowed = exports.isConfigFlagEnabled = exports.deleteConfigFile = exports.updateAutoOpenBrowser = exports.updateAllowUsageTracking = exports.updateAllowAutoUpdates = exports.updateHttpTimeout = exports.deleteAccount = exports.removeSandboxAccountFromConfig = exports.getAccountId = exports.renameAccount = exports.updateDefaultAccount = exports.updateAccountConfig = exports.accountNameExistsInConfig = exports.getAccountConfig = exports.configFileExists = exports.getConfigPath = exports.writeConfig = exports.getConfig = exports.deleteEmptyConfigFile = exports.createEmptyConfigFile = exports.loadConfigFromEnvironment = exports.validateConfig = exports.getAndLoadConfigIfNeeded = exports.loadConfig = void 0;
|
|
27
27
|
const config_DEPRECATED = __importStar(require("./config_DEPRECATED"));
|
|
28
28
|
const CLIConfiguration_1 = require("./CLIConfiguration");
|
|
29
29
|
const configFile_1 = require("./configFile");
|
|
@@ -202,6 +202,15 @@ function updateAllowUsageTracking(isEnabled) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
exports.updateAllowUsageTracking = updateAllowUsageTracking;
|
|
205
|
+
function updateAutoOpenBrowser(isEnabled) {
|
|
206
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
207
|
+
CLIConfiguration_1.CLIConfiguration.updateAutoOpenBrowser(isEnabled);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
config_DEPRECATED.updateAutoOpenBrowser(isEnabled);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.updateAutoOpenBrowser = updateAutoOpenBrowser;
|
|
205
214
|
function deleteConfigFile() {
|
|
206
215
|
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
207
216
|
(0, configFile_1.deleteConfigFile)();
|
|
@@ -279,6 +288,31 @@ function getDefaultAccountOverrideFilePath() {
|
|
|
279
288
|
}
|
|
280
289
|
}
|
|
281
290
|
exports.getDefaultAccountOverrideFilePath = getDefaultAccountOverrideFilePath;
|
|
291
|
+
function hasLocalStateFlag(flag) {
|
|
292
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
293
|
+
return CLIConfiguration_1.CLIConfiguration.hasLocalStateFlag(flag);
|
|
294
|
+
}
|
|
295
|
+
return config_DEPRECATED.hasLocalStateFlag(flag);
|
|
296
|
+
}
|
|
297
|
+
exports.hasLocalStateFlag = hasLocalStateFlag;
|
|
298
|
+
function addLocalStateFlag(flag) {
|
|
299
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
300
|
+
CLIConfiguration_1.CLIConfiguration.addLocalStateFlag(flag);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
config_DEPRECATED.addLocalStateFlag(flag);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
exports.addLocalStateFlag = addLocalStateFlag;
|
|
307
|
+
function removeLocalStateFlag(flag) {
|
|
308
|
+
if (CLIConfiguration_1.CLIConfiguration.isActive()) {
|
|
309
|
+
CLIConfiguration_1.CLIConfiguration.removeLocalStateFlag(flag);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
config_DEPRECATED.removeLocalStateFlag(flag);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
exports.removeLocalStateFlag = removeLocalStateFlag;
|
|
282
316
|
// These functions are not supported with the new config setup
|
|
283
317
|
exports.getConfigAccountId = config_DEPRECATED.getConfigAccountId;
|
|
284
318
|
exports.getOrderedAccount = config_DEPRECATED.getOrderedAccount;
|
package/config/migrate.js
CHANGED
|
@@ -124,6 +124,12 @@ function mergeConfigProperties(globalConfig, deprecatedConfig, force) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
+
if (globalConfig.flags || deprecatedConfig.flags) {
|
|
128
|
+
globalConfig.flags = Array.from(new Set([
|
|
129
|
+
...(globalConfig.flags || []),
|
|
130
|
+
...(deprecatedConfig.flags || []),
|
|
131
|
+
]));
|
|
132
|
+
}
|
|
127
133
|
if (config_1.DEFAULT_ACCOUNT in globalConfig &&
|
|
128
134
|
config_1.DEFAULT_PORTAL in deprecatedConfig &&
|
|
129
135
|
globalConfig.defaultAccount !== deprecatedConfig.defaultPortal) {
|
package/lang/en.json
CHANGED
|
@@ -293,6 +293,11 @@
|
|
|
293
293
|
"errors": {
|
|
294
294
|
"invalidInput": "Unable to update allowUsageTracking. The value {{ isEnabled }} is invalid. The value must be a boolean."
|
|
295
295
|
}
|
|
296
|
+
},
|
|
297
|
+
"updateAutoOpenBrowser": {
|
|
298
|
+
"errors": {
|
|
299
|
+
"invalidInput": "Unable to update autoOpenBrowser. The value {{ isEnabled }} is invalid. The value must be a boolean."
|
|
300
|
+
}
|
|
296
301
|
}
|
|
297
302
|
},
|
|
298
303
|
"configFile": {
|
package/package.json
CHANGED
package/types/Config.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface CLIConfig_NEW {
|
|
|
12
12
|
httpTimeout?: number;
|
|
13
13
|
env?: Environment;
|
|
14
14
|
httpUseLocalhost?: boolean;
|
|
15
|
+
autoOpenBrowser?: boolean;
|
|
16
|
+
flags?: Array<string>;
|
|
15
17
|
}
|
|
16
18
|
export interface CLIConfig_DEPRECATED {
|
|
17
19
|
portals: Array<CLIAccount_DEPRECATED>;
|
|
@@ -23,6 +25,8 @@ export interface CLIConfig_DEPRECATED {
|
|
|
23
25
|
httpTimeout?: number;
|
|
24
26
|
env?: Environment;
|
|
25
27
|
httpUseLocalhost?: boolean;
|
|
28
|
+
autoOpenBrowser?: boolean;
|
|
29
|
+
flags?: Array<string>;
|
|
26
30
|
}
|
|
27
31
|
export type CLIConfig = CLIConfig_NEW | CLIConfig_DEPRECATED;
|
|
28
32
|
export type Environment = ValueOf<typeof ENVIRONMENTS> | '';
|