Skip to content

Commit

Permalink
fix(build): Add banner for plugins & multiple bundle.
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Mar 15, 2024
1 parent 111d621 commit 94e2a79
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/plugins/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { build } from 'vite'
import { globSync } from 'glob'
import chokidar from 'chokidar'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
import banner from 'vite-plugin-banner'

const external = ['@oplayer/core', 'm3u8-parser']

Expand All @@ -13,7 +14,7 @@ const globals = {
}

async function buildPlugin(name, dev) {
const { version } = JSON.parse(fs.readFileSync(`package.json`, 'utf-8'))
const { version, description, author, homepage } = JSON.parse(fs.readFileSync(`package.json`, 'utf-8'))
const pluginName = name.split('.').shift()
const now = Date.now()
console.log(`👾 Start built ${pluginName} ··· `)
Expand All @@ -31,7 +32,12 @@ async function buildPlugin(name, dev) {
},
rollupOptions: { external, output: { dir: 'dist', globals } }
},
plugins: [cssInjectedByJsPlugin()],
plugins: [
cssInjectedByJsPlugin(),
banner(
`/**\n * name: ${name}\n * version: v${version}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */`
)
],
define: { __VERSION__: `'${version}'` }
})

Expand Down
4 changes: 4 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UnRelease

## [1.2.36-beta.2]

- fix keyboard config conflicts.

## [1.2.36-beta.0]

- any px -> rem.
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oplayer/ui",
"version": "1.2.36-beta.1",
"version": "1.2.36-beta.2",
"description": "ui plugin for oplayer",
"type": "module",
"main": "./dist/index.es.js",
Expand Down
10 changes: 9 additions & 1 deletion packages/ui/vite.core.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LibraryOptions } from 'vite'
import banner from 'vite-plugin-banner'
import { viteConfig } from '../../vite.config'
import { version as CoreVersion, name as CoreName, author, description, homepage } from '../core/package.json'
import { version as UIVersion, name as UIName } from '../ui/package.json'

export default viteConfig('ui', {
build: {
Expand All @@ -14,5 +17,10 @@ export default viteConfig('ui', {
formats: ['umd'],
fileName: () => 'index.ui.js'
} as LibraryOptions
}
},
plugins: [
banner(
`/**\n * name: ${CoreName} + ${UIName}\n * version: v${CoreVersion} + v${UIVersion}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */`
)
]
})

0 comments on commit 94e2a79

Please sign in to comment.