@hubspot/cms-lib
Advanced tools
Comparing version 2.0.2-beta.0 to 2.0.2-beta.1
{ | ||
"name": "@hubspot/cms-lib", | ||
"version": "2.0.2-beta.0", | ||
"version": "2.0.2-beta.1", | ||
"description": "Library for working with the HubSpot CMS", | ||
@@ -35,3 +35,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "24034a03b99779398a995a28155663641d5a2d4c" | ||
"gitHead": "0b8b2ffb98fd120a9e0830ea3ca1a5189ddce9b4" | ||
} |
@@ -28,11 +28,31 @@ const fs = require('fs-extra'); | ||
const writeSchemaToDisk = (schema, dest) => { | ||
const fullPath = path.resolve(getCwd(), dest || '', `${schema.name}.json`); | ||
const cleanSchema = schema => { | ||
const parsedSchema = {}; | ||
parsedSchema.name = schema.name; | ||
parsedSchema.labels = schema.labels; | ||
parsedSchema.requiredProperties = schema.requiredProperties; | ||
parsedSchema.searchableProperties = schema.searchableProperties; | ||
parsedSchema.primaryDisplayProperty = schema.primaryDisplayProperty; | ||
parsedSchema.associatedObjects = schema.associatedObjects; | ||
parsedSchema.properties = schema.properties | ||
.filter(p => !p.name.startsWith('hs_')) | ||
.map(p => ({ | ||
name: p.name, | ||
label: p.label, | ||
type: p.type, | ||
fieldType: p.fieldType, | ||
description: p.description, | ||
})); | ||
return parsedSchema; | ||
}; | ||
const writeSchemaToDisk = (schema, dest) => | ||
fs.outputFileSync( | ||
fullPath, | ||
prettier.format(JSON.stringify(schema), { | ||
path.resolve(getCwd(), dest || '', `${schema.name}.json`), | ||
prettier.format(JSON.stringify(cleanSchema(schema)), { | ||
parser: 'json', | ||
}) | ||
); | ||
}; | ||
@@ -62,4 +82,5 @@ const listSchemas = async portalId => { | ||
listSchemas, | ||
cleanSchema, | ||
downloadSchemas, | ||
downloadSchema, | ||
}; |
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
271415
364
84
8711
30
31