Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @Author : Caven Chen
  3. */
  4. import express from 'express'
  5. import portfinder from 'portfinder'
  6. import fse from 'fs-extra'
  7. import shell from 'shelljs'
  8. import chalk from 'chalk'
  9. export default function start() {
  10. let dist = 'dist'
  11. const server = express()
  12. portfinder.setBasePort(8081)
  13. fse.exists(dist, (exists) => {
  14. if (exists) {
  15. portfinder.getPort((err, port) => {
  16. server.listen(port)
  17. shell.echo('\nExamples running at: ')
  18. shell.echo('- Local: ' + chalk.yellow(`http://localhost:${port}`))
  19. shell.echo('\n')
  20. server.use('/libs/dc-sdk/', express.static(dist))
  21. server.use(express.static('examples'))
  22. })
  23. } else {
  24. shell.echo(chalk.red(`please run build first`))
  25. }
  26. })
  27. }