Skip to content

Commit e089f84

Browse files
committed
build(rollup): replace copy files code snippet with yarn postbuild script using copyfiles
1 parent 0f67355 commit e089f84

File tree

3 files changed

+99
-55
lines changed

3 files changed

+99
-55
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
"main": "index.js",
1111
"typings": "index.d.ts",
1212
"scripts": {
13-
"clean": "rm -rf dist",
1413
"purge": "rm -rf node_modules",
14+
"clean": "rm -rf dist",
1515
"dev": "rollup -cw",
16+
"lint": "tslint --project tsconfig.json --config tslint.json",
1617
"prebuild": "yarn clean",
1718
"build": "rollup -c",
18-
"lint": "tslint --project tsconfig.json --config tslint.json",
19+
"postbuild": "copyfiles CHANGELOG.md LICENSE package.json README.md dist",
1920
"release": "standard-version --no-verify",
2021
"release:major": "yarn release --release-as major",
2122
"release:minor": "yarn release --release-as minor",
@@ -24,9 +25,8 @@
2425
"devDependencies": {
2526
"@types/express": "^4.16.1",
2627
"@types/http-status-codes": "^1.2.0",
27-
"colorette": "^1.1.0",
28+
"copyfiles": "^2.2.0",
2829
"husky": "^2.3.0",
29-
"pretty-ms": "^6.0.1",
3030
"rollup": "^1.12.3",
3131
"rollup-plugin-async": "^1.2.0",
3232
"rollup-plugin-commonjs": "^10.0.0",

rollup.config.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import fs from 'fs';
2-
import ms from 'pretty-ms';
3-
import color from 'colorette';
42
import resolve from 'rollup-plugin-node-resolve';
53
import commonjs from 'rollup-plugin-commonjs';
64
import typescript from 'rollup-plugin-typescript2';
@@ -11,7 +9,6 @@ import pkg from './package.json';
119

1210
const inputDir = 'src';
1311
const inputFiles = fs.readdirSync(inputDir).map(file => `${inputDir}/${file}`);
14-
const otherFiles = ['CHANGELOG.md', 'LICENSE', 'package.json', 'README.md'];
1512
const outputDir = 'dist';
1613
const outputFormat = 'cjs';
1714
const outputSourcemap = true;
@@ -32,31 +29,6 @@ const common = {
3229
],
3330
};
3431

35-
(function() {
36-
const start = Date.now();
37-
38-
fs.mkdirSync(outputDir);
39-
otherFiles.map(file => {
40-
fs.writeFileSync(
41-
`${outputDir}/${file}`,
42-
fs.readFileSync(file, 'utf-8'),
43-
'utf-8',
44-
);
45-
46-
console.log(
47-
color.cyan(`${color.bold(file)}${color.bold(outputDir)}...`),
48-
);
49-
});
50-
51-
console.log(
52-
color.greenBright(
53-
`created ${color.bold(outputDir)} in ${color.bold(
54-
ms(Date.now() - start),
55-
)}`,
56-
),
57-
);
58-
})();
59-
6032
export default inputFiles.map(inputFile => ({
6133
...common,
6234
input: inputFile,

yarn.lock

Lines changed: 95 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ansi-regex@^4.1.0:
130130
version "4.1.0"
131131
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
132132

133-
ansi-styles@^3.2.1:
133+
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
134134
version "3.2.1"
135135
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
136136
dependencies:
@@ -349,6 +349,15 @@ cliui@^4.0.0:
349349
strip-ansi "^4.0.0"
350350
wrap-ansi "^2.0.0"
351351

352+
cliui@^5.0.0:
353+
version "5.0.0"
354+
resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"
355+
integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==
356+
dependencies:
357+
string-width "^3.1.0"
358+
strip-ansi "^5.2.0"
359+
wrap-ansi "^5.1.0"
360+
352361
code-point-at@^1.0.0:
353362
version "1.1.0"
354363
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
@@ -370,11 +379,6 @@ color-name@1.1.3:
370379
version "1.1.3"
371380
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
372381

373-
colorette@^1.1.0:
374-
version "1.1.0"
375-
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.1.0.tgz#1f943e5a357fac10b4e0f5aaef3b14cdc1af6ec7"
376-
integrity sha512-6S062WDQUXi6hOfkO/sBPVwE5ASXY4G2+b4atvhJfSsuUUhIaUKlkjLe9692Ipyt5/a+IPF5aVTu3V5gvXq5cg==
377-
378382
commander@^2.12.1:
379383
version "2.20.0"
380384
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
@@ -575,6 +579,18 @@ copy-descriptor@^0.1.0:
575579
version "0.1.1"
576580
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
577581

582+
copyfiles@^2.2.0:
583+
version "2.2.0"
584+
resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.2.0.tgz#d9fc6c06f299337fb7eeb7ea5887e9d7188d9d47"
585+
integrity sha512-iJbHJI+8OKqsq+4JF0rqgRkZzo++jqO6Wf4FUU1JM41cJF6JcY5968XyF4tm3Kkm7ZOMrqlljdm8N9oyY5raGw==
586+
dependencies:
587+
glob "^7.0.5"
588+
minimatch "^3.0.3"
589+
mkdirp "^0.5.1"
590+
noms "0.0.0"
591+
through2 "^2.0.1"
592+
yargs "^13.2.4"
593+
578594
core-util-is@~1.0.0:
579595
version "1.0.2"
580596
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@@ -993,6 +1009,18 @@ gitconfiglocal@^1.0.0:
9931009
dependencies:
9941010
ini "^1.3.2"
9951011

1012+
glob@^7.0.5:
1013+
version "7.1.6"
1014+
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
1015+
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
1016+
dependencies:
1017+
fs.realpath "^1.0.0"
1018+
inflight "^1.0.4"
1019+
inherits "2"
1020+
minimatch "^3.0.4"
1021+
once "^1.3.0"
1022+
path-is-absolute "^1.0.0"
1023+
9961024
glob@^7.1.1:
9971025
version "7.1.4"
9981026
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
@@ -1126,7 +1154,7 @@ inflight@^1.0.4:
11261154
once "^1.3.0"
11271155
wrappy "1"
11281156

1129-
inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@~2.0.3:
1157+
inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3:
11301158
version "2.0.4"
11311159
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
11321160

@@ -1555,7 +1583,7 @@ mimic-fn@^2.0.0:
15551583
version "2.1.0"
15561584
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
15571585

1558-
minimatch@^3.0.2, minimatch@^3.0.4:
1586+
minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4:
15591587
version "3.0.4"
15601588
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
15611589
dependencies:
@@ -1637,6 +1665,14 @@ node-modules-regexp@^1.0.0:
16371665
version "1.0.0"
16381666
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"
16391667

1668+
noms@0.0.0:
1669+
version "0.0.0"
1670+
resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859"
1671+
integrity sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=
1672+
dependencies:
1673+
inherits "^2.0.1"
1674+
readable-stream "~1.0.31"
1675+
16401676
normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, normalize-package-data@^2.5.0:
16411677
version "2.5.0"
16421678
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
@@ -1787,11 +1823,6 @@ parse-json@^5.0.0:
17871823
json-parse-better-errors "^1.0.1"
17881824
lines-and-columns "^1.1.6"
17891825

1790-
parse-ms@^2.1.0:
1791-
version "2.1.0"
1792-
resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-2.1.0.tgz#348565a753d4391fa524029956b172cb7753097d"
1793-
integrity sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==
1794-
17951826
parseurl@~1.3.3:
17961827
version "1.3.3"
17971828
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
@@ -1884,13 +1915,6 @@ posix-character-classes@^0.1.0:
18841915
version "0.1.1"
18851916
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
18861917

1887-
pretty-ms@^6.0.1:
1888-
version "6.0.1"
1889-
resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-6.0.1.tgz#03ec6cfee20329f142645e63efad96bb775d3da4"
1890-
integrity sha512-ke4njoVmlotekHlHyCZ3wI/c5AMT8peuHs8rKJqekj/oR5G8lND2dVpicFlUz5cbZgE290vvkMuDwfj/OcW1kw==
1891-
dependencies:
1892-
parse-ms "^2.1.0"
1893-
18941918
process-nextick-args@~2.0.0:
18951919
version "2.0.1"
18961920
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
@@ -1981,6 +2005,16 @@ read-pkg@^5.1.1:
19812005
string_decoder "^1.1.1"
19822006
util-deprecate "^1.0.1"
19832007

2008+
readable-stream@~1.0.31:
2009+
version "1.0.34"
2010+
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
2011+
integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=
2012+
dependencies:
2013+
core-util-is "~1.0.0"
2014+
inherits "~2.0.1"
2015+
isarray "0.0.1"
2016+
string_decoder "~0.10.x"
2017+
19842018
readable-stream@~2.3.6:
19852019
version "2.3.6"
19862020
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
@@ -2377,7 +2411,7 @@ string-width@^2.1.1:
23772411
is-fullwidth-code-point "^2.0.0"
23782412
strip-ansi "^4.0.0"
23792413

2380-
string-width@^3.0.0:
2414+
string-width@^3.0.0, string-width@^3.1.0:
23812415
version "3.1.0"
23822416
resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961"
23832417
dependencies:
@@ -2391,6 +2425,11 @@ string_decoder@^1.1.1:
23912425
dependencies:
23922426
safe-buffer "~5.2.0"
23932427

2428+
string_decoder@~0.10.x:
2429+
version "0.10.31"
2430+
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
2431+
integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=
2432+
23942433
string_decoder@~1.1.1:
23952434
version "1.1.1"
23962435
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
@@ -2413,7 +2452,7 @@ strip-ansi@^4.0.0:
24132452
dependencies:
24142453
ansi-regex "^3.0.0"
24152454

2416-
strip-ansi@^5.1.0:
2455+
strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
24172456
version "5.2.0"
24182457
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae"
24192458
dependencies:
@@ -2453,7 +2492,7 @@ text-extensions@^2.0.0:
24532492
version "2.0.0"
24542493
resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-2.0.0.tgz#43eabd1b495482fae4a2bf65e5f56c29f69220f6"
24552494

2456-
through2@^2.0.0, through2@^2.0.2:
2495+
through2@^2.0.0, through2@^2.0.1, through2@^2.0.2:
24572496
version "2.0.5"
24582497
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
24592498
dependencies:
@@ -2700,6 +2739,15 @@ wrap-ansi@^2.0.0:
27002739
string-width "^1.0.1"
27012740
strip-ansi "^3.0.1"
27022741

2742+
wrap-ansi@^5.1.0:
2743+
version "5.1.0"
2744+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"
2745+
integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==
2746+
dependencies:
2747+
ansi-styles "^3.2.0"
2748+
string-width "^3.0.0"
2749+
strip-ansi "^5.0.0"
2750+
27032751
wrappy@1:
27042752
version "1.0.2"
27052753
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
@@ -2719,6 +2767,14 @@ yargs-parser@^13.0.0:
27192767
camelcase "^5.0.0"
27202768
decamelize "^1.2.0"
27212769

2770+
yargs-parser@^13.1.2:
2771+
version "13.1.2"
2772+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"
2773+
integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==
2774+
dependencies:
2775+
camelcase "^5.0.0"
2776+
decamelize "^1.2.0"
2777+
27222778
yargs@13.2.2:
27232779
version "13.2.2"
27242780
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.2.tgz#0c101f580ae95cea7f39d927e7770e3fdc97f993"
@@ -2734,3 +2790,19 @@ yargs@13.2.2:
27342790
which-module "^2.0.0"
27352791
y18n "^4.0.0"
27362792
yargs-parser "^13.0.0"
2793+
2794+
yargs@^13.2.4:
2795+
version "13.3.2"
2796+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd"
2797+
integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==
2798+
dependencies:
2799+
cliui "^5.0.0"
2800+
find-up "^3.0.0"
2801+
get-caller-file "^2.0.1"
2802+
require-directory "^2.1.1"
2803+
require-main-filename "^2.0.0"
2804+
set-blocking "^2.0.0"
2805+
string-width "^3.0.0"
2806+
which-module "^2.0.0"
2807+
y18n "^4.0.0"
2808+
yargs-parser "^13.1.2"

0 commit comments

Comments
 (0)