banner.mjs 614 B

1234567891011121314151617181920
  1. import fs from 'node:fs/promises'
  2. import path from 'node:path'
  3. import { fileURLToPath } from 'node:url'
  4. const __dirname = path.dirname(fileURLToPath(import.meta.url))
  5. const pkgJson = path.join(__dirname, '../package.json')
  6. const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8'))
  7. const year = new Date().getFullYear()
  8. function getBanner(pluginFilename) {
  9. return `/*!
  10. * Tabler${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
  11. * Copyright 2018-${year} ${pkg.author}
  12. * Licensed under MIT (https://github.com/tabler/tabler/blob/main/LICENSE)
  13. */`
  14. }
  15. export default getBanner