* Checks for the existence of a local wasm / js validator binary and returns * its location. Defaults to the wasm binary on the CDN. * @return {Promise }
()
| 78 | * @return {Promise<string>} |
| 79 | */ |
| 80 | async function getValidatorJs() { |
| 81 | const localWasmValidatorPath = |
| 82 | 'validator/bazel-bin/cpp/engine/wasm/validator_js_bin.js'; |
| 83 | const localJsValidatorPath = 'validator/dist/validator_minified.js'; |
| 84 | if (await pathExists(localWasmValidatorPath)) { |
| 85 | log('Using the', cyan('locally built wasm validator') + '...'); |
| 86 | return localWasmValidatorPath; |
| 87 | } |
| 88 | if (await pathExists(localJsValidatorPath)) { |
| 89 | log('Using the', cyan('locally built js validator') + '...'); |
| 90 | return localJsValidatorPath; |
| 91 | } |
| 92 | log('Using the', cyan('wasm validator from the CDN') + '...'); |
| 93 | logLocalDev( |
| 94 | '⤷ To use a locally built wasm or js validator,', |
| 95 | 'run the build command from', |
| 96 | cyan('validator/README.md') + '.' |
| 97 | ); |
| 98 | return 'https://cdn.ampproject.org/v0/validator_wasm.js'; // eslint-disable-line local/no-forbidden-terms |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Runs amphtml-validator on the given list of files and prints results. |
no test coverage detected