-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codemods): exportation of vite build for codemods
- Loading branch information
1 parent
3fcf71d
commit 3b41c0c
Showing
5 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ server | |
**/*.test.tsx | ||
__mocks__ | ||
./vite.config.ts | ||
./vite.codemods.config.ts | ||
./rollup.config.js | ||
!.storybook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ build-storybook.log | |
./bundle-analysis.html | ||
|
||
vite.config.ts* | ||
vite.codemods.config.ts* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import path from 'path'; | ||
import fg from 'fast-glob'; | ||
import { defineConfig } from 'vite'; | ||
import dts from 'vite-plugin-dts'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
|
||
const codemodsEntries = Object.fromEntries( | ||
fg | ||
.sync('codemods/**/*.ts') | ||
.map((file) => [ | ||
path.relative('codemods', file.slice(0, file.length - path.extname(file).length)), | ||
path.resolve(file), | ||
]) | ||
); | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
tsconfigPaths(), | ||
dts({ | ||
outDir: path.resolve(__dirname, 'dist/codemods'), | ||
include: ['codemods/**/*.ts'], | ||
exclude: ['__mocks__'], | ||
}), | ||
], | ||
build: { | ||
rollupOptions: { | ||
input: codemodsEntries, | ||
output: { | ||
dir: path.resolve(__dirname, 'dist/codemods'), | ||
format: 'es', | ||
entryFileNames: '[name].js', | ||
}, | ||
external: ['react', 'react-dom', 'emotion-reset', /@emotion\/styled/, /@emotion\/react/], | ||
}, | ||
}, | ||
}); |