| 1 | import fs from 'node:fs/promises' |
| 2 | import path from 'node:path' |
| 3 | import fg from 'fast-glob' |
| 4 | |
| 5 | // copy assets to the dist folder so imports from relative paths still work |
| 6 | for await (const asset of fg.stream([ |
| 7 | 'public/**/*', |
| 8 | 'src/**/*.css' |
| 9 | ], {})) { |
| 10 | const dest = path.join('dist', asset) |
| 11 | const dir = path.join('dist', path.dirname(asset)) |
| 12 | await fs.mkdir(dir, { |
| 13 | recursive: true |
| 14 | }) |
| 15 | await fs.cp(asset, dest) |
| 16 | } |