Skip to content

Commit 8609c63

Browse files
committed
chore: refactor rollup building
1 parent 2120e87 commit 8609c63

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

api-extractor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
*
304304
* DEFAULT VALUE: "warning"
305305
*/
306-
"logLevel": "warning",
306+
"logLevel": "none", /* FIXME: Change to "warning" */
307307

308308
/**
309309
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),

rollup.config.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,13 @@ function createConfig(format, _output, plugins = []) {
296296
],
297297
output,
298298
onwarn: (msg, warn) => {
299-
if (!/Circular/.test(msg)) {
299+
if (
300+
!(
301+
msg.code == 'CIRCULAR_DEPENDENCY' ||
302+
msg.code == 'EMPTY_BUNDLE' ||
303+
msg.code == 'UNRESOLVED_IMPORT'
304+
)
305+
) {
300306
warn(msg)
301307
}
302308
},

scripts/build.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ async function main() {
109109
if (size) {
110110
await checkAllSizes(resolvedTargets)
111111
}
112+
113+
if (buildTypes) {
114+
await buildTypingsAll(resolvedTargets)
115+
}
112116
}
113117

114118
async function buildAll(targets: string[]) {
@@ -117,6 +121,12 @@ async function main() {
117121
console.log(`\nbuilt in ${(performance.now() - start).toFixed(2)}ms.`)
118122
}
119123

124+
async function buildTypingsAll(targets: string[]) {
125+
const start = performance.now()
126+
await runParallel(os.cpus().length, targets, buildTypings)
127+
console.log(`\nbundle dts in ${(performance.now() - start).toFixed(2)}ms.`)
128+
}
129+
120130
async function runParallel(
121131
maxConcurrency: number,
122132
source: string[],
@@ -176,8 +186,18 @@ async function main() {
176186
],
177187
{ stdio: 'inherit' }
178188
)
189+
}
190+
191+
async function buildTypings(target: string) {
192+
const pkgDir = path.resolve(__dirname, `../packages/${target}`)
193+
const pkg = await readJson(`${pkgDir}/package.json`)
194+
195+
// only build published packages for release
196+
if (isRelease && pkg.private) {
197+
return
198+
}
179199

180-
if (buildTypes && pkg.types) {
200+
if (pkg.types) {
181201
console.log()
182202
console.log(
183203
pc.bold(pc.yellow(`Rolling up type definitions for ${target}...`))

0 commit comments

Comments
 (0)