🔧(react) rollup type files
Previously types file were splitted into their original folder tree structure. By enabling this option we could just get one global .d.ts file. To make this more handy I created a dedicated build bash file, the package.json was starting to get messy.
This commit is contained in:
5
.changeset/khaki-bananas-leave.md
Normal file
5
.changeset/khaki-bananas-leave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@openfun/cunningham-react": minor
|
||||
---
|
||||
|
||||
fix type files imports and rollup them
|
||||
7
packages/react/build
Executable file
7
packages/react/build
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
tsc
|
||||
yarn build-theme
|
||||
vite build
|
||||
yarn build-fonts
|
||||
yarn build-icons
|
||||
cp -R src/locales dist/
|
||||
@@ -28,7 +28,7 @@
|
||||
"scripts": {
|
||||
"lint": "eslint . 'src/**/*.{ts,tsx}'",
|
||||
"dev": "yarn storybook & nodemon --watch src --ext '*' --ignore src/cunningham-tokens.ts --ignore src/cunningham-tokens.js --ignore src/cunningham-tokens.css --exec npm run build",
|
||||
"build": "tsc && yarn build-theme && vite build && yarn build-fonts && yarn build-icons",
|
||||
"build": "./build",
|
||||
"build-fonts": "vite build -c vite.fonts.config.ts && rm -rf dist/fonts.js && mkdir -p dist/sass && cp src/fonts.scss dist/sass/",
|
||||
"build-icons": "vite build -c vite.icons.config.ts && rm -rf dist/icons.js && mkdir -p dist/sass && cp src/icons.scss dist/sass/",
|
||||
"build-theme": "cunningham -o src -g css,ts,js",
|
||||
|
||||
@@ -26,7 +26,19 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [tsconfigPaths(), dts(), react()],
|
||||
plugins: [
|
||||
tsconfigPaths(),
|
||||
dts({
|
||||
rollupTypes: true,
|
||||
beforeWriteFile: (filePath, content) => {
|
||||
return {
|
||||
filePath,
|
||||
content: content.replace("../../locales", "./locales"),
|
||||
};
|
||||
},
|
||||
}),
|
||||
react(),
|
||||
],
|
||||
test: {
|
||||
environment: "jsdom",
|
||||
reporters: "verbose",
|
||||
|
||||
Reference in New Issue
Block a user