-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass template context to validate #117
Conversation
@@ -2,7 +2,7 @@ | |||
"name": "hubl", | |||
"displayName": "HubSpot VS Code Extension", | |||
"description": "HubSpot CMS Hub support for VS Code", | |||
"version": "0.11.0", | |||
"version": "0.13.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm.
package.json
Outdated
@@ -186,7 +186,8 @@ | |||
} | |||
}, | |||
"dependencies": { | |||
"@hubspot/cli-lib": "3.0.4", | |||
"@hubspot/cli": "^3.0.7-beta.5", | |||
"@hubspot/cli-lib": "^3.0.7-beta.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When https://github.com/HubSpot/hubspot-cli/pull/534/files is merged, will pin to newest release
src/lib/validation.js
Outdated
is_available_for_new_content: | ||
getAnnotationValue( | ||
annotations, | ||
ANNOTATION_KEYS.isAvailableForNewContent | ||
) != 'false', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks solid and makes sense, just wondering if we can improve the way that getAnnotationValue
works to make usage a bit cleaner 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I never really loved my implementation of that one. I just had one idea though, what if instead of getAnnotationsFromSource
, we had something like buildAnnotationValueGetter
. Basically the output would be a getAnnotationValue
function that doesn't require the annotations to be passed into it.
For example:
const getAnnotationsFromSource = source => {
const annotations = //blah blah blah
return (...args) => getAnnotationValue(annotations, ...args);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a cool idea. Changed that up here HubSpot/hubspot-cli@42459f3
Different validations apply to different template types. This PR allows parses the filepath and annotations (if they exist) to pass extra context along to the validate endpoint.
Note: this relies on future additions to cli-lib