feat: script/dev.ts
This commit is contained in:
1 parent
a889da2dba
commit
3210954fac
3 files changed
+107
-26
No files matched your search
+6
-26
@@ -1,34 +1,14 @@
|
||||
import { join, relative } from 'path'
|
||||
import { readdirSync } from 'fs'
|
||||
import { OutputOptions, rollup, RollupOptions, RollupOutput, RollupError } from 'rollup'
|
||||
import { rollup, RollupOptions, OutputOptions, RollupOutput } from 'rollup'
|
||||
import { build as viteBuild2 } from 'vite'
|
||||
import { optionsFactory } from './rollup.config'
|
||||
|
||||
export type BuildResult = [RollupError | null, RollupOutput | null]
|
||||
import {
|
||||
mainOptions,
|
||||
preloadOptions,
|
||||
BuildResult,
|
||||
} from './utils'
|
||||
|
||||
const TAG = '[build.ts]'
|
||||
|
||||
function mainOptions() {
|
||||
return optionsFactory({
|
||||
input: join(__dirname, '../main/index.ts'),
|
||||
output: {
|
||||
dir: 'dist/main',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function preloadOptions() {
|
||||
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',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// build main、preload
|
||||
async function rollupBuild(options: RollupOptions): Promise<BuildResult> {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user