refactor(tooling): [MOD-PLUGIN-01] generate typed plugins with safe output handling

This commit is contained in:
Harvey Zhao committed 2026-09-14 10:19:19 +08:00
1 parent 07d5bfef2e
commit 28c7abb2bb
32 files changed
+958 -161

No files matched your search

+16
View File
@@ -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.')
}