Skip to content

Commit f60e2b8

Browse files
committed
Add typescript types
1 parent 9ff593e commit f60e2b8

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

index.d.ts

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import rollup from 'rollup';
2+
import fs from 'fs-extra';
3+
import globby from 'globby';
4+
5+
interface Target extends globby.GlobbyOptions {
6+
/**
7+
* Path or glob of what to copy.
8+
*/
9+
readonly src: string | readonly string[];
10+
11+
/**
12+
* One or more destinations where to copy.
13+
*/
14+
readonly dest: string | readonly string[];
15+
16+
/**
17+
* Change destination file or folder name.
18+
*/
19+
readonly rename?: string | Function;
20+
}
21+
22+
interface CopyOptions extends globby.GlobbyOptions, fs.CopyOptions {
23+
/**
24+
* Copy items once. Useful in watch mode.
25+
* @default false
26+
*/
27+
readonly copyOnce?: boolean;
28+
29+
/**
30+
* Rollup hook the plugin should use.
31+
* @default 'buildEnd'
32+
*/
33+
readonly hook?: string;
34+
35+
/**
36+
* Array of targets to copy.
37+
* @default []
38+
*/
39+
readonly targets?: readonly Target[];
40+
41+
/**
42+
* Output copied items to console.
43+
* @default false
44+
*/
45+
readonly verbose?: boolean;
46+
}
47+
48+
/**
49+
* Copy files and folders using Rollup
50+
*/
51+
export default function copy(options?: CopyOptions): rollup.Plugin;

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"repository": "vladshcherbin/rollup-plugin-copy",
77
"main": "dist/index.commonjs.js",
88
"module": "dist/index.module.js",
9+
"types": "index.d.ts",
910
"scripts": {
1011
"clean": "rimraf coverage dist",
1112
"build": "rollup -c",
@@ -15,6 +16,7 @@
1516
"test": "jest"
1617
},
1718
"dependencies": {
19+
"@types/fs-extra": "^7.0.0",
1820
"colorette": "^1.0.7",
1921
"fs-extra": "^7.0.1",
2022
"globby": "^9.2.0",
@@ -37,6 +39,7 @@
3739
},
3840
"files": [
3941
"dist",
42+
"index.d.ts",
4043
"readme.md"
4144
],
4245
"keywords": [

yarn.lock

+7
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,13 @@
828828
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
829829
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
830830

831+
"@types/fs-extra@^7.0.0":
832+
version "7.0.0"
833+
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-7.0.0.tgz#9c4ad9e1339e7448a76698829def1f159c1b636c"
834+
integrity sha512-ndoMMbGyuToTy4qB6Lex/inR98nPiNHacsgMPvy+zqMLgSxbt8VtWpDArpGp69h1fEDQHn1KB+9DWD++wgbwYA==
835+
dependencies:
836+
"@types/node" "*"
837+
831838
"@types/glob@^7.1.1":
832839
version "7.1.1"
833840
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575"

0 commit comments

Comments
 (0)