@hubspot/cms-lib
Advanced tools
Comparing version 0.0.25-beta.0 to 0.0.25-beta.1
@@ -9,3 +9,3 @@ const { ALLOWED_EXTENSIONS, Mode, DEFAULT_MODE } = require('./lib/constants'); | ||
} = require('./lib/config'); | ||
const { sync } = require('./lib/sync'); | ||
const { uploadFolder } = require('./lib/uploadFolder'); | ||
const { watch } = require('./lib/watch'); | ||
@@ -23,5 +23,5 @@ const { walk } = require('./lib/walk'); | ||
updatePortalConfig, | ||
sync, | ||
uploadFolder, | ||
watch, | ||
walk, | ||
}; |
@@ -10,3 +10,4 @@ const path = require('path'); | ||
} = require('../errorHandlers'); | ||
const { sync } = require('./sync'); | ||
const { uploadFolder } = require('./uploadFolder'); | ||
const { ignoreRules, loadIgnoreConfig } = require('../ignoreRules'); | ||
const { getFileMapperApiQueryFromMode } = require('../fileMapper'); | ||
@@ -17,3 +18,3 @@ const { upload, deleteFile } = require('../api/fileMapper'); | ||
function uploadFile(portalId, file, dest, mode) { | ||
function uploadFile(portalId, file, dest, { mode, cwd }) { | ||
if (!isAllowedExtension(file)) { | ||
@@ -23,2 +24,7 @@ logger.debug(`Skipping ${file} due to unsupported extension`); | ||
} | ||
if (ignoreRules.ignores(path.relative(cwd, file))) { | ||
logger.debug(`Skipping ${file} due to an ignore rule`); | ||
return; | ||
} | ||
logger.debug('Attempting to upload file "%s" to "%s"', file, dest); | ||
@@ -49,4 +55,7 @@ const apiOptions = { | ||
function watch(portalId, src, dest, mode) { | ||
function watch(portalId, src, dest, { mode, cwd }) { | ||
const regex = new RegExp(`^${escapeRegExp(src)}`); | ||
loadIgnoreConfig(); | ||
const watcher = chokidar.watch(src, { | ||
@@ -61,5 +70,4 @@ ignoreInitial: true, | ||
// Use sync so that failures of initial sync are queued to the | ||
// end of the sync and retried | ||
sync(portalId, src, dest, mode).then(() => { | ||
// Use uploadFolder so that failures of initial upload are retried | ||
uploadFolder(portalId, src, dest, { mode, cwd }).then(() => { | ||
logger.log(`Completed uploading files in ${src} to ${dest} in ${portalId}`); | ||
@@ -74,3 +82,3 @@ }); | ||
const destPath = getDesignManagerPath(file); | ||
uploadFile(portalId, file, destPath, mode); | ||
uploadFile(portalId, file, destPath, { mode, cwd }); | ||
}); | ||
@@ -80,2 +88,8 @@ | ||
const remotePath = getDesignManagerPath(filePath); | ||
if (ignoreRules.ignores(path.relative(cwd, filePath))) { | ||
logger.debug(`Skipping ${filePath} due to an ignore rule`); | ||
return; | ||
} | ||
logger.debug('Attempting to delete file "%s"', remotePath); | ||
@@ -100,3 +114,3 @@ deleteFile(portalId, remotePath) | ||
const destPath = getDesignManagerPath(file); | ||
uploadFile(portalId, file, destPath, mode); | ||
uploadFile(portalId, file, destPath, { mode, cwd }); | ||
}); | ||
@@ -103,0 +117,0 @@ |
{ | ||
"name": "@hubspot/cms-lib", | ||
"version": "0.0.25-beta.0", | ||
"version": "0.0.25-beta.1", | ||
"description": "Library for working with the HubSpot CMS", | ||
@@ -13,2 +13,3 @@ "license": "Apache-2.0", | ||
"fs-extra": "^8.1.0", | ||
"ignore": "^5.1.4", | ||
"js-yaml": "^3.12.2", | ||
@@ -27,3 +28,3 @@ "p-queue": "^6.0.2", | ||
}, | ||
"gitHead": "1a23dc94b84ed2cf2c0eeacbac3a41d467b95484" | ||
"gitHead": "02a1a5afba8a712974a0e0fd7e7c49ea2cfa109f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90076
35
2851
12
10
+ Addedignore@^5.1.4
+ Addedignore@5.3.2(transitive)