INNER CODE UNIT · TypeScript

serverIndex

tenseijs/tensei · packages/cli/src/BaseCommands/MakePlugin/plugin/server/index.ts:3

export function serverIndex(options: MakePluginOptions): FileContent {
  const className = `${options.name.pascal}Plugin`

  return {
    content: `import Path from 'path'
import { plugin } from '@tensei/common'

class ${className} {
  plugin() {
    ${
      options.withFrontend
        ? `return plugin('${options.name.pascal} Plugin').register(({ script }) => {
      script('${options.name.camel}.js', Path.resolve(__dirname, 'public/app.js'))
    })`
        : `return plugin('${options.name.pascal} Plugin').register(({  }) => {
          
        })`
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…