snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled
This commit is contained in:
88
common/shared/bin/index.mts
Executable file
88
common/shared/bin/index.mts
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env -S node --experimental-strip-types
|
||||
|
||||
import type { IBuildOptions } from '../tsdown/types.ts';
|
||||
import process from 'node:process';
|
||||
import { buildPresetPackage, preparePresetPackage } from '../preset-build/index.ts';
|
||||
import { build } from '../tsdown/index.ts';
|
||||
|
||||
interface IPresetCliBuildOptions {
|
||||
cleanup?: boolean;
|
||||
tsdownConfigPath?: string;
|
||||
}
|
||||
|
||||
const argvs = process.argv.slice(2);
|
||||
const [command, ...args] = argvs;
|
||||
|
||||
function collectOptionValues(argv: string[], optionName: string) {
|
||||
const values: string[] = [];
|
||||
|
||||
for (let index = 0; index < argv.length; index++) {
|
||||
if (argv[index] !== optionName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const next = argv[index + 1];
|
||||
if (!next || next.startsWith('--')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
values.push(...next.split(',').map((value) => value.trim()).filter(Boolean));
|
||||
index++;
|
||||
}
|
||||
|
||||
return [...new Set(values)];
|
||||
}
|
||||
|
||||
if (command === 'preset') {
|
||||
const [presetCommand, ...presetArgs] = args;
|
||||
if (!presetCommand) {
|
||||
throw new Error('Missing preset subcommand. Expected "prepare" or "build".');
|
||||
}
|
||||
|
||||
if (presetCommand === 'prepare') {
|
||||
preparePresetPackage();
|
||||
} else if (presetCommand === 'build') {
|
||||
const options: IPresetCliBuildOptions = {};
|
||||
|
||||
if (presetArgs.includes('--cleanup')) {
|
||||
options.cleanup = true;
|
||||
}
|
||||
|
||||
const configIdx = presetArgs.indexOf('--config');
|
||||
if (configIdx !== -1 && presetArgs[configIdx + 1]) {
|
||||
options.tsdownConfigPath = presetArgs[configIdx + 1];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line antfu/no-top-level-await
|
||||
await buildPresetPackage(options);
|
||||
} else {
|
||||
throw new Error(`Unknown preset subcommand "${presetCommand}". Expected "prepare" or "build".`);
|
||||
}
|
||||
}
|
||||
|
||||
if (command === 'build') {
|
||||
const options: IBuildOptions = {};
|
||||
|
||||
if (args.includes('--skipUMD')) {
|
||||
options.skipUMD = true;
|
||||
}
|
||||
if (args.includes('--cleanup')) {
|
||||
options.cleanup = true;
|
||||
}
|
||||
if (args.includes('--nodeFirst')) {
|
||||
options.nodeFirst = true;
|
||||
}
|
||||
|
||||
const ignorePackages = collectOptionValues(args, '--ignorePackages');
|
||||
if (ignorePackages.length > 0) {
|
||||
options.ignorePackages = ignorePackages;
|
||||
}
|
||||
|
||||
const configIdx = args.indexOf('--config');
|
||||
if (configIdx !== -1 && args[configIdx + 1]) {
|
||||
options.tsdownConfigPath = args[configIdx + 1];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line antfu/no-top-level-await
|
||||
await build(options);
|
||||
}
|
||||
Reference in New Issue
Block a user