Socket
Socket
Sign inDemoInstall

@hubspot/cms-lib

Package Overview
Dependencies
Maintainers
8
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hubspot/cms-lib - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

path.js

4

index.js
const { ALLOWED_EXTENSIONS } = require('./lib/constants');
const {
loadConfig,
getConfig,
getPortalId,
getPortalConfig,

@@ -14,3 +16,5 @@ updatePortalConfig,

getConfig,
loadConfig,
getPortalConfig,
getPortalId,
updatePortalConfig,

@@ -17,0 +21,0 @@ sync,

54

lib/config.js

@@ -5,23 +5,46 @@ const yaml = require('js-yaml');

// TODO make the config overrideable via CLI `--config` param
const configPath = findup('hubspot.config.yml');
let config;
let configPath;
if (!configPath) {
throw new Error('A hubspot.config.yml file could not be found');
}
const configFile = yaml.safeLoad(fs.readFileSync(configPath));
const writeConfig = () => {
fs.writeFileSync(
configPath,
yaml.safeDump(JSON.parse(JSON.stringify(configFile, null, 2)))
yaml.safeDump(JSON.parse(JSON.stringify(config, null, 2)))
);
};
const getConfig = () => configFile;
const loadConfig = path => {
configPath = path || findup('hubspot.config.yml');
if (!configPath) {
throw new Error('A hubspot.config.yml file could not be found');
}
config = yaml.safeLoad(fs.readFileSync(configPath));
};
const getConfig = () => {
if (!config) {
loadConfig();
}
return config;
};
const setConfig = updatedConfig => {
config = updatedConfig;
return config;
};
const getPortalConfig = portalId =>
configFile.portals.find(portal => portal.portalId === portalId);
config.portals.find(portal => portal.portalId === portalId);
const getPortalId = name => {
const portal = config.portals.find(p => p.name === name);
if (portal) {
return portal.portalId;
}
return null;
};
const updatePortalConfig = configOptions => {

@@ -58,6 +81,6 @@ const {

if (portalConfig) {
const index = configFile.portals.indexOf(portalConfig);
configFile.portals[index] = nextPortalConfig;
const index = config.portals.indexOf(portalConfig);
config.portals[index] = nextPortalConfig;
} else {
configFile.portals.push(nextPortalConfig);
config.portals.push(nextPortalConfig);
}

@@ -69,4 +92,7 @@ writeConfig();

getConfig,
setConfig,
loadConfig,
getPortalConfig,
getPortalId,
updatePortalConfig,
};
{
"name": "@hubspot/cms-lib",
"version": "0.0.10",
"version": "0.0.11",
"description": "Library for working with the HubSpot CMS",
"main": "index.js",
"dependencies": {
"chokidar": "^2.1.5",
"chokidar": "^3.0.1",
"findup-sync": "^3.0.0",

@@ -15,6 +15,9 @@ "fs-extra": "^7.0.1",

},
"engines": {
"node": ">=8.9.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "ab46a9bbb64fe2070cbb6cd7fb9dc52e5c918275"
"gitHead": "6615c512ed462ade7b7744633931f6ef98057882"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc