Skip to content

Commit aa5d92b

Browse files
fix: type errors and missing command arg defs
1 parent fa18914 commit aa5d92b

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

packages/icon/scripts/build/build-batch.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-console */
2-
import { MergedRollupOptions, rollup } from 'rollup';
2+
import { InputPluginOption, rollup, type RollupOptions } from 'rollup';
33

44
import { GENERATED_DIR } from './constants';
55

66
async function getBatchBuildOptions(
77
batch: Array<string>,
8-
): Promise<Array<MergedRollupOptions>> {
8+
): Promise<Array<RollupOptions>> {
99
const { constructUMDGlobalName } = await import(
1010
'@lg-tools/build/config/utils/constructUMDGlobalName.mjs'
1111
);
@@ -21,11 +21,11 @@ async function getBatchBuildOptions(
2121
{
2222
...esmConfig,
2323
input: batch.map(icon => `${GENERATED_DIR}/${icon}.tsx`),
24-
output: [esmConfig.output],
24+
output: esmConfig.output,
2525
plugins: [
2626
// Ensure @emotion packages are externalized (not bundled into icons)
2727
nodeExternals({ deps: true, include: [/@emotion/] }),
28-
...esmConfig.plugins,
28+
...(esmConfig.plugins as Array<InputPluginOption>),
2929
],
3030
},
3131
// UMD builds need a single input file
@@ -43,7 +43,7 @@ async function getBatchBuildOptions(
4343
plugins: [
4444
// Ensure @emotion packages are externalized (not bundled into icons)
4545
nodeExternals({ deps: true, include: [/@emotion/] }),
46-
...umdConfig.plugins,
46+
...(umdConfig.plugins as Array<InputPluginOption>),
4747
],
4848
};
4949
}),
@@ -64,7 +64,14 @@ export async function buildBatch(
6464
for (const config of rollupConfigs) {
6565
const bundle = await rollup(config);
6666

67-
await Promise.all(config.output.map(bundle.write));
67+
if (config.output) {
68+
const outputs = Array.isArray(config.output)
69+
? config.output
70+
: [config.output];
71+
72+
await Promise.all(outputs.map(bundle.write));
73+
}
74+
6875
await bundle.close();
6976
}
7077
} catch (e) {

packages/icon/scripts/build/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ async function buildIcons(options: BuildIconOptions): Promise<void> {
8989

9090
new Command()
9191
.description('Split icon files into batches for bundling in parallel')
92+
.option('-f, --force', 'Force build all icons', false)
9293
.option('-v, --verbose', 'Enable verbose output', false)
9394
.action(buildIcons)
9495
.parse();

tools/build/config/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const createOutput = ({ format, useTerser = false, outputNameSuffix = '' }) => {
5454
};
5555

5656
/**
57-
* @param {import('rollup').OutputOptions} output
57+
* @param {import('rollup').RollupOptions['output']} output
5858
* @param {Partial<import('rollup').RollupOptions>} [overrides]
5959
* @returns {import('rollup').RollupOptions}
6060
*/

0 commit comments

Comments
 (0)