Reporter to copy static files for Parcel V2 (buildSuccess event)
Using npm:
npm install -D parcel-reporter-copy-file-v2
Using yarn:
yarn add -D parcel-reporter-copy-file-v2
Using bower:
bower install -D parcel-reporter-copy-file-v2
First of all, add a new reporter in the Parcel config.
.parcelrc
{
"extends": ["@parcel/config-default"],
"reporters": ["parcel-reporter-copy-file-v2"]
}
Then define config to copy static files in the package.json of the project
package.json
{
...
"copyStaticFiles": [
"files/file1.txt",
"files/embed/*.txt",
{ "from": "files/file1.txt", "to": "results1" },
{ "from": "files/embed/*", "to": "results2" },
{ "from": "files/**/*", "to": "results3" }
]
}
Type: String
Required: true
Glob or relative path from where we copy files (root path taked from Parcel projectRoot config key)
Type: String|Array<String>
Default: Parcel dist folders configuration
Output relative path (root path taked from Parcel projectRoot config key)
Any contribution is highly appreciated.
The code in this project is licensed under MIT license.