Skip to content

Commit

Permalink
update scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Mar 15, 2024
1 parent 59bc73c commit 3189ac1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/core/src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ export class Player<Context extends Record<string, any> = Record<string, any>> {
return new Promise<void>((resolve, reject) => {
if (this.isSourceChanging) return reject(Error('Previous Source is Changing.'))

this.pause()
this.hasError = false
this.isSourceChanging = true
this.emit(options.preEvent, sourceLike)
Expand Down
11 changes: 6 additions & 5 deletions packages/plugins/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const globals = {

async function buildPlugin(name, dev) {
const { version, description, author, homepage } = JSON.parse(fs.readFileSync(`package.json`, 'utf-8'))
const pluginName = name.split('.').shift()
const outfileName = name
const pluginName = name=='index'?'@oplayer/plugins':`@oplayer/${outfileName}`
const now = Date.now()
console.log(`👾 Start built ${pluginName} ··· `)

Expand All @@ -27,15 +28,15 @@ async function buildPlugin(name, dev) {
lib: {
entry: plugins[name],
formats: dev ? ['es'] : ['es', 'umd'],
name: dev ? undefined : 'O' + pluginName.charAt(0).toUpperCase() + pluginName.slice(1),
fileName: (format) => `${pluginName}.${{ es: 'es', umd: 'min' }[format]}.js`
name: dev ? undefined : 'O' + outfileName.charAt(0).toUpperCase() + outfileName.slice(1),
fileName: (format) => `${outfileName}.${{ es: 'es', umd: 'min' }[format]}.js`
},
rollupOptions: { external, output: { dir: 'dist', globals } }
},
plugins: [
cssInjectedByJsPlugin(),
banner(
`/**\n * name: ${name}\n * version: v${version}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */`
`/**\n * name: ${pluginName}\n * version: v${version}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */`
)
],
define: { __VERSION__: `'${version}'` }
Expand Down Expand Up @@ -85,5 +86,5 @@ if (process.argv.pop() == '--watch') {
console.log(`✨ Finished building all plugins!`)
})

buildPlugin('index', true)
// buildPlugin('index', true)
}
12 changes: 8 additions & 4 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"name": "@oplayer/plugins",
"version": "1.0.10-beta.2",
"author": "shiyiya",
"description": "oplayer's plugin",
"homepage": "https://github.com/shiyiya/oplayer",
"keywords": [
"oplayer",
"oplayer-plugins"
],
"license": "MIT",
"type": "module",
"main": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand All @@ -22,8 +29,5 @@
"glob": "^10.3.10",
"m3u8-parser": "^7.1.0",
"vite-plugin-css-injected-by-js": "^3.4.0"
},
"keywords": [],
"author": "",
"license": "ISC"
}
}

0 comments on commit 3189ac1

Please sign in to comment.