/** 在dist中添加html */

const fs = require('fs')
const rimraf = require('rimraf')
const file = './dist/index.html'

const html = `
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>组件列表</title>
  <script src="http://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
  <script src="http://cdn.bootcdn.net/ajax/libs/qs/6.10.1/qs.min.js"></script>
  <script type="module" crossorigin src="./component-lib.web.js"></script>
</head>

<body>
  <div id="app"></div>

</body>

</html>
`
rimraf(file, (err) => {
  if (err) return console.error(err)
  fs.writeFile(file, html, 'utf-8', (err) => {
    if (err) return console.error(err)
  })
  })
