Created
May 29, 2019 01:50
-
-
Save banyudu/02f443058e720bfc6d052a85859af769 to your computer and use it in GitHub Desktop.
Remove props types from js files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
for (let i = 2; i < process.argv.length; i++) { | |
const filename = process.argv[i] | |
let content = fs.readFileSync(filename, 'utf-8') | |
if (/static propTypes = {/.test(content)) { | |
content = content.replace(/static propTypes = {[^{}]*({[^{}]*})*[^{}]*}\n/, '') | |
fs.writeFileSync(filename, content) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment