0.0.8 • Published 9 years ago
replacestuff v0.0.8
replacestuff
Replaces strings in files. Useful creating a npm only build pipeline. Inspired by https://github.com/harthur/replace .
Strings can be replaced by other strings, environment variables and the current git version hash (SHA).
Does not follow symlinks.
Installing
npm install -g replacestuffUsing
To see all options
replacestuff --helpIn-place replace:
replacestuff s1 s2 dist/**/*.htmlDifferent output folder
replacestuff s1 s2 **/* --basedir=build --output=dist/With replacestuff.json configuration
If there are several strings to replace, it's better to use a replacestuff.json file.
[
{ search: 'search0', replace: 'replace0' },
{ searchRegExp: 'search1', replace: 'replace1' },
{ search: 'search2', replaceVar: 'gitsha' },
{ search: 'search3', replaceEnv: 'replace3' }
]In this example
- the string 'search' will be replaced by 'replace0'.
- strings matching the regular expression 'search1' will be replaced by 'replace1'.
- the string 'search2' will be replaced by the current git version hash.
- the string 'search3' will be replaced by the value of the environment variable 'replace3'.
Keep in mind that each replacement happens in the same order as in the replacestuff.json.
Test
npm test
Develop
npm run dev:watch
Update version
npm version major|minor|patch
npm publish
git pushTslint
rules
License
Copyright (c) 2016 Wouter Mooij.
Licensed under the MIT License.
