()
| 93 | isVerb && log(chalk.yellow('Build config:\n'), opts, '\n'); |
| 94 | |
| 95 | const buildWebpack = () => { |
| 96 | const buildConf = { |
| 97 | ...webpackConfig({ |
| 98 | production: 1, |
| 99 | args: buildWebpackArgs(opts), |
| 100 | cmdOpts: opts, |
| 101 | }), |
| 102 | ...normalizeJsonOpt(opts, 'config'), |
| 103 | }; |
| 104 | |
| 105 | if (dts === 'only') { |
| 106 | return buildDeclaration(opts); |
| 107 | } |
| 108 | |
| 109 | webpack(buildConf, async (err, stats) => { |
| 110 | const errors = err || (stats ? stats.hasErrors() : false); |
| 111 | const statConf = { |
| 112 | hash: false, |
| 113 | colors: true, |
| 114 | builtAt: false, |
| 115 | entrypoints: false, |
| 116 | modules: false, |
| 117 | ...normalizeJsonOpt(opts, 'stats'), |
| 118 | }; |
| 119 | |
| 120 | if (stats) { |
| 121 | opts.statsOutput && fs.writeFileSync(rootResolve(opts.statsOutput), JSON.stringify(stats.toJson())); |
| 122 | isVerb && log(chalk.yellow('Stats config:\n'), statConf, '\n'); |
| 123 | const result = stats.toString(statConf); |
| 124 | log(result, '\n'); |
| 125 | } |
| 126 | |
| 127 | await buildLocale(opts); |
| 128 | |
| 129 | if (dts !== 'skip') { |
| 130 | await buildDeclaration(opts); |
| 131 | } |
| 132 | |
| 133 | if (errors) { |
| 134 | printError(`Error during building`); |
| 135 | console.error(err); |
| 136 | } else { |
| 137 | printRow('Building completed successfully!'); |
| 138 | } |
| 139 | }); |
| 140 | }; |
| 141 | |
| 142 | if (opts.patch) { |
| 143 | isVerb && log(chalk.yellow('Patch the version'), '\n'); |
no test coverage detected