/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
build-system/tasks/build.js
94 строки
3 KB
Daniel Rozenberg
🏗 Turbo-charge CircleCI parallelization for faster overall builds (#39861)
29 фев 2024, 00:21
Не верифицирован
29 фев 2024, 00:21
8007632
Код
Авторство
О чём код?
const { bootstrapThirdPartyFrames, compileAllJs, compileCoreRuntime, printConfigHelp, printNobuildHelp, } = require('./helpers'); const { createCtrlcHandler, exitCtrlcHandler, } = require('../common/ctrlcHandler'); const {buildExtensions} = require('./extension-helpers'); const { buildVendorConfigs, shouldBuildVendorConfigs, } = require('./3p-vendor-helpers'); const {compileCss} = require('./css'); const {parseExtensionFlags} = require('./extension-helpers'); const {buildStoryLocalization} = require('./build-story-localization'); const argv = require('minimist')(process.argv.slice(2)); /** * Perform the prerequisite steps before starting the unminified build. * Used by `amp` and `amp build`. * * @param {!Object} options * @return {Promise} */ async function runPreBuildSteps(options) { return Promise.all([ buildStoryLocalization(options), compileCss(options), bootstrapThirdPartyFrames(options), ]); } /** * Unminified build. Entry point for `amp build`. * @return {Promise<void>} */ async function build() { const handlerProcess = createCtrlcHandler('build'); process.env.NODE_ENV = 'development'; const options = { fortesting: argv.fortesting, localDev: true, minify: false, watch: argv.watch, }; printNobuildHelp(); printConfigHelp('amp build'); parseExtensionFlags(); await runPreBuildSteps(options); if (argv.core_runtime_only) { await compileCoreRuntime(options); } else { await compileAllJs(options); } await buildExtensions(options); // This step is to be run only during a full `amp build`. if (shouldBuildVendorConfigs()) { await buildVendorConfigs(options); } if (!argv.watch) { exitCtrlcHandler(handlerProcess); } } module.exports = { build, runPreBuildSteps, }; /* eslint "local/camelcase": 0 */ build.description = 'Build the AMP library'; build.flags = { config: 'Set the runtime\'s AMP_CONFIG to one of "prod" or "canary"', fortesting: 'Build the AMP library for local testing', extensions: 'Build only the listed extensions', extensions_from: 'Build only the extensions from the listed AMP(s)', noextensions: 'Build with no extensions', core_runtime_only: 'Build only the core runtime', vendor_configs: 'Build 3p party vendor configuration files (defaults to true unless one of --core_runtime_only, --extensions, or --extensions_from is set)', coverage: 'Add code coverage instrumentation to JS files using istanbul', version_override: 'Override the version written to AMP_CONFIG', watch: 'Watch for changes in files, re-builds when detected', esm: 'Do not transpile down to ES5', define_experiment_constant: 'Build runtime with the EXPERIMENT constant set to true', };