Skip to content

Commit

Permalink
feat: update src/core/index.js to export all global APIs, deprecate o…
Browse files Browse the repository at this point in the history
…ld globals in favor of a single global DOCSIFY, and add tests for this
  • Loading branch information
trusktr committed May 23, 2020
1 parent b72cb3d commit 7e002bf
Show file tree
Hide file tree
Showing 7 changed files with 478 additions and 216 deletions.
13 changes: 12 additions & 1 deletion build/build.js
Expand Up @@ -9,6 +9,14 @@ const version = process.env.VERSION || require('../package.json').version
const chokidar = require('chokidar')
const path = require('path')

/**
* @param {{
* input: string,
* output?: string,
* globalName?: string,
* plugins?: Array<import('rollup').Plugin>
* }} opts
*/
async function build(opts) {
await rollup
.rollup({
Expand All @@ -29,6 +37,7 @@ async function build(opts) {
console.log(dest)
return bundle.write({
format: 'iife',
output: opts.globalName ? {name: opts.globalName} : {},
file: dest,
strict: false
})
Expand All @@ -40,13 +49,15 @@ async function buildCore() {

promises.push(build({
input: 'src/core/index.js',
output: 'docsify.js'
output: 'docsify.js',
globalName: 'DOCSIFY'
}))

if (isProd) {
promises.push(build({
input: 'src/core/index.js',
output: 'docsify.min.js',
globalName: 'DOCSIFY',
plugins: [uglify()]
}))
}
Expand Down

0 comments on commit 7e002bf

Please sign in to comment.