-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e6d607b
Showing
7 changed files
with
1,291 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
extends: 'airbnb-base', | ||
rules: { | ||
'comma-dangle': ['error', 'never'], | ||
semi: ['error', 'never'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "rollup-plugin-delete", | ||
"description": "Delete files and folders using Rollup", | ||
"version": "0.1.0", | ||
"author": "Vlad Shcherbin <[email protected]>", | ||
"repository": "vladshcherbin/rollup-plugin-delete", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"lint": "eslint src", | ||
"build": "rollup -c", | ||
"clean": "rimraf dist", | ||
"prepublishOnly": "yarn lint && yarn build", | ||
"postpublish": "yarn clean" | ||
}, | ||
"dependencies": { | ||
"del": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb-base": "^13.0.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.62.0" | ||
}, | ||
"files": [ | ||
"dist", | ||
"readme.md" | ||
], | ||
"keywords": [ | ||
"rollup", | ||
"plugin", | ||
"delete", | ||
"clear", | ||
"clean", | ||
"remove" | ||
], | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# rollup-plugin-delete | ||
|
||
Delete files and folders using Rollup. | ||
|
||
## About | ||
|
||
This plugin is useful when you want to clean `dist` or other folders and files before bundling. It's using [del](https://github.com/sindresorhus/del) package inside, check it for pattern examples. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install rollup-plugin-delete --save-dev | ||
# or | ||
yarn add rollup-plugin-delete -D | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
// rollup.config.js | ||
import del from 'rollup-plugin-delete' | ||
|
||
export default { | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/app.js', | ||
format: 'cjs' | ||
}, | ||
plugins: [ | ||
del({ targets: 'dist/*' }) | ||
] | ||
} | ||
``` | ||
|
||
### Configuration | ||
|
||
There are some useful options: | ||
|
||
**targets** | ||
|
||
A string or an array of patterns of files and folders to be deleted. Default is `[]`. | ||
|
||
```js | ||
del({ | ||
targets: 'dist/*' | ||
}) | ||
|
||
del({ | ||
targets: ['dist/*', 'build/*'] | ||
}) | ||
``` | ||
|
||
**verbose** | ||
|
||
If set to `true`, will output removed files and folders to console. Default is `false`. | ||
|
||
```js | ||
del({ | ||
verbose: true | ||
}) | ||
``` | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default { | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/index.js', | ||
format: 'cjs' | ||
}, | ||
external: ['del'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable no-console */ | ||
import del from 'del' | ||
|
||
export default function (options = {}) { | ||
const targets = options.targets || [] | ||
const verbose = options.verbose || false | ||
|
||
return { | ||
name: 'delete', | ||
buildStart: () => del(targets).then((paths) => { | ||
if (verbose && paths.length > 0) { | ||
console.log('Deleted files and folders:') | ||
|
||
paths.forEach((path) => { | ||
console.log(path) | ||
}) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.