Skip to content

Commit

Permalink
change the build work
Browse files Browse the repository at this point in the history
  • Loading branch information
cavencj committed Oct 23, 2024
1 parent 8fbcd10 commit dd7e512
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ async function buildModules(options) {
charts: 'charts',
}),
],
minify: options.minify,
outfile: path.join('dist', 'modules-iife.js'),
})
}
Expand All @@ -130,6 +131,7 @@ async function buildModules(options) {
define: {
TransformStream: 'null',
},
minify: options.minify,
outfile: path.join('dist', 'index.js'),
})
}
Expand Down Expand Up @@ -199,7 +201,7 @@ async function deleteTempFile() {
await gulp.src(['dist/modules-iife.js'], { read: false }).pipe(clean())
}

async function regenerate(option, content) {
async function regenerate(option) {
await fse.remove('dist/dc.min.js')
await fse.remove('dist/dc.min.css')
await buildModules(option)
Expand All @@ -222,13 +224,13 @@ export const dev = gulp.series(
})
watcher
.on('ready', async () => {
await regenerate({ iife: true })
await regenerate({ iife: true, minify: false })
await startServer()
})
.on('change', async () => {
let now = new Date().getTime()
try {
await regenerate({ iife: true })
await regenerate({ iife: true, minify: false })
shell.echo(
chalk.green(`regenerate lib takes ${new Date().getTime() - now} ms`)
)
Expand All @@ -248,25 +250,25 @@ export const buildIIFE = gulp.series(
)

export const buildNode = gulp.series(
() => buildModules({ node: true }),
() => buildModules({ node: true, minify: true }),
() => combineJs({ node: true }),
() => buildCSS({ minify: true }),
copyAssets
)

export const build = gulp.series(
() => buildModules({ iife: true }),
() => buildModules({ iife: true, minify: true }),
() => combineJs({ iife: true }),
() => buildModules({ node: true }),
() => buildModules({ node: true, minify: true }),
() => combineJs({ node: true }),
() => buildCSS({ minify: true }),
copyAssets
)

export const buildRelease = gulp.series(
() => buildModules({ iife: true }),
() => buildModules({ iife: true, minify: true }),
() => combineJs({ iife: true }),
() => buildModules({ node: true }),
() => buildModules({ node: true, minify: true }),
() => combineJs({ node: true }),
() => buildCSS({ minify: true }),
copyAssets
Expand Down
1 change: 1 addition & 0 deletions src/modules/viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Viewer {
) {
throw new Error('Viewer: the container is empty')
}

if (container instanceof HTMLElement) {
throw new Error('Viewer: not support the type container')
}
Expand Down

0 comments on commit dd7e512

Please sign in to comment.