(config: BuildConfig)
| 39 | * Terser for the core submodule. |
| 40 | */ |
| 41 | export async function build(config: BuildConfig) { |
| 42 | config.devRelease = config.devRelease || (!!config.release && config.setDistTag === 'dev'); |
| 43 | try { |
| 44 | if (config.prepareRelease) { |
| 45 | // locally set the version for the upcoming release |
| 46 | await prepareReleaseVersion(config); |
| 47 | } else if (config.release && !config.dryRun && !config.devRelease) { |
| 48 | // ci release, npm publish |
| 49 | await setReleaseVersion(config); |
| 50 | } else { |
| 51 | // local build or dev build |
| 52 | await setDistVersion(config); |
| 53 | } |
| 54 | |
| 55 | console.log( |
| 56 | `🌎 Qwik v${config.distVersion}`, |
| 57 | `[node ${process.version}, ${process.platform}/${process.arch}]` |
| 58 | ); |
| 59 | |
| 60 | if (config.tsc || (!config.dev && config.qwik)) { |
| 61 | rmSync(config.tscDir, { recursive: true, force: true }); |
| 62 | rmSync(config.dtsDir, { recursive: true, force: true }); |
| 63 | await tscQwik(config); |
| 64 | } |
| 65 | |
| 66 | if (config.qwik) { |
| 67 | if (config.dev) { |
| 68 | ensureDir(config.distQwikPkgDir); |
| 69 | } else { |
| 70 | emptyDir(config.distQwikPkgDir); |
| 71 | } |
| 72 | |
| 73 | await submodulePreloader(config); |
| 74 | await Promise.all([ |
| 75 | submoduleCore(config), |
| 76 | submoduleQwikLoader(config), |
| 77 | submoduleBuild(config), |
| 78 | submoduleTesting(config), |
| 79 | submoduleCli(config), |
| 80 | ]); |
| 81 | |
| 82 | // server bundling must happen after the results from the others |
| 83 | // because it inlines the qwik loader |
| 84 | await Promise.all([submoduleServer(config), submoduleOptimizer(config)]); |
| 85 | } |
| 86 | |
| 87 | if (config.api || (!config.dev && config.qwik)) { |
| 88 | rmSync(join(config.rootDir, 'dist-dev', 'api'), { recursive: true, force: true }); |
| 89 | rmSync(join(config.rootDir, 'dist-dev', 'api-docs'), { recursive: true, force: true }); |
| 90 | rmSync(join(config.rootDir, 'dist-dev', 'api-extractor'), { recursive: true, force: true }); |
| 91 | } |
| 92 | if (config.api || ((!config.dev || config.tsc) && config.qwik)) { |
| 93 | await apiExtractorQwik(config); |
| 94 | } |
| 95 | |
| 96 | if (config.platformBinding) { |
| 97 | await buildPlatformBinding(config); |
| 98 | } else if (config.platformBindingWasmCopy) { |
no test coverage detected
searching dependent graphs…