Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@jswork/next-replace-in-file

afeiship1MIT1.0.0

File content replace for next.

next, file, replace, in, content, string, regexp, glob, pattern, globby

readme

next-replace-in-file

File content replace for next.

version license size download

installation

npm install -S @jswork/next-replace-in-file

usage

Basic usage. `js import '@feizheng/next-replace-in-file';

// basic usage: nx.replaceInFile('test/', [[/VERSION/gi, 'version']]); nx.replaceInFile(['','!node_modules'], [[/VERSION/gi, 'version']]);

// or you can multiple replace: nx.replaceInFile( 'test/*', [ [/VERSION/gi, 'VERSION'], [/file/g, 'FILE'], [/description/g,'DESC'], ], { ignore: ['/test.js'] } ); `

globby

Just a quick overview.

  • * matches any number of characters, but not /
  • ? matches a single character, but not /
  • ** matches any number of characters, including /, as long as it's the only thing in a path part
  • {} allows for a comma-separated list of "or" expressions
  • ! at the beginning of a pattern will negate the match

options

Not fully, because fast-glob does not implement all options of node-glob. See table below.

node-glob(😂) fast-glob(😎)
cwd cwd
root
dot dot
nomount
mark markDirectories
nosort
nounique unique
nobrace nobrace or brace
noglobstar noglobstar or globstar
noext noext or extension
nocase nocase or case
matchBase matchbase
nodir onlyFiles
ignore ignore
follow followSymlinkedDirectories
realpath
absolute absolute

resources

license

Code released under the MIT license.