New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fsdir

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fsdir

CLI tool for running commands on reveral files

latest
Source
npmnpm
Version
0.2.13
Version published
Maintainers
1
Created
Source

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_CWDDIRFILE_BASE      │
├────────────┬────────────────────┴──────────────────────┤
│            │                FILE_PATH                  │
│  FILE_CWD  ├────────────────────┬───────────┬──────────┤
│            │      FILE_DIRFILE_NAMEFILE_EXT │
│            │                    │           │          │
"     src    /   component/styles / component     .css   "
└────────────┴────────────────────┴───────────┴──────────┘

Also: `FILE_ROOTPATH` is filepath from system root 

Keywords

cli

FAQs

Package last updated on 22 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts