Skip to content

Commit

Permalink
fix: compatible with cp command
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Apr 4, 2024
1 parent a1b857c commit 7c19fd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -29,7 +29,7 @@
"README.md"
],
"scripts": {
"build": "rollup -c && cp ./src/index.d.ts ./dist/magic-string.es.d.mts && cp ./src/index.d.ts ./dist/magic-string.cjs.d.ts",
"build": "rollup -c",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"format": "prettier --single-quote --print-width 100 --use-tabs --write src/*.js src/**/*.js",
"lint": "eslint src test && publint",
Expand Down
12 changes: 11 additions & 1 deletion rollup.config.mjs
@@ -1,5 +1,6 @@
import nodeResolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import fs from 'node:fs';

const plugins = [
nodeResolve(),
Expand All @@ -11,7 +12,16 @@ export default [
{
input: 'src/index.js',
external: ['@jridgewell/sourcemap-codec'],
plugins,
plugins: [
...plugins,
{
name: 'copy-typescript-files',
generateBundle() {
fs.copyFileSync('src/index.d.ts', 'dist/magic-string.es.d.mts');
fs.copyFileSync('src/index.d.ts', 'dist/magic-string.cjs.d.ts');
}
}
],
output: {
file: 'dist/magic-string.es.mjs',
format: 'es',
Expand Down

0 comments on commit 7c19fd8

Please sign in to comment.