* Build amp-web-push publisher files HTML page. * @return {Promise }
()
| 249 | * @return {Promise<void>} |
| 250 | */ |
| 251 | async function preBuildWebPushPublisherFiles() { |
| 252 | for (const version of WEB_PUSH_PUBLISHER_VERSIONS) { |
| 253 | for (const fileName of WEB_PUSH_PUBLISHER_FILES) { |
| 254 | const srcPath = `extensions/amp-web-push/${version}`; |
| 255 | const destPath = `build/all/amp-web-push-${version}`; |
| 256 | |
| 257 | // Build Helper Frame JS |
| 258 | const js = await fs.readFile(`${srcPath}/${fileName}.js`, 'utf8'); |
| 259 | const builtName = `${fileName}.js`; |
| 260 | await fs.outputFile(`${destPath}/${builtName}`, js); |
| 261 | const jsFiles = await fastGlob(`${srcPath}/*.js`); |
| 262 | await Promise.all( |
| 263 | jsFiles.map((jsFile) => { |
| 264 | return fs.copy(jsFile, `${destPath}/${path.basename(jsFile)}`); |
| 265 | }) |
| 266 | ); |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * post Build amp-web-push publisher files HTML page. |