find-extension-and-copy

1.0.2 • Public • Published

find-extension-and-copy

find the files by extensions and copy

usage - without defined in json

feac targetDir={parameter} extensions=[{extension}, {extension2}, {...args}] dist={parameter} replaceFolder={parameter}

"scripts": {
	"build-readme": "feac targetDir=readme extensions=[.md, .png] dist=readme replaceFolder=true"
}

usage - with defined in json

"scripts": {
	"build-readme": "feac"
}

package.json

	"feac": {
		"targetDir": "src",
		"extensions": [".md", ".png"],
        "dist": "readme",
        "replaceFolder": true
	}

root/feac.json

// project root/feac.json
{
    "targetDir": "src",
    "extensions": [".md", ".png"],
    "dist": "readme",
    "replaceFolder": true
}

configs/feac.json

// project root/configs/feac.json
{
    "targetDir": "src",
    "extensions": [".md", ".png"],
    "dist": "readme",
    "replaceFolder": true
}

ignore patches

add option 'ignore'

// project root/configs/feac.json
{
    "targetDir": "src",
    "extensions": [".md", ".png"],
    "dist": "readme",
    "ignore": ["node_modules"]
}

or

feac targetDir={parameter} extensions=[{extension}, {extension2}, {...args}] dist={parameter} replaceFolder={parameter} ignore=node_modules

example

I need all of src in .md, .png with folder

input

└─src                                   
    │  configs.ts                       
    │  finder.ts                        
    │  index.ts                         
    │  README.md                        
    │                                   
    └─files                              
        │  role.md                      
        │  test.ts        
        │                                   
        └─images                        
            area-spline.pne.png     
            area.png                
            column-chart.png        
            exmaple-bar-chart.png
            README.md

replaceFolder: true

"feac": {
    "targetDir": "src",
    "extensions": [".md", ".png"],
    "dist": "readme",
    "replaceFolder": true
}

output

─readme
│  README.md
│
└─test
     │ role.md
     │
     └─images
            area-spline.pne.png
            area.png
            column-chart.png
            exmaple-bar-chart.png
            line.png
            pie.png
            scatter.png
            spline.png
            stacked-area-spline.png
            stacked-area.png
            stacked-bar.png
            stacked-column.png
            two-level-pie.png

replaceFolder: false

"feac": {
    "targetDir": "src",
    "extensions": [".md", ".png"],
    "dist": "readme",
    "replaceFolder": false
}

output

└─readme
    area-spline.pne.png
    area.png
    column-chart.png
    exmaple-bar-chart.png
    line.png
    pie.png
    README.md
    role.md
    scatter.png
    spline.png
    stacked-area-spline.png
    stacked-area.png
    stacked-bar.png
    stacked-column.png
    two-level-pie.png

Package Sidebar

Install

npm i find-extension-and-copy

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

21.5 kB

Total Files

12

Last publish

Collaborators

  • ceomurky