Skip to content

Instantly share code, notes, and snippets.

@DDR0
Created July 6, 2017 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DDR0/55735b95835f7f488db56ca2e1cef94b to your computer and use it in GitHub Desktop.
Save DDR0/55735b95835f7f488db56ca2e1cef94b to your computer and use it in GitHub Desktop.
#!/bin/bash
#Fix babel compilation error; --plugins transform-class-properties likes to make global functions which overwrite each other if you have two files with class properties.
#This should be fixed by using webpack. See https://github.com/markerikson/react-redux-links/blob/master/webpack-tutorials.md
set -eu
set -o pipefail
MODULENAME=$(echo $1 | perl -lne 's/([^\/]*?)\.// or next; s/\s.*//; print $1') #extract the filename from the path
perl -pi.bak -e "s|_initialiseProps|_initialiseProps_in_${MODULENAME//-/_}|g" $1 && rm $1.bak #rename all occurences of _initialiseProps, appending _in_«file_name»
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment