temject.copy

0.1.0 • Public • Published

temject.copy

Copy the file while converting with temject

temject - npm

Build Status FOSSA Status

function temject temjectCopy
temject
keyValueInjector
dateTimeInjector
expressions
expressionFiles
temjectCopy
temjectCopyRecursive

API

expressionFiles(glob [,opts])

Param Type Default Description
glob Array | string paths or glob
[opts] Object {} fast-glob
await expressionFiles('./testFiles/')
// -> ['foo','bar']
await expressionFiles(
  ['./testFiles/', '!**/ignore.txt'],
  { dot: false }
)

temjectCopy(srcPath, distPath, injections [, opts])

Param Type Default Description
srcPath string src file path
distPath string dist file path
injections Object inject key and value
[opts] Object {} options
[opts.plain] boolean false Plain copy
[opts.overwrite] boolean false Force overwrite

Example

// 'Hello, {{name:pascal}}!' > src.txt
const srcPath = 'src.txt'
const distPath = 'dist.txt'
await temjectCopy(srcPath, distPath, { name: 'world' })
// dist.txt -> 'Hello, World!'

temjectCopyRecursive(srcDir, distDir, injections [, opts])

Param Type Default Description
srcDir string src file directory or glob
distDir string dist directory path
injections Object inject key and value
[opts] Object {} options
[opts.dry] boolean false not copy
[opts.plainCopy] Array false not temject convert
[opts.overwrite] boolean false Force overwrite

Example

await temjectCopyRecursive(
  ['./testFiles'],
  './sample',
  { name: 'MyName' },
  { dot: false, dry: true }
)
await temjectCopyRecursive(
  ['./src/__tests__/testFiles'],
  './sample',
  { name: 'MyName' },
  { plainCopy: [/ignore.txt$/] } // no convert setting
)

Related

temject - npm

License

MIT © mick-whats

FOSSA Status

Install

npm i temject.copy

DownloadsWeekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

18 kB

Total Files

21

Last publish

Collaborators

  • whats