Skip to content

Commit

Permalink
feat(fix): try to fix plugin build function
Browse files Browse the repository at this point in the history
  • Loading branch information
felixranesberger committed Sep 9, 2024
1 parent 81b4006 commit b8bc0d5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
1 change: 0 additions & 1 deletion build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
entries: [
'src/index',
'src/build',
],
declaration: true,
clean: true,
Expand Down
42 changes: 23 additions & 19 deletions src/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { build } from 'unbuild'
import type { BuildConfig } from 'unbuild'

interface Options {
Expand All @@ -8,27 +7,32 @@ interface Options {
}[]
}

/**
* Build CkEditor plugins using unbuild
*/
export function buildCkEditorPlugins(args: Options): void {
const config: BuildConfig = {
entries: args.plugins.map(plugin => ({
builder: 'rollup',
input: plugin.input,
outDir: plugin.outDir,
})),
externals: [
'@ckeditor/ckeditor5-core',
'@ckeditor/ckeditor5-engine',
'@ckeditor/ckeditor5-typing',
'@ckeditor/ckeditor5-ui',
'@ckeditor/ckeditor5-utils',
],
rollup: {
inlineDependencies: true,
},
};

// build files using unbuild
(async () => {
const { build } = await import('unbuild')

const config: BuildConfig = {
entries: args.plugins.map(plugin => ({
builder: 'rollup',
input: plugin.input,
outDir: plugin.outDir,
})),
externals: [
'@ckeditor/ckeditor5-core',
'@ckeditor/ckeditor5-engine',
'@ckeditor/ckeditor5-typing',
'@ckeditor/ckeditor5-ui',
'@ckeditor/ckeditor5-utils',
],
rollup: {
inlineDependencies: true,
},
}

await build('.', false, config)
})()
}
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { buildCkEditorPlugins } from './build'
import { injectContentToCursorPosition } from './lib/inject-content'
import { addTextWrapButton } from './lib/text-wrap'

export {
addTextWrapButton,
buildCkEditorPlugins,
injectContentToCursorPosition,
}

0 comments on commit b8bc0d5

Please sign in to comment.