-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Validating outside the browser - command line tool #937
Comments
Very cool! We're in the process of open sourcing the validator and we were definitely planning to publish it on NPM. This would be JS only, so likely a bit faster and easier to install. One nice thing about your solution is that it is guaranteed to be in-sync with the prod validator (since it is using it). It comes at a cost of spinning up a browser and talking to the internet. Would be great to work together on that! |
Since it is super relevant: The core validator is now open source: #951 |
Wonderful, I'll see if I can rid myself of the headless browser. |
@matcarey Your solution has one big benefit: It uses the live validator without needing to update from npm. It would be neat to keep an option that downloads the rules from the internet. Its a tradeoff but nice if people have the option. |
Basically our plan would be to push a minor release to NPM every time we push the web validator. |
True. I'll take a look at the core validator and see what the options are. I suppose I'm treating this more like an integration test than a unit test - does my AMP page meet the current validation requirements of the AMP validator. That means it would fail if I've broken it or if a breaking change was (presumably accidentally) released. I wonder whether it's helpful to opt into a particular SHA/tag for validation, or if feeling brave validate against At some stage we should take implementation options back to https://github.com/dorightdigital/amp-validator/issues for more fine grained discussion :) |
@pietergreyling — are there any additional items left, or does #1554 cover this issue? |
Looks like it does, I'll have a play to be sure. I'll close this one on the assumption it's all good and I'll comment elsewhere if I think something's missing. |
Hi guys, I've released a command line tool for validating AMP pages. I'm working on an AMP implementation for a client and we've found the browser console validator useful for exploring but not so good for automation. I've published a tool to NPM https://www.npmjs.com/package/amp-validator which gives the validation results available on the command line. For example:
It works with local files and remote URLs and you can call it with multiple URLs/Files at once. It exits with a success status if all pages validate and a failure status if any pages don't validate.
It can give a JSON output with the param
--output=json
- this gives various details that might be useful in a build step:Next steps are:
What do I mean by "provider-specific validation requirements"? My client cares about being in Google's AMP demo. Speaking with Google shows that there are additional requirements on top of a valid AMP document, I'd like to add
--google
as an opt-in to Google's particular requirements. I presume there are already other rules being decided by other companies, it would be good if teams can validate against all the requirements in one place - it may be wishful thinking but if we can start gathering the various provider-specific requirements that we know about it should help.Feedback is welcome, feature requests can be discussed and bugs raised on the Github https://github.com/dorightdigital/amp-validator
I hope it's a tool you can benefit from.
The text was updated successfully, but these errors were encountered: