diff --git a/packages/core/package.json b/packages/core/package.json index 31bad5ff70..13f1b45502 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -78,7 +78,6 @@ "chromatic:local": "chromatic -t $CHROMATIC_PROJECT_TOKEN", "link-local": "npm link && npm start", "plop": "plop", - "add-ref-to-icons": "node ./scripts/add-forward-ref-icons.js", "lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\"", "lint:fix": "yarn lint -- --fix", "stylelint": "stylelint \"**/*.scss\"", diff --git a/packages/core/scripts/add-forward-ref-icons.js b/packages/core/scripts/add-forward-ref-icons.js deleted file mode 100644 index 75d5f32e57..0000000000 --- a/packages/core/scripts/add-forward-ref-icons.js +++ /dev/null @@ -1,44 +0,0 @@ -var fs = require("fs"); - -const startReplaceOrigin = "({size, ...props}) => ("; -const startReplaceReplaced = " React.forwardRef(({size, ...props}, ref) => ("; -const replaceRefOrigin = "{...props}>"; -const replaceRefReplaced = "{...props} ref={ref}>"; -const endReplaceOrigin = ");"; -const endReplaceReplaced = "));"; - -function readFiles(dirname, onFileContent, onError) { - fs.readdir(dirname, function(err, filenames) { - if (err) { - onError(err); - return; - } - filenames.forEach(function(filename) { - fs.readFile(dirname + filename, "utf-8", function(err, content) { - if (err) { - onError(err); - return; - } - onFileContent(filename, content); - }); - }); - }); -} -const dirName = "src/components/Icon/Icons/components/"; -readFiles( - dirName, - function(filename, content) { - console.log("optimizing:: ", filename); - const newContent = content - .replace(replaceRefOrigin, replaceRefReplaced) - .replace(startReplaceOrigin, startReplaceReplaced) - .replace(endReplaceOrigin, endReplaceReplaced); - - fs.writeFile(`${dirName}/${filename}`, newContent, "utf8", function(err) { - if (err) return console.log(err); - }); - }, - function(err) { - throw err; - } -);