fsdir
CLI tool for running commands on reveral files
Last updated 18 days ago by jgermade .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fsdir 
SYNC missed versions from official npm registry.

fsdir

Install

npm i -D fsdir
<summary> JavaScript </summary>
import eachFile from 'fsdir/eachFile'

eachFile('{,**/}* ; !{,**/}*.sass', (filepath) => console.log(`found file: ${filepath}`) )

eachFile(['{,**/}*', '!{,**/}*.sass'], (filepath) => console.log(`found file: ${filepath}`) )

import WatchDir from 'fsdir/WatchDir'

new WatchDir('./src')
  .when('{,**/}* ; !{,**/}*.sass', (filepath) => console.log(`${filepath} file has changed`) )
  .when('{,**/}*.sass', (filepath) => console.log('sass files changed') )
  .run( () => console.log('all when detected has finished) )

<summary> CLI </summary>
npx fsdir -d ./src \
  --each "{,**/}*.sass" "sass ${FILE_PATH} -o ${FILE_DIR}${FILE_NAME}.css"
npx fsdir -d ./src \
  --watch '{,**/}* ; !{,**/}*.sass' 'echo "file ${FILE_PATH} has changed"' \
  --watch '{,**/}*.sass' 'make css' \
  --after-watch 'echo "any watch has matched and all have finished"'

These are the environment variables injected to each command:

┌────────────────────────────────────────────────────────┐
│                    FILE_CWDPATH                        │
├─────────────────────────────────┬──────────────────────┤
│          FILE_CWDDIR            │       FILE_BASE      │
├────────────┬────────────────────┴──────────────────────┤
│            │                FILE_PATH                  │
│  FILE_CWD  ├────────────────────┬───────────┬──────────┤
│            │      FILE_DIR      │ FILE_NAME │ FILE_EXT │
│            │                    │           │          │
"     src    /   component/styles / component     .css   "
└────────────┴────────────────────┴───────────┴──────────┘

Also: `FILE_ROOTPATH` is filepath from system root 

Current Tags

  • 0.2.5                                ...           latest (18 days ago)

10 Versions

  • 0.2.5                                ...           18 days ago
  • 0.2.4                                ...           19 days ago
  • 0.2.3                                ...           19 days ago
  • 0.2.2                                ...           20 days ago
  • 0.2.1                                ...           20 days ago
  • 0.2.0                                ...           20 days ago
  • 0.1.4                                ...           20 days ago
  • 0.1.1                                ...           20 days ago
  • 0.1.0                                ...           21 days ago
  • 0.0.1                                ...           a month ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 85
Last Day 0
Last Week 0
Last Month 9
Dependencies (4)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |