diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2025-12-14 16:14:29 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2025-12-14 16:17:29 -0800 |
| commit | 8ec712c8c884110600954860c21f58107455cfdc (patch) | |
| tree | 5e5b16ec8b0a1d15d58beae5bc8a7fd5285c6d0e /rolldown.config.js | |
| parent | db0d9b80b4412a46cae0e58997f4baa7213948e3 (diff) | |
| download | adelie-8ec712c8c884110600954860c21f58107455cfdc.tar.gz adelie-8ec712c8c884110600954860c21f58107455cfdc.zip | |
Move to typescript
Diffstat (limited to 'rolldown.config.js')
| -rw-r--r-- | rolldown.config.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/rolldown.config.js b/rolldown.config.js new file mode 100644 index 0000000..6cc7765 --- /dev/null +++ b/rolldown.config.js @@ -0,0 +1,36 @@ +import { rolldown } from 'rolldown'; +import fs from 'fs-extra'; +import path from 'path'; + +const production = process.env.NODE_ENV === 'production'; + +async function build() { + try { + await fs.remove('dist'); + await fs.ensureDir('dist'); + + const jsBundle = await rolldown({ + input: 'src/js/script.ts', + output: { + file: 'dist/bundle.js', + format: 'es', + sourcemap: !production, + }, + }); + + await jsBundle.write(); + + await fs.copy('src/css/style.css', 'dist/bundle.css'); + await fs.copy('src/assets', 'dist', { + overwrite: true, + }); + + let html = await fs.readFile('src/index.html', 'utf8'); + await fs.writeFile('dist/index.html', html); + } catch (err) { + console.error('Build failed:', err); + process.exit(1); + } +} + +build(); |
