@hubspot/local-dev-lib 0.7.0-experimental.0 → 0.7.2-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/config/index.d.ts +1 -1
- package/config/index.js +2 -13
- package/constants/config.d.ts +0 -3
- package/constants/config.js +0 -4
- package/constants/projects.d.ts +1 -0
- package/constants/projects.js +1 -0
- package/package.json +2 -3
- package/types/Files.d.ts +1 -0
- package/config/hsSettings.d.ts +0 -4
- package/config/hsSettings.js +0 -41
- package/types/HsSettings.d.ts +0 -4
- package/types/HsSettings.js +0 -1
package/config/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function getConfigAccountByName(accountName: string): HubSpotConf
|
|
|
17
17
|
export declare function getConfigAccountIfExists(identifier: number | string): HubSpotConfigAccount | undefined;
|
|
18
18
|
export declare function getConfigDefaultAccount(): HubSpotConfigAccount;
|
|
19
19
|
export declare function getConfigDefaultAccountIfExists(): HubSpotConfigAccount | undefined;
|
|
20
|
-
export declare function getAllConfigAccounts(
|
|
20
|
+
export declare function getAllConfigAccounts(): HubSpotConfigAccount[];
|
|
21
21
|
export declare function getConfigAccountEnvironment(identifier: number | string): Environment;
|
|
22
22
|
export declare function addConfigAccount(accountToAdd: HubSpotConfigAccount): void;
|
|
23
23
|
export declare function updateConfigAccount(updatedAccount: HubSpotConfigAccount): void;
|
package/config/index.js
CHANGED
|
@@ -11,7 +11,6 @@ import { HubSpotConfigError } from '../models/HubSpotConfigError.js';
|
|
|
11
11
|
import { HUBSPOT_CONFIG_ERROR_TYPES } from '../constants/config.js';
|
|
12
12
|
import { isDeepEqual } from '../lib/isDeepEqual.js';
|
|
13
13
|
import { getCwd } from '../lib/path.js';
|
|
14
|
-
import { getHsSettingsFile } from './hsSettings.js';
|
|
15
14
|
const EMPTY_CONFIG = { accounts: [] };
|
|
16
15
|
export function getGlobalConfigFilePath() {
|
|
17
16
|
return GLOBAL_CONFIG_PATH;
|
|
@@ -180,24 +179,14 @@ export function getConfigDefaultAccountIfExists() {
|
|
|
180
179
|
const defaultAccountOverrideAccountId = getDefaultAccountOverrideAccountId(accounts);
|
|
181
180
|
defaultAccountToUse = defaultAccountOverrideAccountId || defaultAccount;
|
|
182
181
|
}
|
|
183
|
-
// Use the default account if .hs/settings.json is present
|
|
184
|
-
const hsSettingsFile = getHsSettingsFile();
|
|
185
|
-
if (hsSettingsFile && hsSettingsFile.localDefaultAccount) {
|
|
186
|
-
defaultAccountToUse = hsSettingsFile.localDefaultAccount;
|
|
187
|
-
}
|
|
188
182
|
if (!defaultAccountToUse) {
|
|
189
183
|
return;
|
|
190
184
|
}
|
|
191
185
|
const account = getConfigAccountByInferredIdentifier(accounts, defaultAccountToUse);
|
|
192
186
|
return account;
|
|
193
187
|
}
|
|
194
|
-
export function getAllConfigAccounts(
|
|
195
|
-
|
|
196
|
-
// Show only accounts in the .hs/settings.json file
|
|
197
|
-
if (!showAll) {
|
|
198
|
-
const hsSettingsFile = getHsSettingsFile();
|
|
199
|
-
accounts = accounts.filter(a => hsSettingsFile ? hsSettingsFile.accounts.includes(a.accountId) : true);
|
|
200
|
-
}
|
|
188
|
+
export function getAllConfigAccounts() {
|
|
189
|
+
const { accounts } = getConfig();
|
|
201
190
|
return accounts;
|
|
202
191
|
}
|
|
203
192
|
export function getConfigAccountEnvironment(identifier) {
|
package/constants/config.d.ts
CHANGED
|
@@ -102,6 +102,3 @@ export declare const HUBSPOT_CONFIG_OPERATIONS: {
|
|
|
102
102
|
readonly WRITE: "WRITE";
|
|
103
103
|
readonly DELETE: "DELETE";
|
|
104
104
|
};
|
|
105
|
-
export declare const HS_FOLDER = ".hs";
|
|
106
|
-
export declare const HS_SETTINGS_FILENAME = "settings.json";
|
|
107
|
-
export declare const HS_SETTINGS_PATH: string;
|
package/constants/config.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { i18n } from '../utils/lang.js';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import os from 'os';
|
|
4
|
-
import { getCwd } from '../lib/path.js';
|
|
5
4
|
export const DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME = 'hubspot.config.yml';
|
|
6
5
|
export const ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME = 'archived.hubspot.config.yml';
|
|
7
6
|
export const HUBSPOT_CONFIGURATION_FOLDER = '.hscli';
|
|
@@ -106,6 +105,3 @@ export const HUBSPOT_CONFIG_OPERATIONS = {
|
|
|
106
105
|
WRITE: 'WRITE',
|
|
107
106
|
DELETE: 'DELETE',
|
|
108
107
|
};
|
|
109
|
-
export const HS_FOLDER = '.hs';
|
|
110
|
-
export const HS_SETTINGS_FILENAME = 'settings.json';
|
|
111
|
-
export const HS_SETTINGS_PATH = path.join(getCwd(), HS_FOLDER, HS_SETTINGS_FILENAME);
|
package/constants/projects.d.ts
CHANGED
package/constants/projects.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/local-dev-lib",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2-experimental.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"./config/defaultAccountOverride": "./config/defaultAccountOverride.js",
|
|
56
56
|
"./config/migrate": "./config/migrate.js",
|
|
57
57
|
"./config/state": "./config/state.js",
|
|
58
|
-
"./config/hsSettings": "./config/hsSettings.js",
|
|
59
58
|
"./config": "./config/index.js",
|
|
60
59
|
"./constants/*": "./constants/*.js",
|
|
61
60
|
"./enums/*": "./enums/*.js",
|
|
@@ -81,7 +80,7 @@
|
|
|
81
80
|
"http-proxy-agent": "7.0.2",
|
|
82
81
|
"https-proxy-agent": "7.0.6",
|
|
83
82
|
"ignore": "^7.0.0",
|
|
84
|
-
"js-yaml": "4.1.
|
|
83
|
+
"js-yaml": "4.1.1",
|
|
85
84
|
"moment": "2.30.1",
|
|
86
85
|
"p-queue": "^7.0.0",
|
|
87
86
|
"prettier": "^3.6.2",
|
package/types/Files.d.ts
CHANGED
package/config/hsSettings.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { HsSettingsFile } from '../types/HsSettings.js';
|
|
2
|
-
export declare function getHsSettingsFilePath(): string | null;
|
|
3
|
-
export declare function getHsSettingsFile(): HsSettingsFile | null;
|
|
4
|
-
export declare function writeHsSettingsFile(settingsFile: HsSettingsFile): void;
|
package/config/hsSettings.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import findupSync from 'findup-sync';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { HS_FOLDER, HS_SETTINGS_FILENAME, HS_SETTINGS_PATH, } from '../constants/config.js';
|
|
5
|
-
import { getCwd } from '../lib/path.js';
|
|
6
|
-
import { FileSystemError } from '../models/FileSystemError.js';
|
|
7
|
-
export function getHsSettingsFilePath() {
|
|
8
|
-
return findupSync([`${HS_FOLDER}/${HS_SETTINGS_FILENAME}`], {
|
|
9
|
-
cwd: getCwd(),
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
export function getHsSettingsFile() {
|
|
13
|
-
const hsSettingsFilePath = getHsSettingsFilePath();
|
|
14
|
-
if (!hsSettingsFilePath) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
let hsSettingsFile;
|
|
18
|
-
try {
|
|
19
|
-
hsSettingsFile = JSON.parse(fs.readFileSync(hsSettingsFilePath, 'utf-8'));
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
throw new FileSystemError({ cause: e }, {
|
|
23
|
-
filepath: hsSettingsFilePath,
|
|
24
|
-
operation: 'read',
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return hsSettingsFile;
|
|
28
|
-
}
|
|
29
|
-
export function writeHsSettingsFile(settingsFile) {
|
|
30
|
-
const dir = getCwd();
|
|
31
|
-
try {
|
|
32
|
-
fs.mkdirSync(path.join(dir, HS_FOLDER), { recursive: true });
|
|
33
|
-
fs.writeFileSync(HS_SETTINGS_PATH, JSON.stringify(settingsFile, null, 2), 'utf8');
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
throw new FileSystemError({ cause: err }, {
|
|
37
|
-
filepath: dir,
|
|
38
|
-
operation: 'write',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
package/types/HsSettings.d.ts
DELETED
package/types/HsSettings.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|