mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-11 05:26:15 -08:00
refactor(tooling): [MOD-PLUGIN-01] generate typed plugins with safe output handling
This commit is contained in:
1 parent
07d5bfef2e
commit
28c7abb2bb
32 files changed
+958
-161
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { publishPlugin } from './publish.ts'
|
||||
import { renderPlugin } from './render.ts'
|
||||
|
||||
export function createPlugin(root: string, args: string[]): void {
|
||||
if (args.length === 1 && args[0] === '--help') {
|
||||
console.log('Usage: yarn create:plugin <lowercase-plugin-name>')
|
||||
return
|
||||
}
|
||||
if (args.length !== 1 || !args[0])
|
||||
throw new Error('Provide exactly one plugin name. Use yarn create:plugin --help')
|
||||
const name = args[0]
|
||||
publishPlugin(root, name, renderPlugin(name))
|
||||
console.log(`Created artplayer-plugin-${name} and example ${name.replaceAll('-', '.')}.js`)
|
||||
console.log(`Next: yarn build artplayer-plugin-${name}; yarn workspace artplayer-plugin-${name} test`)
|
||||
console.log('Register the new workspace/demo in the refactor inventories and update the root Yarn lock before CI.')
|
||||
}
|
||||
Reference in new issue
Block a user