@hubspot/local-dev-lib 0.5.0-experimental.3 → 0.5.0-experimental.5
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/index.d.ts +1 -0
- package/config/index.js +17 -3
- package/package.json +1 -2
package/config/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CmsPublishMode } from '../types/Files';
|
|
|
4
4
|
import { Environment } from '../types/Config';
|
|
5
5
|
export declare function localConfigFileExists(): boolean;
|
|
6
6
|
export declare function globalConfigFileExists(): boolean;
|
|
7
|
+
export declare function configFileExists(): boolean;
|
|
7
8
|
export declare function getConfigFilePath(): string;
|
|
8
9
|
export declare function getConfig(): HubSpotConfig;
|
|
9
10
|
export declare function isConfigValid(): boolean;
|
package/config/index.js
CHANGED
|
@@ -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.removeLocalStateFlag = exports.addLocalStateFlag = exports.hasLocalStateFlag = exports.isConfigFlagEnabled = exports.updateDefaultCmsPublishMode = exports.updateAutoOpenBrowser = exports.updateAllowAutoUpdates = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.removeAccountFromConfig = exports.renameConfigAccount = exports.setConfigAccountAsDefault = exports.updateConfigAccount = exports.addConfigAccount = exports.getConfigAccountEnvironment = exports.getAllConfigAccounts = exports.getConfigDefaultAccountIfExists = exports.getConfigDefaultAccount = exports.getConfigAccountIfExists = exports.getConfigAccountByName = exports.getConfigAccountById = exports.deleteConfigFile = exports.createEmptyConfigFile = exports.isConfigValid = exports.getConfig = exports.getConfigFilePath = exports.globalConfigFileExists = exports.localConfigFileExists = void 0;
|
|
6
|
+
exports.removeLocalStateFlag = exports.addLocalStateFlag = exports.hasLocalStateFlag = exports.isConfigFlagEnabled = exports.updateDefaultCmsPublishMode = exports.updateAutoOpenBrowser = exports.updateAllowAutoUpdates = exports.updateAllowUsageTracking = exports.updateHttpTimeout = exports.removeAccountFromConfig = exports.renameConfigAccount = exports.setConfigAccountAsDefault = exports.updateConfigAccount = exports.addConfigAccount = exports.getConfigAccountEnvironment = exports.getAllConfigAccounts = exports.getConfigDefaultAccountIfExists = exports.getConfigDefaultAccount = exports.getConfigAccountIfExists = exports.getConfigAccountByName = exports.getConfigAccountById = exports.deleteConfigFile = exports.createEmptyConfigFile = exports.isConfigValid = exports.getConfig = exports.getConfigFilePath = exports.configFileExists = exports.globalConfigFileExists = exports.localConfigFileExists = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const config_1 = require("../constants/config");
|
|
9
9
|
const logger_1 = require("../lib/logger");
|
|
@@ -22,6 +22,15 @@ function globalConfigFileExists() {
|
|
|
22
22
|
return fs_extra_1.default.existsSync((0, utils_1.getGlobalConfigFilePath)());
|
|
23
23
|
}
|
|
24
24
|
exports.globalConfigFileExists = globalConfigFileExists;
|
|
25
|
+
function configFileExists() {
|
|
26
|
+
try {
|
|
27
|
+
return fs_extra_1.default.existsSync(getConfigFilePath());
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.configFileExists = configFileExists;
|
|
25
34
|
function getConfigDefaultFilePath() {
|
|
26
35
|
const globalConfigFilePath = (0, utils_1.getGlobalConfigFilePath)();
|
|
27
36
|
if (fs_extra_1.default.existsSync(globalConfigFilePath)) {
|
|
@@ -135,7 +144,9 @@ exports.getConfigAccountIfExists = getConfigAccountIfExists;
|
|
|
135
144
|
function getConfigDefaultAccount() {
|
|
136
145
|
const { accounts, defaultAccount } = getConfig();
|
|
137
146
|
let defaultAccountToUse = defaultAccount;
|
|
138
|
-
|
|
147
|
+
const currentConfigPath = getConfigFilePath();
|
|
148
|
+
const globalConfigPath = (0, utils_1.getGlobalConfigFilePath)();
|
|
149
|
+
if (currentConfigPath === globalConfigPath && globalConfigFileExists()) {
|
|
139
150
|
const defaultAccountOverrideAccountId = (0, defaultAccountOverride_1.getDefaultAccountOverrideAccountId)();
|
|
140
151
|
defaultAccountToUse = defaultAccountOverrideAccountId || defaultAccount;
|
|
141
152
|
}
|
|
@@ -154,7 +165,10 @@ exports.getConfigDefaultAccount = getConfigDefaultAccount;
|
|
|
154
165
|
function getConfigDefaultAccountIfExists() {
|
|
155
166
|
const { accounts, defaultAccount } = getConfig();
|
|
156
167
|
let defaultAccountToUse = defaultAccount;
|
|
157
|
-
if
|
|
168
|
+
// Only check for default account override if we're using the global config
|
|
169
|
+
const currentConfigPath = getConfigFilePath();
|
|
170
|
+
const globalConfigPath = (0, utils_1.getGlobalConfigFilePath)();
|
|
171
|
+
if (currentConfigPath === globalConfigPath && globalConfigFileExists()) {
|
|
158
172
|
const defaultAccountOverrideAccountId = (0, defaultAccountOverride_1.getDefaultAccountOverrideAccountId)();
|
|
159
173
|
defaultAccountToUse = defaultAccountOverrideAccountId || defaultAccount;
|
|
160
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/local-dev-lib",
|
|
3
|
-
"version": "0.5.0-experimental.
|
|
3
|
+
"version": "0.5.0-experimental.5",
|
|
4
4
|
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@hubspot/npm-scripts": "0.0.4",
|
|
24
|
-
"@inquirer/prompts": "^7.0.1",
|
|
25
24
|
"@types/content-disposition": "^0.5.5",
|
|
26
25
|
"@types/cors": "^2.8.15",
|
|
27
26
|
"@types/debounce": "^1.2.1",
|