mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-30 11:16:12 +08:00
4e99d0b5ba
* build!: simplify build & support native esm import * build: refactor build * refactor: reorganize files * refactor: refactor build * build: improve perf * fix: scripts * build: add rollup-plugin-filesize * chore: scripts ignore no-console * build: disable tree-shaking * build: improve code * build: add sourcemap * build: add banner * refactor: remove annotation * build!: improve esm exports (#3871) * build: improve esm import * refactor: change mjs for esm version * chore: improve exports map * fix: add sideEffects * refactor: improve alias * build: upgrade dependencies
67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import path from 'path'
|
|
import { series, parallel } from 'gulp'
|
|
import { run } from './utils/process'
|
|
import { withTaskName } from './utils/gulp'
|
|
import { buildOutput, epOutput, epPackage, projRoot } from './utils/paths'
|
|
import { buildConfig } from './build-info'
|
|
import type { TaskFunction } from 'gulp'
|
|
import type { Module } from './build-info'
|
|
|
|
const runTask = (name: string) =>
|
|
withTaskName(name, () => run(`pnpm run build ${name}`))
|
|
|
|
export const copyFiles = () => {
|
|
const copyTypings = async () => {
|
|
const src = path.resolve(projRoot, 'typings', 'global.d.ts')
|
|
await run(`cp ${src} ${epOutput}`)
|
|
}
|
|
|
|
return Promise.all([
|
|
run(`cp ${epPackage} ${path.join(epOutput, 'package.json')}`),
|
|
run(`cp README.md ${epOutput}`),
|
|
copyTypings(),
|
|
])
|
|
}
|
|
|
|
export const copyTypesDefinitions: TaskFunction = (done) => {
|
|
const src = `${buildOutput}/types/`
|
|
const copy = (module: Module) =>
|
|
withTaskName(`copyTypes:${module}`, () =>
|
|
run(`rsync -a ${src} ${buildConfig[module].output.path}/`)
|
|
)
|
|
|
|
return parallel(copy('esm'), copy('cjs'))(done)
|
|
}
|
|
|
|
export const copyFullStyle = async () => {
|
|
await run(`mkdir -p ${epOutput}/dist/fonts`)
|
|
await Promise.all([
|
|
run(`cp ${epOutput}/theme-chalk/index.css ${epOutput}/dist/index.css`),
|
|
run(`cp -R ${epOutput}/theme-chalk/fonts ${epOutput}/dist`),
|
|
])
|
|
}
|
|
|
|
export default series(
|
|
withTaskName('clean', () => run('pnpm run clean')),
|
|
|
|
parallel(
|
|
runTask('buildModules'),
|
|
runTask('buildFullBundle'),
|
|
runTask('generateTypesDefinitions'),
|
|
runTask('buildHelper'),
|
|
series(
|
|
withTaskName('buildThemeChalk', () =>
|
|
run('pnpm run -C packages/theme-chalk build')
|
|
),
|
|
copyFullStyle
|
|
)
|
|
),
|
|
|
|
parallel(copyTypesDefinitions, copyFiles)
|
|
)
|
|
|
|
export * from './types-definitions'
|
|
export * from './modules'
|
|
export * from './full-bundle'
|
|
export * from './helper'
|