Skip to content

Commit 4d9756a

Browse files
committed
chore(esm): esm + barrels
1 parent f47541c commit 4d9756a

File tree

4 files changed

+135
-4
lines changed

4 files changed

+135
-4
lines changed

barrels.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "./dist/types"
3+
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
"scripts": {
88
"start": "tsc -w",
99
"prebuild": "rimraf dist",
10-
"build": "tsc && tsc -p tsconfig-cjs.json",
10+
"build": "tsc && tsc -p tsconfig-cjs.json && yarn barrels",
11+
"barrels": "barrelsby --delete -c barrels.json",
1112
"postbuild": "npm-prepare-dist -s postinstall -s prepare && yarn fix-paths",
1213
"tsc": "tsc",
1314
"demo": "ts-node demo",
1415
"lint": "eslint ./src/**/**/* --fix",
1516
"test": "jest",
16-
"fix-paths": "yarn json -I -f ./dist/package.json -e \"this.module='./esm/index.js';this.main='./cjs/index.js';this.types='./cjs/index.d.ts'\"",
17+
"fix-paths": "yarn json -I -f ./dist/package.json -e \"this.module='./esm/index.js';this.main='./cjs/index.js';this.types='./types/index.d.ts'\"",
1718
"postinstall": "yarn husky install",
1819
"publish:next": "yarn && yarn build && yarn test --coverage true && npm publish --folder dist --tag beta",
1920
"postversion": "git push && git push --follow-tags",
@@ -35,6 +36,7 @@
3536
"@types/node-fetch": "^3.0.3",
3637
"@typescript-eslint/eslint-plugin": "^5.27.0",
3738
"@typescript-eslint/parser": "^5.27.0",
39+
"barrelsby": "^2.3.3",
3840
"eslint": "^8.17.0",
3941
"eslint-config-google": "^0.14.0",
4042
"eslint-config-prettier": "^8.5.0",

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"outDir": "./dist/esm",
1515
"strict": true,
1616
"declaration": true,
17+
"declarationDir": "./dist/types",
1718
"pretty": true,
1819
"skipLibCheck": true,
1920
"alwaysStrict": true,

yarn.lock

Lines changed: 127 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,13 @@
953953
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b"
954954
integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==
955955

956+
"@types/yargs@^17.0.3":
957+
version "17.0.9"
958+
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.9.tgz#f1f931a4e5ae2c0134dea10f501088636a50b46a"
959+
integrity sha512-Ci8+4/DOtkHRylcisKmVMtmVO5g7weUVCKcsu1sJvF1bn0wExTmbHmhFKj7AnEm0de800iovGhdSKzYnzbaHpg==
960+
dependencies:
961+
"@types/yargs-parser" "*"
962+
956963
"@types/yargs@^17.0.8":
957964
version "17.0.10"
958965
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a"
@@ -1206,6 +1213,15 @@ balanced-match@^1.0.0:
12061213
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
12071214
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
12081215

1216+
barrelsby@^2.3.3:
1217+
version "2.3.3"
1218+
resolved "https://registry.yarnpkg.com/barrelsby/-/barrelsby-2.3.3.tgz#bc1dd62bd39682ee7eae77e8a9fade33f3323a0f"
1219+
integrity sha512-4zHhiOcSaa4TR2cnDIFJeYTpSEX+vp2WVtdDkOKfZdLxmzK5GZctwOxP+vDb9uPt0kjApUPrFS/+9gm/qXjVhQ==
1220+
dependencies:
1221+
"@types/yargs" "^17.0.3"
1222+
signale "^1.4.0"
1223+
yargs "^17.3.0"
1224+
12091225
boolbase@^1.0.0:
12101226
version "1.0.0"
12111227
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
@@ -1292,7 +1308,7 @@ caniuse-lite@^1.0.30001332:
12921308
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001346.tgz#e895551b46b9cc9cc9de852facd42f04839a8fbe"
12931309
integrity sha512-q6ibZUO2t88QCIPayP/euuDREq+aMAxFE5S70PkrLh0iTDj/zEhgvJRKC2+CvXY6EWc6oQwUR48lL5vCW6jiXQ==
12941310

1295-
chalk@^2.0.0:
1311+
chalk@^2.0.0, chalk@^2.3.2:
12961312
version "2.4.2"
12971313
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
12981314
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@@ -1814,6 +1830,13 @@ fetch-blob@^3.1.2, fetch-blob@^3.1.4:
18141830
node-domexception "^1.0.0"
18151831
web-streams-polyfill "^3.0.3"
18161832

1833+
figures@^2.0.0:
1834+
version "2.0.0"
1835+
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
1836+
integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=
1837+
dependencies:
1838+
escape-string-regexp "^1.0.5"
1839+
18171840
file-entry-cache@^6.0.1:
18181841
version "6.0.1"
18191842
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
@@ -1828,6 +1851,13 @@ fill-range@^7.0.1:
18281851
dependencies:
18291852
to-regex-range "^5.0.1"
18301853

1854+
find-up@^2.0.0:
1855+
version "2.1.0"
1856+
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
1857+
integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c=
1858+
dependencies:
1859+
locate-path "^2.0.0"
1860+
18311861
find-up@^4.0.0, find-up@^4.1.0:
18321862
version "4.1.0"
18331863
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
@@ -1953,7 +1983,7 @@ globby@^11.1.0:
19531983
merge2 "^1.4.1"
19541984
slash "^3.0.0"
19551985

1956-
graceful-fs@^4.2.9:
1986+
graceful-fs@^4.1.2, graceful-fs@^4.2.9:
19571987
version "4.2.9"
19581988
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"
19591989
integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==
@@ -2545,6 +2575,11 @@ jsesc@^2.5.1:
25452575
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
25462576
integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==
25472577

2578+
json-parse-better-errors@^1.0.1:
2579+
version "1.0.2"
2580+
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
2581+
integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==
2582+
25482583
json-parse-even-better-errors@^2.3.0:
25492584
version "2.3.1"
25502585
resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d"
@@ -2600,6 +2635,24 @@ lines-and-columns@^1.1.6:
26002635
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
26012636
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
26022637

2638+
load-json-file@^4.0.0:
2639+
version "4.0.0"
2640+
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b"
2641+
integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs=
2642+
dependencies:
2643+
graceful-fs "^4.1.2"
2644+
parse-json "^4.0.0"
2645+
pify "^3.0.0"
2646+
strip-bom "^3.0.0"
2647+
2648+
locate-path@^2.0.0:
2649+
version "2.0.0"
2650+
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
2651+
integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=
2652+
dependencies:
2653+
p-locate "^2.0.0"
2654+
path-exists "^3.0.0"
2655+
26032656
locate-path@^5.0.0:
26042657
version "5.0.0"
26052658
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
@@ -2800,20 +2853,39 @@ optionator@^0.9.1:
28002853
type-check "^0.4.0"
28012854
word-wrap "^1.2.3"
28022855

2856+
p-limit@^1.1.0:
2857+
version "1.3.0"
2858+
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"
2859+
integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==
2860+
dependencies:
2861+
p-try "^1.0.0"
2862+
28032863
p-limit@^2.2.0:
28042864
version "2.3.0"
28052865
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
28062866
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
28072867
dependencies:
28082868
p-try "^2.0.0"
28092869

2870+
p-locate@^2.0.0:
2871+
version "2.0.0"
2872+
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
2873+
integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=
2874+
dependencies:
2875+
p-limit "^1.1.0"
2876+
28102877
p-locate@^4.1.0:
28112878
version "4.1.0"
28122879
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
28132880
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
28142881
dependencies:
28152882
p-limit "^2.2.0"
28162883

2884+
p-try@^1.0.0:
2885+
version "1.0.0"
2886+
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
2887+
integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=
2888+
28172889
p-try@^2.0.0:
28182890
version "2.2.0"
28192891
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
@@ -2826,6 +2898,14 @@ parent-module@^1.0.0:
28262898
dependencies:
28272899
callsites "^3.0.0"
28282900

2901+
parse-json@^4.0.0:
2902+
version "4.0.0"
2903+
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"
2904+
integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=
2905+
dependencies:
2906+
error-ex "^1.3.1"
2907+
json-parse-better-errors "^1.0.1"
2908+
28292909
parse-json@^5.2.0:
28302910
version "5.2.0"
28312911
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd"
@@ -2836,6 +2916,11 @@ parse-json@^5.2.0:
28362916
json-parse-even-better-errors "^2.3.0"
28372917
lines-and-columns "^1.1.6"
28382918

2919+
path-exists@^3.0.0:
2920+
version "3.0.0"
2921+
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
2922+
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
2923+
28392924
path-exists@^4.0.0:
28402925
version "4.0.0"
28412926
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
@@ -2871,11 +2956,24 @@ picomatch@^2.0.4, picomatch@^2.2.3:
28712956
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
28722957
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
28732958

2959+
pify@^3.0.0:
2960+
version "3.0.0"
2961+
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"
2962+
integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=
2963+
28742964
pirates@^4.0.4:
28752965
version "4.0.5"
28762966
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b"
28772967
integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==
28782968

2969+
pkg-conf@^2.1.0:
2970+
version "2.1.0"
2971+
resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-2.1.0.tgz#2126514ca6f2abfebd168596df18ba57867f0058"
2972+
integrity sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=
2973+
dependencies:
2974+
find-up "^2.0.0"
2975+
load-json-file "^4.0.0"
2976+
28792977
pkg-dir@^4.2.0:
28802978
version "4.2.0"
28812979
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
@@ -3073,6 +3171,15 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
30733171
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
30743172
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
30753173

3174+
signale@^1.4.0:
3175+
version "1.4.0"
3176+
resolved "https://registry.yarnpkg.com/signale/-/signale-1.4.0.tgz#c4be58302fb0262ac00fc3d886a7c113759042f1"
3177+
integrity sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==
3178+
dependencies:
3179+
chalk "^2.3.2"
3180+
figures "^2.0.0"
3181+
pkg-conf "^2.1.0"
3182+
30763183
sisteransi@^1.0.5:
30773184
version "1.0.5"
30783185
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
@@ -3137,6 +3244,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
31373244
dependencies:
31383245
ansi-regex "^5.0.1"
31393246

3247+
strip-bom@^3.0.0:
3248+
version "3.0.0"
3249+
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
3250+
integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=
3251+
31403252
strip-bom@^4.0.0:
31413253
version "4.0.0"
31423254
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878"
@@ -3412,6 +3524,19 @@ yargs-parser@^21.0.0:
34123524
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"
34133525
integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==
34143526

3527+
yargs@^17.3.0:
3528+
version "17.3.1"
3529+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.3.1.tgz#da56b28f32e2fd45aefb402ed9c26f42be4c07b9"
3530+
integrity sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==
3531+
dependencies:
3532+
cliui "^7.0.2"
3533+
escalade "^3.1.1"
3534+
get-caller-file "^2.0.5"
3535+
require-directory "^2.1.1"
3536+
string-width "^4.2.3"
3537+
y18n "^5.0.5"
3538+
yargs-parser "^21.0.0"
3539+
34153540
yargs@^17.3.1:
34163541
version "17.5.1"
34173542
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e"

0 commit comments

Comments
 (0)