Skip to content

Instantly share code, notes, and snippets.

@banyudu
Created May 29, 2019 01:50
Show Gist options
  • Save banyudu/02f443058e720bfc6d052a85859af769 to your computer and use it in GitHub Desktop.
Save banyudu/02f443058e720bfc6d052a85859af769 to your computer and use it in GitHub Desktop.
Remove props types from js files
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