@hubspot/local-dev-lib 0.0.1-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/LICENSE +12 -0
- package/README.md +17 -0
- package/api/appsDev.d.ts +6 -0
- package/api/appsDev.js +29 -0
- package/api/customObjects.d.ts +8 -0
- package/api/customObjects.js +45 -0
- package/api/designManager.d.ts +5 -0
- package/api/designManager.js +18 -0
- package/api/developerTestAccounts.d.ts +7 -0
- package/api/developerTestAccounts.js +48 -0
- package/api/fileManager.d.ts +6 -0
- package/api/fileManager.js +63 -0
- package/api/fileMapper.d.ts +12 -0
- package/api/fileMapper.js +106 -0
- package/api/fileTransport.d.ts +4 -0
- package/api/fileTransport.js +39 -0
- package/api/functions.d.ts +8 -0
- package/api/functions.js +43 -0
- package/api/github.d.ts +11 -0
- package/api/github.js +71 -0
- package/api/hubdb.d.ts +12 -0
- package/api/hubdb.js +67 -0
- package/api/lighthouseScore.d.ts +6 -0
- package/api/lighthouseScore.js +26 -0
- package/api/localDevAuth.d.ts +8 -0
- package/api/localDevAuth.js +53 -0
- package/api/marketplaceValidation.d.ts +6 -0
- package/api/marketplaceValidation.js +26 -0
- package/api/projects.d.ts +40 -0
- package/api/projects.js +216 -0
- package/api/sandboxHubs.d.ts +7 -0
- package/api/sandboxHubs.js +49 -0
- package/api/sandboxSync.d.ts +4 -0
- package/api/sandboxSync.js +26 -0
- package/api/secrets.d.ts +6 -0
- package/api/secrets.js +37 -0
- package/api/validateHubl.d.ts +3 -0
- package/api/validateHubl.js +15 -0
- package/config/CLIConfiguration.d.ts +62 -0
- package/config/CLIConfiguration.js +467 -0
- package/config/configFile.d.ts +21 -0
- package/config/configFile.js +102 -0
- package/config/configUtils.d.ts +5 -0
- package/config/configUtils.js +87 -0
- package/config/config_DEPRECATED.d.ts +75 -0
- package/config/config_DEPRECATED.js +678 -0
- package/config/environment.d.ts +2 -0
- package/config/environment.js +60 -0
- package/config/getAccountIdentifier.d.ts +2 -0
- package/config/getAccountIdentifier.js +15 -0
- package/config/index.d.ts +41 -0
- package/config/index.js +260 -0
- package/constants/api.d.ts +15 -0
- package/constants/api.js +18 -0
- package/constants/auth.d.ts +37 -0
- package/constants/auth.js +38 -0
- package/constants/config.d.ts +18 -0
- package/constants/config.js +22 -0
- package/constants/environments.d.ts +15 -0
- package/constants/environments.js +18 -0
- package/constants/extensions.d.ts +6 -0
- package/constants/extensions.js +28 -0
- package/constants/files.d.ts +21 -0
- package/constants/files.js +24 -0
- package/constants/ports.d.ts +3 -0
- package/constants/ports.js +6 -0
- package/enums/build.d.ts +36 -0
- package/enums/build.js +39 -0
- package/enums/deploy.d.ts +11 -0
- package/enums/deploy.js +14 -0
- package/enums/project.d.ts +6 -0
- package/enums/project.js +9 -0
- package/errors/errors_DEPRECATED.d.ts +3 -0
- package/errors/errors_DEPRECATED.js +60 -0
- package/errors/index.d.ts +18 -0
- package/errors/index.js +63 -0
- package/http/addQueryParams.d.ts +2 -0
- package/http/addQueryParams.js +14 -0
- package/http/getAxiosConfig.d.ts +9 -0
- package/http/getAxiosConfig.js +66 -0
- package/http/index.d.ts +17 -0
- package/http/index.js +173 -0
- package/http/unauthed.d.ts +15 -0
- package/http/unauthed.js +38 -0
- package/lang/en.json +389 -0
- package/lib/archive.d.ts +3 -0
- package/lib/archive.js +117 -0
- package/lib/cms/functions.d.ts +8 -0
- package/lib/cms/functions.js +181 -0
- package/lib/cms/handleFieldsJS.d.ts +33 -0
- package/lib/cms/handleFieldsJS.js +148 -0
- package/lib/cms/modules.d.ts +14 -0
- package/lib/cms/modules.js +186 -0
- package/lib/cms/processFieldsJs.d.ts +1 -0
- package/lib/cms/processFieldsJs.js +97 -0
- package/lib/cms/templates.d.ts +65 -0
- package/lib/cms/templates.js +107 -0
- package/lib/cms/themes.d.ts +2 -0
- package/lib/cms/themes.js +34 -0
- package/lib/cms/uploadFolder.d.ts +7 -0
- package/lib/cms/uploadFolder.js +202 -0
- package/lib/cms/validate.d.ts +2 -0
- package/lib/cms/validate.js +40 -0
- package/lib/cms/watch.d.ts +4 -0
- package/lib/cms/watch.js +201 -0
- package/lib/customObjects.d.ts +5 -0
- package/lib/customObjects.js +42 -0
- package/lib/environment.d.ts +2 -0
- package/lib/environment.js +16 -0
- package/lib/escapeRegExp.d.ts +1 -0
- package/lib/escapeRegExp.js +7 -0
- package/lib/fileManager.d.ts +2 -0
- package/lib/fileManager.js +184 -0
- package/lib/fileMapper.d.ts +18 -0
- package/lib/fileMapper.js +317 -0
- package/lib/fs.d.ts +4 -0
- package/lib/fs.js +71 -0
- package/lib/github.d.ts +8 -0
- package/lib/github.js +167 -0
- package/lib/gitignore.d.ts +3 -0
- package/lib/gitignore.js +49 -0
- package/lib/hubdb.d.ts +17 -0
- package/lib/hubdb.js +133 -0
- package/lib/ignoreRules.d.ts +3 -0
- package/lib/ignoreRules.js +69 -0
- package/lib/logger.d.ts +56 -0
- package/lib/logger.js +146 -0
- package/lib/notify.d.ts +1 -0
- package/lib/notify.js +43 -0
- package/lib/oauth.d.ts +4 -0
- package/lib/oauth.js +34 -0
- package/lib/path.d.ts +14 -0
- package/lib/path.js +134 -0
- package/lib/personalAccessKey.d.ts +10 -0
- package/lib/personalAccessKey.js +163 -0
- package/lib/portManager.d.ts +10 -0
- package/lib/portManager.js +46 -0
- package/lib/text.d.ts +2 -0
- package/lib/text.js +24 -0
- package/lib/trackUsage.d.ts +1 -0
- package/lib/trackUsage.js +63 -0
- package/lib/urls.d.ts +2 -0
- package/lib/urls.js +24 -0
- package/models/FileSystemError.d.ts +6 -0
- package/models/FileSystemError.js +47 -0
- package/models/HubSpotHttpError.d.ts +24 -0
- package/models/HubSpotHttpError.js +197 -0
- package/models/OAuth2Manager.d.ts +12 -0
- package/models/OAuth2Manager.js +105 -0
- package/package.json +81 -0
- package/types/Accounts.d.ts +178 -0
- package/types/Accounts.js +2 -0
- package/types/Activity.d.ts +20 -0
- package/types/Activity.js +2 -0
- package/types/Api.d.ts +2 -0
- package/types/Api.js +2 -0
- package/types/Apps.d.ts +77 -0
- package/types/Apps.js +2 -0
- package/types/Archive.d.ts +9 -0
- package/types/Archive.js +2 -0
- package/types/Build.d.ts +41 -0
- package/types/Build.js +2 -0
- package/types/CLIOptions.d.ts +8 -0
- package/types/CLIOptions.js +2 -0
- package/types/ComponentStructure.d.ts +40 -0
- package/types/ComponentStructure.js +2 -0
- package/types/Config.d.ts +37 -0
- package/types/Config.js +2 -0
- package/types/Deploy.d.ts +42 -0
- package/types/Deploy.js +2 -0
- package/types/DesignManager.d.ts +10 -0
- package/types/DesignManager.js +2 -0
- package/types/Error.d.ts +37 -0
- package/types/Error.js +2 -0
- package/types/FieldsJS.d.ts +1 -0
- package/types/FieldsJS.js +2 -0
- package/types/FileManager.d.ts +71 -0
- package/types/FileManager.js +2 -0
- package/types/Files.d.ts +79 -0
- package/types/Files.js +2 -0
- package/types/Functions.d.ts +66 -0
- package/types/Functions.js +2 -0
- package/types/Github.d.ts +76 -0
- package/types/Github.js +2 -0
- package/types/Http.d.ts +29 -0
- package/types/Http.js +2 -0
- package/types/Hubdb.d.ts +109 -0
- package/types/Hubdb.js +2 -0
- package/types/HublValidation.d.ts +59 -0
- package/types/HublValidation.js +2 -0
- package/types/Lang.d.ts +10 -0
- package/types/Lang.js +2 -0
- package/types/Lighthouse.d.ts +25 -0
- package/types/Lighthouse.js +2 -0
- package/types/MarketplaceValidation.d.ts +28 -0
- package/types/MarketplaceValidation.js +2 -0
- package/types/Migration.d.ts +28 -0
- package/types/Migration.js +10 -0
- package/types/Modules.d.ts +16 -0
- package/types/Modules.js +2 -0
- package/types/PortManager.d.ts +11 -0
- package/types/PortManager.js +2 -0
- package/types/Project.d.ts +42 -0
- package/types/Project.js +2 -0
- package/types/ProjectLog.d.ts +9 -0
- package/types/ProjectLog.js +2 -0
- package/types/Sandbox.d.ts +155 -0
- package/types/Sandbox.js +2 -0
- package/types/Schemas.d.ts +39 -0
- package/types/Schemas.js +2 -0
- package/types/Secrets.d.ts +3 -0
- package/types/Secrets.js +2 -0
- package/types/Utils.d.ts +6 -0
- package/types/Utils.js +2 -0
- package/types/developerTestAccounts.d.ts +12 -0
- package/types/developerTestAccounts.js +2 -0
- package/utils/PortManagerServer.d.ts +26 -0
- package/utils/PortManagerServer.js +158 -0
- package/utils/accounts.d.ts +4 -0
- package/utils/accounts.js +28 -0
- package/utils/cms/fieldsJS.d.ts +2 -0
- package/utils/cms/fieldsJS.js +18 -0
- package/utils/cms/modules.d.ts +4 -0
- package/utils/cms/modules.js +54 -0
- package/utils/detectPort.d.ts +1 -0
- package/utils/detectPort.js +102 -0
- package/utils/git.d.ts +3 -0
- package/utils/git.js +71 -0
- package/utils/lang.d.ts +6 -0
- package/utils/lang.js +88 -0
package/lib/github.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { GithubReleaseData, GithubRepoFile, RepoPath, CloneGithubRepoOptions } from '../types/Github';
|
|
3
|
+
export declare function fetchFileFromRepository(repoPath: RepoPath, filePath: string, ref: string): Promise<Buffer>;
|
|
4
|
+
export declare function fetchReleaseData(repoPath: RepoPath, tag?: string): Promise<GithubReleaseData>;
|
|
5
|
+
export declare function cloneGithubRepo(repoPath: RepoPath, dest: string, options?: CloneGithubRepoOptions): Promise<boolean>;
|
|
6
|
+
export declare function fetchGitHubRepoContentFromDownloadUrl(dest: string, downloadUrl: string): Promise<void>;
|
|
7
|
+
export declare function downloadGithubRepoContents(repoPath: RepoPath, contentPath: string, dest: string, ref?: string, filter?: (contentPiecePath: string, downloadPath: string) => boolean): Promise<void>;
|
|
8
|
+
export declare function listGithubRepoContents(repoPath: RepoPath, contentPath: string, fileFilter?: 'file' | 'dir'): Promise<GithubRepoFile[]>;
|
package/lib/github.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
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
|
+
exports.listGithubRepoContents = exports.downloadGithubRepoContents = exports.fetchGitHubRepoContentFromDownloadUrl = exports.cloneGithubRepo = exports.fetchReleaseData = exports.fetchFileFromRepository = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const archive_1 = require("./archive");
|
|
10
|
+
const logger_1 = require("./logger");
|
|
11
|
+
const github_1 = require("../api/github");
|
|
12
|
+
const lang_1 = require("../utils/lang");
|
|
13
|
+
const errors_1 = require("../errors");
|
|
14
|
+
const i18nKey = 'lib.github';
|
|
15
|
+
async function fetchFileFromRepository(repoPath, filePath, ref) {
|
|
16
|
+
try {
|
|
17
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.fetchFileFromRepository.fetching`, {
|
|
18
|
+
path: `${repoPath}/${ref}/${filePath}`,
|
|
19
|
+
}));
|
|
20
|
+
const { data } = await (0, github_1.fetchRepoFile)(repoPath, filePath, ref);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.fetchFileFromRepository.errors.fetchFail`), {
|
|
25
|
+
cause: err,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.fetchFileFromRepository = fetchFileFromRepository;
|
|
30
|
+
// Fetches information about a specific release (Defaults to latest)
|
|
31
|
+
async function fetchReleaseData(repoPath, tag) {
|
|
32
|
+
if (tag) {
|
|
33
|
+
tag = tag.trim().toLowerCase();
|
|
34
|
+
if (tag.length && tag[0] !== 'v') {
|
|
35
|
+
tag = `v${tag}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const { data } = await (0, github_1.fetchRepoReleaseData)(repoPath, tag);
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.fetchReleaseData.errors.fetchFail`, {
|
|
44
|
+
tag: tag || 'latest',
|
|
45
|
+
}), { cause: err });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.fetchReleaseData = fetchReleaseData;
|
|
49
|
+
async function downloadGithubRepoZip(repoPath, isRelease = false, options = {}) {
|
|
50
|
+
const { branch, tag } = options;
|
|
51
|
+
try {
|
|
52
|
+
let zipUrl;
|
|
53
|
+
if (isRelease) {
|
|
54
|
+
// If downloading a release, first get the release info using fetchReleaseData().
|
|
55
|
+
// Supports a custom tag, but will default to the latest release
|
|
56
|
+
const releaseData = await fetchReleaseData(repoPath, tag);
|
|
57
|
+
zipUrl = releaseData.zipball_url;
|
|
58
|
+
const { name } = releaseData;
|
|
59
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoZip.fetchingName`, { name }));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// If downloading a repository, manually construct the zip url. This url supports both branches and tags as refs
|
|
63
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoZip.fetching`, { repoPath }));
|
|
64
|
+
const ref = branch || tag;
|
|
65
|
+
zipUrl = `https://api.github.com/repos/${repoPath}/zipball${ref ? `/${ref}` : ''}`;
|
|
66
|
+
}
|
|
67
|
+
const { data } = await (0, github_1.fetchRepoAsZip)(zipUrl);
|
|
68
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoZip.completed`));
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoZip.errors.fetchFail`), {
|
|
73
|
+
cause: err,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function cloneGithubRepo(repoPath, dest, options = {}) {
|
|
78
|
+
const { tag, isRelease, branch, sourceDir, type } = options;
|
|
79
|
+
const zip = await downloadGithubRepoZip(repoPath, isRelease, {
|
|
80
|
+
tag,
|
|
81
|
+
branch,
|
|
82
|
+
});
|
|
83
|
+
const repoName = repoPath.split('/')[1];
|
|
84
|
+
const success = await (0, archive_1.extractZipArchive)(zip, repoName, dest, { sourceDir });
|
|
85
|
+
if (success) {
|
|
86
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.cloneGithubRepo.success`, {
|
|
87
|
+
type: type || '',
|
|
88
|
+
dest,
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
return success;
|
|
92
|
+
}
|
|
93
|
+
exports.cloneGithubRepo = cloneGithubRepo;
|
|
94
|
+
async function fetchGitHubRepoContentFromDownloadUrl(dest, downloadUrl) {
|
|
95
|
+
const resp = await (0, github_1.fetchRepoFileByDownloadUrl)(downloadUrl);
|
|
96
|
+
const contentType = resp.headers['content-type'];
|
|
97
|
+
let fileContents;
|
|
98
|
+
if (contentType.startsWith('text')) {
|
|
99
|
+
fileContents = Buffer.from(resp.data).toString('utf8');
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
fileContents = resp.data;
|
|
103
|
+
}
|
|
104
|
+
fs_extra_1.default.outputFileSync(dest, fileContents);
|
|
105
|
+
}
|
|
106
|
+
exports.fetchGitHubRepoContentFromDownloadUrl = fetchGitHubRepoContentFromDownloadUrl;
|
|
107
|
+
// Writes files from a public repository to the destination folder
|
|
108
|
+
async function downloadGithubRepoContents(repoPath, contentPath, dest, ref, filter) {
|
|
109
|
+
fs_extra_1.default.ensureDirSync(path_1.default.dirname(dest));
|
|
110
|
+
try {
|
|
111
|
+
const { data: contentsResp } = await (0, github_1.fetchRepoContents)(repoPath, contentPath, ref);
|
|
112
|
+
const downloadContent = async (contentPiece) => {
|
|
113
|
+
const { path: contentPiecePath, download_url, type: contentPieceType, } = contentPiece;
|
|
114
|
+
const downloadPath = path_1.default.join(dest, contentPiecePath.replace(contentPath, ''));
|
|
115
|
+
if (filter && !filter(contentPiecePath, downloadPath)) {
|
|
116
|
+
return Promise.resolve();
|
|
117
|
+
}
|
|
118
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoContents.downloading`, {
|
|
119
|
+
contentPiecePath,
|
|
120
|
+
downloadUrl: download_url,
|
|
121
|
+
downloadPath,
|
|
122
|
+
}));
|
|
123
|
+
if (contentPieceType === 'dir') {
|
|
124
|
+
const { data: innerDirContent } = await (0, github_1.fetchRepoContents)(repoPath, contentPiecePath, ref);
|
|
125
|
+
await Promise.all(innerDirContent.map(downloadContent));
|
|
126
|
+
return Promise.resolve();
|
|
127
|
+
}
|
|
128
|
+
return fetchGitHubRepoContentFromDownloadUrl(downloadPath, download_url);
|
|
129
|
+
};
|
|
130
|
+
let contentPromises;
|
|
131
|
+
if (Array.isArray(contentsResp)) {
|
|
132
|
+
contentPromises = contentsResp.map(downloadContent);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
contentPromises = [downloadContent(contentsResp)];
|
|
136
|
+
}
|
|
137
|
+
await Promise.all(contentPromises);
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
if ((0, errors_1.isSystemError)(e) && e?.error?.message) {
|
|
141
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoContents.errors.fetchFail`, {
|
|
142
|
+
errorMessage: e.error.message,
|
|
143
|
+
}), { cause: e });
|
|
144
|
+
}
|
|
145
|
+
throw e;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.downloadGithubRepoContents = downloadGithubRepoContents;
|
|
149
|
+
// Lists content from a public repository at the specified path
|
|
150
|
+
async function listGithubRepoContents(repoPath, contentPath, fileFilter) {
|
|
151
|
+
try {
|
|
152
|
+
const { data: contentsResp } = await (0, github_1.fetchRepoContents)(repoPath, contentPath);
|
|
153
|
+
const filteredFiles = fileFilter && fileFilter != undefined
|
|
154
|
+
? contentsResp.filter(item => item.type === fileFilter)
|
|
155
|
+
: contentsResp;
|
|
156
|
+
return filteredFiles;
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
if ((0, errors_1.isHubSpotHttpError)(e) && e.data.message) {
|
|
160
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoContents.errors.fetchFail`, {
|
|
161
|
+
errorMessage: e.data.message,
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.listGithubRepoContents = listGithubRepoContents;
|
package/lib/gitignore.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
exports.checkGitInclusion = exports.checkAndAddConfigToGitignore = void 0;
|
|
7
|
+
const fs_extra_1 = require("fs-extra");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const git_1 = require("../utils/git");
|
|
10
|
+
const config_1 = require("../constants/config");
|
|
11
|
+
const lang_1 = require("../utils/lang");
|
|
12
|
+
const i18nKey = 'lib.gitignore';
|
|
13
|
+
const GITIGNORE_FILE = '.gitignore';
|
|
14
|
+
function checkAndAddConfigToGitignore(configPath) {
|
|
15
|
+
try {
|
|
16
|
+
const { configIgnored, gitignoreFiles } = checkGitInclusion(configPath);
|
|
17
|
+
if (configIgnored)
|
|
18
|
+
return;
|
|
19
|
+
let gitignoreFilePath = gitignoreFiles && gitignoreFiles.length ? gitignoreFiles[0] : null;
|
|
20
|
+
if (!gitignoreFilePath) {
|
|
21
|
+
gitignoreFilePath = path_1.default.resolve(configPath, GITIGNORE_FILE);
|
|
22
|
+
(0, fs_extra_1.writeFileSync)(gitignoreFilePath, '');
|
|
23
|
+
}
|
|
24
|
+
const gitignoreContents = (0, fs_extra_1.readFileSync)(gitignoreFilePath).toString();
|
|
25
|
+
const updatedContents = `${gitignoreContents.trim()}\n\n# HubSpot config file\n${config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME}\n`;
|
|
26
|
+
(0, fs_extra_1.writeFileSync)(gitignoreFilePath, updatedContents);
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.configIgnore`), { cause: e });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.checkAndAddConfigToGitignore = checkAndAddConfigToGitignore;
|
|
33
|
+
function checkGitInclusion(configPath) {
|
|
34
|
+
const result = {
|
|
35
|
+
inGit: false,
|
|
36
|
+
configIgnored: false,
|
|
37
|
+
gitignoreFiles: [],
|
|
38
|
+
};
|
|
39
|
+
if ((0, git_1.isConfigPathInGitRepo)(configPath)) {
|
|
40
|
+
result.inGit = true;
|
|
41
|
+
result.gitignoreFiles = (0, git_1.getGitignoreFiles)(configPath);
|
|
42
|
+
if ((0, git_1.configFilenameIsIgnoredByGitignore)(result.gitignoreFiles, configPath)) {
|
|
43
|
+
// Found ignore statement in .gitignore that matches config filename
|
|
44
|
+
result.configIgnored = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
exports.checkGitInclusion = checkGitInclusion;
|
package/lib/hubdb.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { Row, Table } from '../types/Hubdb';
|
|
3
|
+
export declare function addRowsToHubDbTable(accountId: number, tableId: string, rows?: Array<Row>): Promise<{
|
|
4
|
+
tableId: string;
|
|
5
|
+
rowCount: number;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function createHubDbTable(accountId: number, src: string): Promise<{
|
|
8
|
+
tableId: string;
|
|
9
|
+
rowCount: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function updateHubDbTable(accountId: number, tableId: string, src: string): Promise<AxiosResponse<Table, any>>;
|
|
12
|
+
export declare function downloadHubDbTable(accountId: number, tableId: string, dest: string): Promise<{
|
|
13
|
+
filePath: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function clearHubDbTableRows(accountId: number, tableId: string): Promise<{
|
|
16
|
+
deletedRowCount: number;
|
|
17
|
+
}>;
|
package/lib/hubdb.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
exports.clearHubDbTableRows = exports.downloadHubDbTable = exports.updateHubDbTable = exports.createHubDbTable = exports.addRowsToHubDbTable = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const prettier_1 = __importDefault(require("prettier"));
|
|
10
|
+
const hubdb_1 = require("../api/hubdb");
|
|
11
|
+
const path_2 = require("./path");
|
|
12
|
+
const lang_1 = require("../utils/lang");
|
|
13
|
+
const i18nKey = 'lib.hubdb';
|
|
14
|
+
function validateJsonPath(src) {
|
|
15
|
+
if (path_1.default.extname(src) !== '.json') {
|
|
16
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidJsonPath`));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function validateJsonFile(src) {
|
|
20
|
+
let stats;
|
|
21
|
+
try {
|
|
22
|
+
stats = fs_extra_1.default.statSync(src);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidJsonFile`, { src }), {
|
|
26
|
+
cause: err,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (!stats.isFile()) {
|
|
30
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidJsonFile`, { src }));
|
|
31
|
+
}
|
|
32
|
+
validateJsonPath(src);
|
|
33
|
+
}
|
|
34
|
+
async function addRowsToHubDbTable(accountId, tableId, rows = []) {
|
|
35
|
+
const rowsToUpdate = rows.map(row => {
|
|
36
|
+
const values = row.values;
|
|
37
|
+
return {
|
|
38
|
+
childTableId: '0',
|
|
39
|
+
isSoftEditable: false,
|
|
40
|
+
...row,
|
|
41
|
+
values,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
if (rowsToUpdate.length > 0) {
|
|
45
|
+
await (0, hubdb_1.createRows)(accountId, tableId, rowsToUpdate);
|
|
46
|
+
}
|
|
47
|
+
const { data: { rowCount }, } = await (0, hubdb_1.publishTable)(accountId, tableId);
|
|
48
|
+
return {
|
|
49
|
+
tableId,
|
|
50
|
+
rowCount,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.addRowsToHubDbTable = addRowsToHubDbTable;
|
|
54
|
+
async function createHubDbTable(accountId, src) {
|
|
55
|
+
validateJsonFile(src);
|
|
56
|
+
const table = fs_extra_1.default.readJsonSync(src);
|
|
57
|
+
const { rows, ...schema } = table;
|
|
58
|
+
const { data: { id }, } = await (0, hubdb_1.createTable)(accountId, schema);
|
|
59
|
+
return addRowsToHubDbTable(accountId, id, rows);
|
|
60
|
+
}
|
|
61
|
+
exports.createHubDbTable = createHubDbTable;
|
|
62
|
+
async function updateHubDbTable(accountId, tableId, src) {
|
|
63
|
+
validateJsonFile(src);
|
|
64
|
+
const table = fs_extra_1.default.readJsonSync(src);
|
|
65
|
+
const { ...schema } = table;
|
|
66
|
+
return (0, hubdb_1.updateTable)(accountId, tableId, schema);
|
|
67
|
+
}
|
|
68
|
+
exports.updateHubDbTable = updateHubDbTable;
|
|
69
|
+
function convertToJSON(table, rows) {
|
|
70
|
+
const { allowChildTables, allowPublicApiAccess, columns, dynamicMetaTags, enableChildTablePages, label, name, useForPages, } = table;
|
|
71
|
+
const cleanedColumns = columns
|
|
72
|
+
.filter(column => !column.deleted || !column.archived)
|
|
73
|
+
.map(({
|
|
74
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
75
|
+
id, deleted, archived, foreignIdsByName, foreignIdsById,
|
|
76
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
77
|
+
...cleanedColumn }) => cleanedColumn);
|
|
78
|
+
const cleanedRows = rows.map(row => {
|
|
79
|
+
return {
|
|
80
|
+
path: row.path,
|
|
81
|
+
name: row.name,
|
|
82
|
+
values: row.values,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
name,
|
|
87
|
+
useForPages,
|
|
88
|
+
label,
|
|
89
|
+
allowChildTables,
|
|
90
|
+
allowPublicApiAccess,
|
|
91
|
+
dynamicMetaTags,
|
|
92
|
+
enableChildTablePages,
|
|
93
|
+
columns: cleanedColumns,
|
|
94
|
+
rows: cleanedRows,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function fetchAllRows(accountId, tableId) {
|
|
98
|
+
let rows = [];
|
|
99
|
+
let after = null;
|
|
100
|
+
do {
|
|
101
|
+
const axiosResponse = await (0, hubdb_1.fetchRows)(accountId, tableId, after ? { after } : undefined);
|
|
102
|
+
const { paging, results } = axiosResponse.data;
|
|
103
|
+
rows = rows.concat(results);
|
|
104
|
+
after = paging && paging.next ? paging.next.after : null;
|
|
105
|
+
} while (after !== null);
|
|
106
|
+
return rows;
|
|
107
|
+
}
|
|
108
|
+
async function downloadHubDbTable(accountId, tableId, dest) {
|
|
109
|
+
const { data: table } = await (0, hubdb_1.fetchTable)(accountId, tableId);
|
|
110
|
+
dest = path_1.default.resolve((0, path_2.getCwd)(), dest || `${table.name}.hubdb.json`);
|
|
111
|
+
if (fs_extra_1.default.pathExistsSync(dest)) {
|
|
112
|
+
validateJsonFile(dest);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
validateJsonPath(dest);
|
|
116
|
+
}
|
|
117
|
+
const rows = await fetchAllRows(accountId, tableId);
|
|
118
|
+
const tableToWrite = JSON.stringify(convertToJSON(table, rows));
|
|
119
|
+
const tableJson = await prettier_1.default.format(tableToWrite, {
|
|
120
|
+
parser: 'json',
|
|
121
|
+
});
|
|
122
|
+
await fs_extra_1.default.outputFile(dest, tableJson);
|
|
123
|
+
return { filePath: dest };
|
|
124
|
+
}
|
|
125
|
+
exports.downloadHubDbTable = downloadHubDbTable;
|
|
126
|
+
async function clearHubDbTableRows(accountId, tableId) {
|
|
127
|
+
const rows = await fetchAllRows(accountId, tableId);
|
|
128
|
+
await (0, hubdb_1.deleteRows)(accountId, tableId, rows.map(row => row.id));
|
|
129
|
+
return {
|
|
130
|
+
deletedRowCount: rows.length,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
exports.clearHubDbTableRows = clearHubDbTableRows;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
exports.ignoreFile = exports.createIgnoreFilter = exports.shouldIgnoreFile = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const ignore_1 = __importDefault(require("ignore"));
|
|
10
|
+
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
11
|
+
const ignoreList = [
|
|
12
|
+
'fields.output.json',
|
|
13
|
+
'hubspot.config.yml',
|
|
14
|
+
'hubspot.config.yaml',
|
|
15
|
+
'node_modules',
|
|
16
|
+
'.*',
|
|
17
|
+
'*.log',
|
|
18
|
+
'*.swp',
|
|
19
|
+
'.env',
|
|
20
|
+
// # macOS
|
|
21
|
+
'Icon\\r',
|
|
22
|
+
'__MACOSX',
|
|
23
|
+
// # Linux
|
|
24
|
+
'~',
|
|
25
|
+
// # Emacs
|
|
26
|
+
'*~',
|
|
27
|
+
// # Windows
|
|
28
|
+
'Thumbs.db',
|
|
29
|
+
'ehthumbs.db',
|
|
30
|
+
'Desktop.ini',
|
|
31
|
+
'@eaDir', // Synology Diskstation "hidden" folder where the server stores thumbnails
|
|
32
|
+
];
|
|
33
|
+
const ignoreRules = (0, ignore_1.default)().add(ignoreList);
|
|
34
|
+
let searchDomain = null;
|
|
35
|
+
let loaded = false;
|
|
36
|
+
function loadIgnoreConfig(isInProject = false) {
|
|
37
|
+
if (loaded) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Temporary solution to improve serverless beta: https://git.hubteam.com/HubSpot/cms-devex-super-repo/issues/2
|
|
41
|
+
// Do not do this when in a developer project b/c we want the package-lock.json file uploaded.
|
|
42
|
+
if (!isInProject) {
|
|
43
|
+
ignoreRules.add('package-lock.json');
|
|
44
|
+
}
|
|
45
|
+
const file = (0, findup_sync_1.default)('.hsignore');
|
|
46
|
+
if (file) {
|
|
47
|
+
if (fs_1.default.existsSync(file)) {
|
|
48
|
+
ignoreRules.add(fs_1.default.readFileSync(file).toString());
|
|
49
|
+
searchDomain = path_1.default.dirname(file);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
loaded = true;
|
|
53
|
+
}
|
|
54
|
+
function shouldIgnoreFile(file, isInProject = false) {
|
|
55
|
+
loadIgnoreConfig(isInProject);
|
|
56
|
+
const relativeTo = searchDomain || '/';
|
|
57
|
+
const relativePath = path_1.default.relative(relativeTo, file);
|
|
58
|
+
return !!relativePath && ignoreRules.ignores(relativePath);
|
|
59
|
+
}
|
|
60
|
+
exports.shouldIgnoreFile = shouldIgnoreFile;
|
|
61
|
+
function createIgnoreFilter(isInProject) {
|
|
62
|
+
loadIgnoreConfig(isInProject);
|
|
63
|
+
return (file) => !shouldIgnoreFile(file);
|
|
64
|
+
}
|
|
65
|
+
exports.createIgnoreFilter = createIgnoreFilter;
|
|
66
|
+
function ignoreFile(filePath) {
|
|
67
|
+
ignoreRules.add(filePath);
|
|
68
|
+
}
|
|
69
|
+
exports.ignoreFile = ignoreFile;
|
package/lib/logger.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Chalk } from 'chalk';
|
|
2
|
+
export declare const LOG_LEVEL: {
|
|
3
|
+
NONE: number;
|
|
4
|
+
DEBUG: number;
|
|
5
|
+
LOG: number;
|
|
6
|
+
WARN: number;
|
|
7
|
+
ERROR: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Chalk styles for logger strings.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Styles: {
|
|
13
|
+
debug: Chalk & {
|
|
14
|
+
supportsColor: import("chalk").ColorSupport;
|
|
15
|
+
};
|
|
16
|
+
log: Chalk & {
|
|
17
|
+
supportsColor: import("chalk").ColorSupport;
|
|
18
|
+
};
|
|
19
|
+
success: Chalk & {
|
|
20
|
+
supportsColor: import("chalk").ColorSupport;
|
|
21
|
+
};
|
|
22
|
+
info: Chalk & {
|
|
23
|
+
supportsColor: import("chalk").ColorSupport;
|
|
24
|
+
};
|
|
25
|
+
warn: Chalk & {
|
|
26
|
+
supportsColor: import("chalk").ColorSupport;
|
|
27
|
+
};
|
|
28
|
+
error: Chalk & {
|
|
29
|
+
supportsColor: import("chalk").ColorSupport;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare function stylize(label: string, style: Chalk, args: any[]): any[];
|
|
33
|
+
export declare class Logger {
|
|
34
|
+
error(...args: any[]): void;
|
|
35
|
+
warn(...args: any[]): void;
|
|
36
|
+
log(...args: any[]): void;
|
|
37
|
+
success(...args: any[]): void;
|
|
38
|
+
info(...args: any[]): void;
|
|
39
|
+
debug(...args: any[]): void;
|
|
40
|
+
group(...args: any[]): void;
|
|
41
|
+
groupEnd(): void;
|
|
42
|
+
}
|
|
43
|
+
export declare function setLogger(logger: Logger): void;
|
|
44
|
+
export declare function setLogLevel(level: number): void;
|
|
45
|
+
export declare function shouldLog(level: number): boolean;
|
|
46
|
+
export declare function getLogLevel(): number;
|
|
47
|
+
export declare const logger: {
|
|
48
|
+
error(...args: any[]): void;
|
|
49
|
+
warn(...args: any[]): void;
|
|
50
|
+
log(...args: any[]): void;
|
|
51
|
+
success(...args: any[]): void;
|
|
52
|
+
info(...args: any[]): void;
|
|
53
|
+
debug(...args: any[]): void;
|
|
54
|
+
group(...args: any[]): void;
|
|
55
|
+
groupEnd(): void;
|
|
56
|
+
};
|
package/lib/logger.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.logger = exports.getLogLevel = exports.shouldLog = exports.setLogLevel = exports.setLogger = exports.Logger = exports.stylize = exports.Styles = exports.LOG_LEVEL = void 0;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
exports.LOG_LEVEL = {
|
|
10
|
+
NONE: 0,
|
|
11
|
+
DEBUG: 1,
|
|
12
|
+
LOG: 2,
|
|
13
|
+
WARN: 4,
|
|
14
|
+
ERROR: 8,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Chalk styles for logger strings.
|
|
18
|
+
*/
|
|
19
|
+
exports.Styles = {
|
|
20
|
+
debug: chalk_1.default.reset.blue,
|
|
21
|
+
log: chalk_1.default.reset,
|
|
22
|
+
success: chalk_1.default.reset.green,
|
|
23
|
+
info: chalk_1.default.reset.white,
|
|
24
|
+
warn: chalk_1.default.reset.yellow,
|
|
25
|
+
error: chalk_1.default.reset.red,
|
|
26
|
+
};
|
|
27
|
+
function stylize(label, style, args) {
|
|
28
|
+
const styledLabel = style(label);
|
|
29
|
+
const [firstArg, ...rest] = args;
|
|
30
|
+
if (typeof firstArg === 'string') {
|
|
31
|
+
return [`${styledLabel} ${firstArg}`, ...rest];
|
|
32
|
+
}
|
|
33
|
+
return [styledLabel, ...args];
|
|
34
|
+
}
|
|
35
|
+
exports.stylize = stylize;
|
|
36
|
+
class Logger {
|
|
37
|
+
error(...args) {
|
|
38
|
+
console.error(...stylize('[ERROR]', exports.Styles.error, args));
|
|
39
|
+
}
|
|
40
|
+
warn(...args) {
|
|
41
|
+
console.warn(...stylize('[WARNING]', exports.Styles.warn, args));
|
|
42
|
+
}
|
|
43
|
+
log(...args) {
|
|
44
|
+
console.log(...args);
|
|
45
|
+
}
|
|
46
|
+
success(...args) {
|
|
47
|
+
console.log(...stylize('[SUCCESS]', exports.Styles.success, args));
|
|
48
|
+
}
|
|
49
|
+
info(...args) {
|
|
50
|
+
console.info(...stylize('[INFO]', exports.Styles.info, args));
|
|
51
|
+
}
|
|
52
|
+
debug(...args) {
|
|
53
|
+
console.debug(...stylize('[DEBUG]', exports.Styles.log, args));
|
|
54
|
+
}
|
|
55
|
+
group(...args) {
|
|
56
|
+
console.group(...args);
|
|
57
|
+
}
|
|
58
|
+
groupEnd() {
|
|
59
|
+
console.groupEnd();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.Logger = Logger;
|
|
63
|
+
let currentLogger = new Logger();
|
|
64
|
+
let currentLogLevel = exports.LOG_LEVEL.ERROR;
|
|
65
|
+
function setLogger(logger) {
|
|
66
|
+
currentLogger = logger;
|
|
67
|
+
}
|
|
68
|
+
exports.setLogger = setLogger;
|
|
69
|
+
function setLogLevel(level) {
|
|
70
|
+
switch (level) {
|
|
71
|
+
case exports.LOG_LEVEL.DEBUG:
|
|
72
|
+
currentLogLevel =
|
|
73
|
+
exports.LOG_LEVEL.DEBUG | exports.LOG_LEVEL.LOG | exports.LOG_LEVEL.WARN | exports.LOG_LEVEL.ERROR;
|
|
74
|
+
break;
|
|
75
|
+
case exports.LOG_LEVEL.LOG:
|
|
76
|
+
currentLogLevel = exports.LOG_LEVEL.LOG | exports.LOG_LEVEL.WARN | exports.LOG_LEVEL.ERROR;
|
|
77
|
+
break;
|
|
78
|
+
case exports.LOG_LEVEL.WARN:
|
|
79
|
+
currentLogLevel = exports.LOG_LEVEL.WARN | exports.LOG_LEVEL.ERROR;
|
|
80
|
+
break;
|
|
81
|
+
case exports.LOG_LEVEL.ERROR:
|
|
82
|
+
currentLogLevel = exports.LOG_LEVEL.ERROR;
|
|
83
|
+
break;
|
|
84
|
+
case exports.LOG_LEVEL.NONE:
|
|
85
|
+
default:
|
|
86
|
+
currentLogLevel = exports.LOG_LEVEL.NONE;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.setLogLevel = setLogLevel;
|
|
90
|
+
function shouldLog(level) {
|
|
91
|
+
return !!(currentLogLevel & level);
|
|
92
|
+
}
|
|
93
|
+
exports.shouldLog = shouldLog;
|
|
94
|
+
function getLogLevel() {
|
|
95
|
+
switch (currentLogLevel) {
|
|
96
|
+
case exports.LOG_LEVEL.DEBUG | exports.LOG_LEVEL.LOG | exports.LOG_LEVEL.WARN | exports.LOG_LEVEL.ERROR:
|
|
97
|
+
return exports.LOG_LEVEL.DEBUG;
|
|
98
|
+
case exports.LOG_LEVEL.LOG | exports.LOG_LEVEL.WARN | exports.LOG_LEVEL.ERROR:
|
|
99
|
+
return exports.LOG_LEVEL.LOG;
|
|
100
|
+
case exports.LOG_LEVEL.WARN | exports.LOG_LEVEL.ERROR:
|
|
101
|
+
return exports.LOG_LEVEL.WARN;
|
|
102
|
+
case exports.LOG_LEVEL.ERROR:
|
|
103
|
+
return exports.LOG_LEVEL.ERROR;
|
|
104
|
+
default:
|
|
105
|
+
return exports.LOG_LEVEL.NONE;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.getLogLevel = getLogLevel;
|
|
109
|
+
exports.logger = {
|
|
110
|
+
error(...args) {
|
|
111
|
+
if (shouldLog(exports.LOG_LEVEL.ERROR)) {
|
|
112
|
+
currentLogger.error(...args);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
warn(...args) {
|
|
116
|
+
if (shouldLog(exports.LOG_LEVEL.WARN)) {
|
|
117
|
+
currentLogger.warn(...args);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
log(...args) {
|
|
121
|
+
if (shouldLog(exports.LOG_LEVEL.LOG)) {
|
|
122
|
+
currentLogger.log(...args);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
success(...args) {
|
|
126
|
+
if (shouldLog(exports.LOG_LEVEL.LOG)) {
|
|
127
|
+
currentLogger.success(...args);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
info(...args) {
|
|
131
|
+
if (shouldLog(exports.LOG_LEVEL.LOG)) {
|
|
132
|
+
currentLogger.info(...args);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
debug(...args) {
|
|
136
|
+
if (shouldLog(exports.LOG_LEVEL.DEBUG)) {
|
|
137
|
+
currentLogger.debug(...args);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
group(...args) {
|
|
141
|
+
currentLogger.group(...args);
|
|
142
|
+
},
|
|
143
|
+
groupEnd() {
|
|
144
|
+
currentLogger.groupEnd();
|
|
145
|
+
},
|
|
146
|
+
};
|
package/lib/notify.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function triggerNotify(filePathToNotify: string | undefined, actionType: string, filePath: string, actionPromise: Promise<void>): void;
|