From d7e396efd3bb985a668516e4000c88b781f2bafd Mon Sep 17 00:00:00 2001 From: Joschka de Cuveland Date: Wed, 20 Dec 2023 18:21:53 +0100 Subject: [PATCH] fix: actually provide js modules, not just tsx files --- .gitignore | 3 ++- build | 34 ++++++++++++++++++++++++++-------- package-lock.json | 4 ++-- package.json | 5 ++++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 5759a9a..ca1d544 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist -material-ui +tmp +files.txt \ No newline at end of file diff --git a/build b/build index 5febe51..4fc2687 100755 --- a/build +++ b/build @@ -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 \ No newline at end of file +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 + diff --git a/package-lock.json b/package-lock.json index 8ff2fb5..07a22b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ "@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" } }, "node_modules/@ampproject/remapping": { @@ -9207,7 +9208,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index b1ef3e6..338b7f8 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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" } }