Installations
npm install filemanager-plugin
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 14
Node Version
14.19.2
NPM Version
8.9.0
Score
75
Supply Chain
98.2
Quality
74.2
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (90.62%)
HTML (9.14%)
CSS (0.25%)
Developer
xianweics
Download Statistics
Total Downloads
188,641
Last Day
803
Last Week
3,101
Last Month
13,114
Last Year
80,723
GitHub Statistics
10 Stars
183 Commits
6 Forks
1 Watching
1 Branches
3 Contributors
Bundle Size
490.50 kB
Minified
224.47 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.9.0
Package Id
filemanager-plugin@2.9.0
Unpacked Size
33.63 kB
Size
8.74 kB
File Count
6
NPM Version
8.9.0
Node Version
14.19.2
Publised On
22 Jun 2024
Total Downloads
Cumulative downloads
Total Downloads
188,641
Last day
2.6%
803
Compared to previous day
Last week
-6.1%
3,101
Compared to previous week
Last month
3%
13,114
Compared to previous month
Last year
155.6%
80,723
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
File manager plugin
Overview
This file manager plugin allows you to delete, zip/unzip(.zip/.tar/.tar.gz), move, rename, copy files or directories before and after webpack/rollup/vite builds. Also, you can customize the lifecycle of webpack, rollup or vite during building.
Installation
npm install filemanager-plugin --save-dev
Usage
events
Control the running order during building.
start {Object}
: Register actions tobeforeCompile
hook to compiler. Executes a plugin after compilation parameters are created.end {Object}
: Register actions todone
hook to compiler, actions will be executed when the compilation has completed.
In the example below, the start event with del
command will run first,
and then the end event with zip
after.
1// webpack 2const FileManagerPlugin = require('filemanager-plugin').WebpackFilemanager; 3module.exports = { 4 plugins: [ 5 new FileManagerPlugin({ 6 events: { 7 start: { 8 del: { 9 items: ['./dist'] 10 } 11 }, 12 end: { 13 zip: { 14 items: [ 15 {source: './src/demo0.zip', destination: './dest/demo0', type: 'zip'} 16 ] 17 } 18 } 19 } 20 }) 21 ] 22}; 23 24// rollup 25const rollupFilemanager = require('filemanager-plugin').RollupFilemanager; 26module.exports = { 27 plugins: [ 28 rollupFilemanager({ 29 events: {} // It's the same as webpack configuration 30 }) 31 ] 32}
customHooks
Supports for the custom lifecycle for webpack, vite or rollup to control the running order. In addition, when
customHooks
is set,events
will be ignored.
hookName {String}
: Register hook of webpack, vite or rollup. Commands will run when each hook is called. (webpack hooks, rollup hooks, vite hooks).commands {Array}
: Setting actions. Commands will run, when each hook which you registered is triggered.hookType {String}
: Depending on the hook type, It only supports webpack.
1// webpack 2const FileManagerPlugin = require('filemanager-plugin').WebpackFilemanager; 3module.exports = { 4 plugins: [ 5 new FileManagerPlugin({ 6 events: { 7 start: { 8 zip: { 9 items: [ 10 {source: './src/demo0.zip', destination: './dest/demo0', type: 'zip'} 11 ] 12 } 13 } 14 }, // events will be ignore. 15 customHooks: [ 16 { 17 hookName: 'compile', 18 hookType: 'tap', 19 commands: { 20 del: { 21 items: ['./dist'] 22 // All file under './dist' will be deleted, when compile hook is called 23 } 24 } 25 } 26 ] 27 }) 28 ] 29}; 30 31// rollup 32const RollupFilemanager = require('filemanager-plugin').RollupFilemanager; 33module.exports = { 34 plugins: [ 35 new RollupFilemanager({ 36 customHooks: [ 37 { 38 hookName: 'generateBundle', 39 commands: { 40 del: { 41 items: ['./dist'] 42 // All file under './dist' will be deleted, when generateBundle hook is called 43 } 44 } 45 } 46 ] 47 }) 48 ] 49}; 50 51// vite 52const ViteFilemanager = require('filemanager-plugin').ViteFilemanager; 53module.exports = { 54 plugins: [ 55 ViteFilemanager({ 56 customHooks: [ 57 { 58 hookName: 'generateBundle', 59 commands: { 60 del: { 61 items: ['./dist'] 62 // All file under './dist' will be deleted, when generateBundle hook is called 63 } 64 } 65 } 66 ] 67 }) 68 ] 69};
Commands
Name | Type | Description |
---|---|---|
zip | {Array} | Zip files or directories by using tar , tgz , gzip or zip . However, gzip only supports compress single file. You need to use tgz to zip a directory. |
unzip | {Array} | Unzip files or directories. The usage is Same as zip . |
del | {Array} | Delete multiple files or directories. |
copy | {Array} | Copy multiple files or directories. |
move | {Array} | Move multiple files or directories. |
rename | {Array} | Rename multiple files or directories. |
These commands would be called when each hook which has been registered is called.
Also, each action will be executed in order base on Array
order.
In this example below, in the end event, the del
command will run first, and zip
after:
1// webpack 2const FileManagerPlugin = require('filemanager-plugin').WebpackFilemanager; 3module.exports = { 4 plugins: [ 5 new FileManagerPlugin({ 6 events: { 7 start: { 8 del: { 9 items: ['./dist'] 10 }, 11 zip: { 12 items: [ 13 {source: './src/demo0.zip', destination: './dest/demo0', type: 'zip'} 14 ] 15 } 16 } 17 } 18 }) 19 ] 20}; 21 22// rollup 23const rollupFilemanager = require('filemanager-plugin').RollupFilemanager; 24module.exports = { 25 plugins: [ 26 rollupFilemanager({ 27 events: {} // It's the same as webpack configuration 28 }) 29 ] 30}
zip
example
1module.exports = { 2 plugins: [ 3 new FileManagerPlugin({ 4 events: { 5 end: { 6 zip: { 7 items: [ 8 { source: './src/demo1', destination: './dest/demo1.zip', type: 'zip'}, 9 { source: './src/demo2', destination: './dest/demo2.tar', type: 'tar'}, 10 { source: './src/demo3', destination: './dest/demo3.tgz', type: 'tgz'}, 11 { source: './src/demo4.html', destination: './dest/demo4.html.gz', type: 'gzip'}, 12 { source: './src/*.js', destination: './dest/demo5.js.zip'} 13 // All js files under './src' will be compressed to 'demo5.js.zip' under './dest' 14 ] 15 } 16 } 17 } 18 }) 19 ] 20}
source {String}
: Compressed source path which can be a file or directory. It supports glob pattern.destination {String}
: Compressed destination path.type {String}
: Compressed type. Default iszip
.option {Object}
: Other optional configuration for zip.
unzip
example
1module.exports = { 2 plugins: [ 3 new FileManagerPlugin({ 4 events: { 5 end: { 6 unzip: { 7 items: [ 8 { source: './src/demo1.zip', destination: './dest/demo1'}, 9 { source: './src/demo2.tar', destination: './dest/demo2', type: 'tar'}, 10 { source: './src/demo3.tgz', destination: './dest/demo3', type: 'tgz'}, 11 { source: './src/demo4.html.gz', destination: './dest/demo4', type: 'gzip'}, 12 { source: './src/*.zip', destination: './dest/demo5'} 13 // All zip files under './src' will be uncompressed to 'demo5' under './dest' 14 ] 15 } 16 } 17 } 18 }) 19 ] 20}
source {String}
: Uncompressed source path. It supports glob pattern.destination {String}
: Uncompressed destination path.type {String}
: Uncompressed type. Default iszip
.option {Object}
: Other optional configuration for unzip.
del
example
1module.exports = { 2 plugins: [ 3 new FileManagerPlugin({ 4 events: { 5 end: { 6 del: { 7 items: [ 8 './dist', 9 './temp/*.html' // All html files under './temp' will be deleted. 10 ] 11 } 12 } 13 } 14 }) 15 ] 16}
source {String}
: Deleted path which can be a file or directory. It supports glob pattern.
copy
example
1module.exports = { 2 plugins: [ 3 new FileManagerPlugin({ 4 end: { 5 copy: { 6 items: [ 7 // All .js files under './src/demo' will be copied to './dest/demo' and keep directory hierarchy. 8 { source: './src/demo1/**/*.js', destination: './dest/demo', isFlat: false}, 9 // All .html files under './src/demo' will be copied to './dest/demo' 10 { source: ['./src/demo/*.html'], destination: './dest/demo', globOptions: {silent: false}}, 11 // index.html under './src/demo' will be copied as 'newIndex.html' under './dest/demo' 12 { source: ['./src/demo/index.html'], destination: './dest/demo', name : 'newIndex.html'} 13 ] 14 } 15 } 16 }) 17 ] 18}
source {String | Array}
: Copied source path. It supports glob pattern.destination {String}
: Copied destination path.globOptions {Object}
: Allows to configure the glob pattern matching library used by the plugin. See the list of supported options.isFlat {Boolean}
: Whether Removing directory structure/folder hierarchy when copying with recursive. Default istrue
.name {String}
: When you need to rename a file. Notice: It would be effective whensource
is a or a list of files. Default is empty string which means it would be ignored.copyOption {Object}
: Allows to set optional configuration for copy.
move
example
1module.exports = { 2 plugins: [ 3 new FileManagerPlugin({ 4 end: { 5 move: { 6 items: [ 7 { source: './src/demo1.zip', destination: './dest/demo1'}, 8 { source: './src/*.css', destination: './dest/demo'} 9 // All css files under './src' will be moved to './dest/demo' 10 ] 11 } 12 } 13 }) 14 ] 15}
source {String}
: Moved source path. It supports glob pattern.destination {String}
: Moved destination path.option {Object}
: Optional configuration for moving.
rename
example
1module.exports = { 2 plugins: [ 3 new FileManagerPlugin({ 4 end: { 5 rename: { 6 items : [ 7 { path: './rename', oldName: 'a.html', newName: 'b.html' } 8 ] 9 } 10 } 11 }) 12 ] 13}
source {String}
: Renamed source path.destination {String}
: Renamed destination path.
options
The global configuration for file manager operation
parallel {Number}
: Use multi-processes parallel running to improve the task speed. Max number of concurrent runs:os.cpus().length - 1
. Default is closing.log {String}
: Show which information you need during building. Default isall
.
1const FileManagerPlugin = require('filemanager-plugin').WebpackFilemanager; 2 3module.exports = { 4 plugins: [ 5 new FileManagerPlugin({ 6 events: { 7 start: { 8 del: { 9 items: ['./dist'] 10 } 11 } 12 }, 13 options: { 14 parallel: 3, 15 log: 'all' 16 } 17 }) 18 ] 19}; 20// start with three process to run task. 21// success: delete './dist'
cache {Boolean}
: If you settrue
, it would only once during building. It's highly efficient for development mode. Also, you can override the value by each action. Default istrue
.
1const FileManagerPlugin = require('filemanager-plugin').WebpackFilemanager; 2 3module.exports = { 4 plugins: [ 5 new FileManagerPlugin({ 6 events: { 7 start: { 8 del: { 9 items: ['./dist'] 10 }, 11 copy: { 12 items: [ 13 { source: './src/demo', destination: './dest/demo'} 14 ], 15 options: { 16 cache: false // it would override cache of global options, so that it would run when webpack hot reload 17 } 18 }, 19 } 20 }, 21 options: { 22 parallel: 3, 23 log: 'all', 24 cache: true 25 } 26 }) 27 ] 28};
Upgrade
1const FileManagerPlugin = require('filemanager-plugin').WebpackFilemanager; 2 3// filemanager-plugin 1.X.X 4module.exports = { 5 plugins: [ 6 new FileManagerPlugin({ 7 start: { 8 del: [ 9 { source: './dist' } 10 ] 11 }, 12 end: { 13 zip: [ 14 { source: './src/demo', destination: './dest/demo.zip', type: 'zip'} 15 ], 16 rename: [ 17 { source: './rename/b', destination: './rename/a' } 18 ], 19 copy: [ 20 { source: './src/demo', destination: './dest/demo'} 21 ], 22 unzip: [ 23 ], 24 move: [ 25 { source: './src/demo.zip', destination: './dest/demo.zip'} 26 ] 27 } 28 }) 29 ] 30}; 31 32// filemanager-plugin 2.X.X 33module.exports = { 34 plugins: [ 35 new FileManagerPlugin({ 36 events: { 37 start: { 38 del: { 39 items: ['./dist'] 40 } 41 }, 42 end: { 43 zip: { 44 items: [ 45 { source: './src/demo', destination: './dest/demo.zip', type: 'zip'} 46 ] 47 }, 48 rename: { 49 items: [ 50 { path: './rename', oldName: 'b', newName: 'a' } 51 ] 52 }, 53 copy: { 54 items: [ 55 { source: './src/demo', destination: './dest/demo'} 56 ] 57 }, 58 unzip: { 59 items: [ 60 { source: './src/demo.zip', destination: './dest/demo', type: 'zip'} 61 ] 62 }, 63 move: { 64 items: [ 65 { source: './src/demo.zip', destination: './dest/demo.zip'} 66 ] 67 } 68 } 69 }, 70 })] 71}
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/xianweics/filemanager-plugin/npm-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/xianweics/filemanager-plugin/npm-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/xianweics/filemanager-plugin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/xianweics/filemanager-plugin/test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/xianweics/filemanager-plugin/test.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/test.yml:35
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 1 out of 2 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
88 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-mv48-hcvh-8jj8
- Warn: Project is vulnerable to: GHSA-353f-5xf4-qw67
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986 / GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-3wcq-x3mq-6r9p
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442
- Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc
- Warn: Project is vulnerable to: GHSA-rqff-837h-mm52
- Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2
- Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j
- Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
2.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to filemanager-plugin
filemanager-webpack-plugin
Webpack plugin to copy, archive (.zip), move, delete files and directories before and after builds
filemanager
A Vue.js Plugin for arranging and labeling images. Originally developed for Figgy at Princeton University Library.
filemanager-umijs-plugin
## Installation
ained-filemanager-2
Ained-filemanager is a file manager component for vuejs.