feat: script/dev.ts

This commit is contained in:
草鞋没号 committed 2021-11-01 20:57:17 +08:00
1 parent a889da2dba
commit 3210954fac
3 files changed
+107 -26

No files matched your search

+32
View File
@@ -1 +1,33 @@
import { join } from 'path'
import { readdirSync } from 'fs'
import { OutputOptions, rollup, RollupOptions, RollupOutput, RollupError } from 'rollup'
import { optionsFactory } from './rollup.config'
export type BuildResult = [RollupError | null, RollupOutput | null]
function mainOptions(): RollupOptions {
return optionsFactory({
input: join(__dirname, '../main/index.ts'),
output: {
dir: 'dist/main',
},
})
}
function preloadOptions(): RollupOptions {
const dirs = readdirSync(join(__dirname, '../preload'))
const inputs = dirs.filter(name => /^index\..+\.ts$/.test(name))
return optionsFactory({
input: inputs.map(input => join(__dirname, '../preload', input)),
output: {
dir: 'dist/preload',
},
})
}
export {
mainOptions,
preloadOptions,
}