diff --git a/.circleci/config.yml b/.circleci/config.yml index 635b798f621c3e..21f1be785db934 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,29 +71,62 @@ jobs: - run: name: material-ui-icons command: | - if [[ ((`git diff --raw master | grep packages/material-ui-icons` > 0))]]; then + # latest commit + LATEST_COMMIT=$(git rev-parse HEAD) + + # latest commit where packages/material-ui-icons was changed + FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/material-ui-icons) + + if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then echo "changes, let's run the tests" cd packages/material-ui-icons && yarn test else - echo "no changes " + echo "no changes" fi - run: name: material-ui-codemod command: | - if [[ ((`git diff --raw master | grep packages/material-ui-codemod` > 0))]]; then + # latest commit + LATEST_COMMIT=$(git rev-parse HEAD) + + # latest commit where packages/material-ui-codemod was changed + FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/material-ui-codemod) + + if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then echo "changes, let's run the tests" cd packages/material-ui-codemod && yarn test else - echo "no changes " + echo "no changes" + fi + - run: + name: material-ui-lab + command: | + # latest commit + LATEST_COMMIT=$(git rev-parse HEAD) + + # latest commit where packages/material-ui-lab was changed + FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/material-ui-lab) + + if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then + echo "changes, let's run the tests" + cd packages/material-ui-lab && yarn test + else + echo "no changes" fi - run: name: eslint-plugin-material-ui command: | - if [[ ((`git diff --raw master | grep packages/eslint-plugin-material-ui` > 0))]]; then + # latest commit + LATEST_COMMIT=$(git rev-parse HEAD) + + # latest commit where packages/eslint-plugin-material-ui was changed + FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/eslint-plugin-material-ui) + + if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then echo "changes, let's run the tests" cd packages/eslint-plugin-material-ui && yarn test else - echo "no changes " + echo "no changes" fi test_build: <<: *defaults diff --git a/packages/material-ui-icons/builder.js b/packages/material-ui-icons/builder.js index a9a372ee94799b..17f3433bb76779 100755 --- a/packages/material-ui-icons/builder.js +++ b/packages/material-ui-icons/builder.js @@ -133,7 +133,8 @@ async function worker({ svgPath, options, renameFilter, template }) { .replace(/ clip-path=".+?"/g, '') // Fix visibility issue and save some bytes. .replace(//g, ''); // Remove unused definitions - const size = Number(svgPath.match(/^.*_([0-9]+)px.svg$/)[1]); + const sizeMatch = svgPath.match(/^.*_([0-9]+)px.svg$/); + const size = sizeMatch ? Number(sizeMatch[1]) : null; if (size !== 24) { const scale = Math.round((24 / size) * 100) / 100; // Keep a maximum of 2 decimals diff --git a/packages/material-ui-icons/builder.test.js b/packages/material-ui-icons/builder.test.js index 4b0c454d536a42..c0069f753ee18d 100644 --- a/packages/material-ui-icons/builder.test.js +++ b/packages/material-ui-icons/builder.test.js @@ -100,7 +100,7 @@ describe('builder', () => { 'svg', '000000', 'transparent', - 'dice-six-faces-four.js', + 'Dice-six-faces-four.js', ); assert.strictEqual(fs.existsSync(actualFilePath), true);