Skip to content

Commit

Permalink
fix: actually provide js modules, not just tsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
joschka committed Dec 20, 2023
1 parent ea97306 commit d7e396e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
material-ui
tmp
files.txt
34 changes: 26 additions & 8 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,29 @@ set -o nounset
set -o pipefail
set -o verbose

original_svg_path="./material-ui/packages/mui-icons-material/material-icons"
react_dist_path="./dist/react"
svg_dist_path="./dist/svg"

mkdir --parents $react_dist_path $svg_dist_path
git clone --depth=1 --branch=master "https://github.com/mui/material-ui.git"
cp $original_svg_path/*.svg $svg_dist_path
npx @svgr/cli --no-svgo --no-index --typescript --out-dir $react_dist_path -- $svg_dist_path
tmp_path="./tmp"
react_tmp_path=$tmp_path"/react"
original_svg_path=$tmp_path"/material-ui/packages/mui-icons-material/material-icons"
dist_path="./dist/"

rm -rf $tmp_path $dist_path

mkdir --parents $react_tmp_path $dist_path

git clone --depth=1 --branch=master "https://github.com/mui/material-ui.git" $tmp_path/material-ui

rm $original_svg_path/screen_search_desktop_24px.svg

for file in $original_svg_path/*_24px.svg;
do
mv "$file" "${file/_24px/}"
done

npx @svgr/cli --typescript --no-svgo --out-dir $react_tmp_path -- $original_svg_path

ls $react_tmp_path > files.txt

cd $react_tmp_path

npx tsc --jsx react-jsx --outDir ../../$dist_path --declaration --declarationDir ../../$dist_path @../../files.txt

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "@digitalservicebund/icons",
"version": "0.0.0-development",
"description": "icons",
"main": "./index.js",
"types": "./index.d.ts",
"scripts": {
"build": "./build && cp package.json README.md dist",
"test": "exit 0"
Expand Down Expand Up @@ -29,6 +31,7 @@
"@mui/icons-material": "*",
"@svgr/cli": "^8.1.0",
"lefthook": "^1.5.5",
"semantic-release": "^22.0.12"
"semantic-release": "^22.0.12",
"typescript": "^5.3.3"
}
}

0 comments on commit d7e396e

Please sign in to comment.