forked from vladshcherbin/rollup-plugin-delete
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert to Typescript. The previous version produces TS2349 even though the created type declaration file and the generated type declaration file are more or less the same.
- Loading branch information
1 parent
7e5a72c
commit 643aa00
Showing
25 changed files
with
3,597 additions
and
5,597 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
node_modules | ||
/dist | ||
/lib | ||
pnpm-lock.yaml |
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 = { | ||
root: true, | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
rules: {}, | ||
} |
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
name: Node.js Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: pnpm install --frozen-lockfile --ignore-scripts | ||
- run: pnpm run build | ||
- run: pnpm exec publint | ||
- run: pnpm test | ||
- run: pnpm publish --ignore-scripts | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,35 @@ | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
pnpm-version: [7, 8] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: ${{ matrix.pnpm-version }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: pnpm | ||
- run: pnpm install --frozen-lockfile | ||
- run: pnpm run build | ||
- run: pnpm run test | ||
- run: | | ||
pnpm run format:check || { | ||
pnpm run format | ||
git diff --exit-code | ||
} | ||
- run: pnpm run lint | ||
- run: pnpm exec publint |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules | ||
coverage | ||
dist | ||
/dist | ||
/lib |
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,3 @@ | ||
auto-install-peers=true | ||
dedupe-peer-dependents=true | ||
use-lockfile-v6=true |
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 @@ | ||
pnpm-lock.yaml |
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 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"printWidth": 90, | ||
"singleQuote": true, | ||
"semi": false, | ||
"useTabs": false | ||
} |
This file was deleted.
Oops, something went wrong.
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,126 @@ | ||
# @kineticcafe/rollup-plugin-delete | ||
|
||
Delete files and folders using Rollup. This is a fork of the excellent | ||
[rollup-plugin-delete][]. The changes are mostly: | ||
|
||
- Convert to Typescript. The previous version produces TS2349 even though the | ||
created type declaration file and the generated type declaration file are | ||
more or less the same. | ||
|
||
## About | ||
|
||
This plugin is useful when you want to clean `dist` or other folders and files | ||
before bundling. It's using [del][] internally, check it for pattern examples. | ||
|
||
## Installation | ||
|
||
```bash | ||
# pnpm | ||
pnpm install -D @kineticcafe/rollup-plugin-delete | ||
|
||
# yarn | ||
yarn add -D @kineticcafe/rollup-plugin-delete | ||
|
||
# npm | ||
npm install -D @kineticcafe/rollup-plugin-delete | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
// rollup.config.js | ||
import { del } from '@kineticcafe/rollup-plugin-delete' | ||
|
||
export default { | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/app.js', | ||
format: 'cjs', | ||
}, | ||
plugins: [del({ targets: 'dist/*' })], | ||
} | ||
``` | ||
|
||
You can also remove files after the bundle has been written: | ||
|
||
```typescript | ||
// vite.config.ts | ||
import * as path from 'node:path' | ||
import { defineConfig } from 'vite' | ||
import { del } from '@kineticcafe/rollup-plugin-delete' | ||
|
||
const deleteIndexHtml = () => | ||
del({ | ||
targets: path.resolve(__dirname, 'dist/index.html'), | ||
hook: 'writeBundle', | ||
}) | ||
|
||
export default defineConfig({ | ||
plugins: [deleteIndexHtml()], | ||
}) | ||
``` | ||
|
||
### 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` | ||
|
||
Output removed files and folders to console. Default is `false`. | ||
|
||
```js | ||
del({ | ||
targets: 'dist/*', | ||
verbose: true, | ||
}) | ||
``` | ||
|
||
> Note: use \* (wildcard character) in pattern to show removed files | ||
#### `hook` | ||
|
||
The [Rollup hook](https://rollupjs.org/guide/en/#build-hooks) the plugin should | ||
use. Default is `buildStart`. | ||
|
||
```js | ||
del({ | ||
targets: 'dist/*', | ||
hook: 'buildEnd', | ||
}) | ||
``` | ||
|
||
#### `runOnce` | ||
|
||
Type: `boolean` | Default: `false` | ||
|
||
Delete items once. Useful in watch mode. | ||
|
||
```js | ||
del({ | ||
targets: 'dist/*', | ||
runOnce: true, | ||
}) | ||
``` | ||
|
||
All other options are passed to [del | ||
package](https://github.com/sindresorhus/del) which is used inside. | ||
|
||
## License | ||
|
||
MIT | ||
|
||
[rollup-plugin-delete]: https://github.com/vladshcherbin/rollup-plugin-delete | ||
[del]: https://github.com/sindresorhus/del |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,42 +1,43 @@ | ||
{ | ||
"name": "rollup-plugin-delete", | ||
"description": "Delete files and folders using Rollup", | ||
"version": "2.0.0", | ||
"author": "Vlad Shcherbin <[email protected]>", | ||
"repository": "vladshcherbin/rollup-plugin-delete", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.es.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"clean": "rimraf coverage dist", | ||
"build": "rollup -c", | ||
"lint": "eslint src tests", | ||
"postpublish": "yarn clean", | ||
"prepublishOnly": "yarn lint && yarn test && yarn clean && yarn build", | ||
"test": "jest" | ||
}, | ||
"contributors": [ | ||
"Vlad Shcherbin <[email protected]>", | ||
"Austin Ziegler <[email protected]>" | ||
], | ||
"dependencies": { | ||
"del": "^5.1.0" | ||
"del": "^7.1.0" | ||
}, | ||
"description": "Delete files and folders using Rollup", | ||
"devDependencies": { | ||
"@babel/core": "^7.10.2", | ||
"@babel/preset-env": "^7.10.2", | ||
"babel-jest": "^26.0.1", | ||
"codecov": "^3.7.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/rollup-plugin-auto-external": "^2.0.5", | ||
"@typescript-eslint/eslint-plugin": "^6.12.0", | ||
"@typescript-eslint/parser": "^6.12.0", | ||
"eslint": "^8.54.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"fs-extra": "^9.0.1", | ||
"jest": "^26.0.1", | ||
"replace-in-file": "^6.1.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.15.0", | ||
"rollup-plugin-auto-external": "^2.0.0" | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"fs-extra": "^11.2.0", | ||
"prettier": "^3.0.0", | ||
"publint": "^0.2.5", | ||
"replace-in-file": "^7.0.2", | ||
"rimraf": "^5.0.5", | ||
"rollup": "^4.6.0", | ||
"rollup-plugin-auto-external": "^2.0.0", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.6" | ||
}, | ||
"engines": { | ||
"node": ">= 16" | ||
}, | ||
"exports": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"index.d.ts", | ||
"readme.md" | ||
"README.md" | ||
], | ||
"keywords": [ | ||
"rollup", | ||
|
@@ -49,8 +50,26 @@ | |
"folder", | ||
"directory" | ||
], | ||
"engines": { | ||
"node": ">=10" | ||
"license": "MIT", | ||
"name": "@kineticcafe/rollup-plugin-delete", | ||
"peerDependencies": { | ||
"rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kineticcafe/rollup-plugin-delete" | ||
}, | ||
"scripts": { | ||
"build": "tsc -p . && rollup -c", | ||
"clean": "rimraf dist", | ||
"format": "prettier --write .", | ||
"format:check": "prettier --check .", | ||
"lint": "eslint src tests --ext .js,.cjs,.mjs,.ts,.cts,.mts ", | ||
"postpublish": "pnpm clean", | ||
"prepublishOnly": "pnpm lint && pnpm test && pnpm clean && pnpm build && pnpm publint", | ||
"test": "vitest" | ||
}, | ||
"license": "MIT" | ||
"types": "./dist/index.d.ts", | ||
"type": "module", | ||
"version": "3.0.0" | ||
} |
Oops, something went wrong.