0.2.13 • Published 3 years ago

fsdir v0.2.13

Weekly downloads
217
License
ISC
Repository
github
Last release
3 years ago

fsdir

Install

npm i -D fsdir

JavaScript

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')
  })

CLI

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

0.2.13

3 years ago

0.2.12

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.4

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago