import { join } from 'path'
import { run } from './utils/process'

import { version } from '../package.json'
import { packages } from './utils/packages'

async function publish() {
  await run('pnpm run build')

  let command = 'npm publish --access public --registry http://10.19.36.198:8081/repository/npm-local/'
  if (version.includes('beta')) {
    command += ' --tag beta'
  }

  for (const { name } of packages) {
    await run(command, join('packages', name, 'dist'))
  }
}

publish()
