Skip to content

Commit 84cdbbf

Browse files
committed
chore(esm): esm + barrels
1 parent 29d95af commit 84cdbbf

File tree

4 files changed

+127
-16
lines changed

4 files changed

+127
-16
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",
@@ -34,6 +35,7 @@
3435
"@types/node": "^18.8.2",
3536
"@typescript-eslint/eslint-plugin": "^5.39.0",
3637
"@typescript-eslint/parser": "^5.39.0",
38+
"barrelsby": "^2.3.4",
3739
"eslint": "^8.24.0",
3840
"eslint-config-google": "^0.14.0",
3941
"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: 119 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,10 @@
820820
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b"
821821
integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==
822822

823-
"@types/yargs@^17.0.8":
824-
version "17.0.13"
825-
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76"
826-
integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg==
823+
"@types/yargs@^17.0.10", "@types/yargs@^17.0.8":
824+
version "17.0.10"
825+
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a"
826+
integrity sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==
827827
dependencies:
828828
"@types/yargs-parser" "*"
829829

@@ -1068,6 +1068,15 @@ balanced-match@^1.0.0:
10681068
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
10691069
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
10701070

1071+
barrelsby@^2.3.4:
1072+
version "2.3.4"
1073+
resolved "https://registry.yarnpkg.com/barrelsby/-/barrelsby-2.3.4.tgz#bd31e06b62ddc510fa0b6e202c1ff0cd9f096867"
1074+
integrity sha512-p2dFA7nkgjvUkVKf3cvTt4nBWxg5E9gpxUUX857F+0+Mx/P1Iw+WO5/yJSLE2eibIVbj1D+29sE4JczLLoQfKA==
1075+
dependencies:
1076+
"@types/yargs" "^17.0.10"
1077+
signale "^1.4.0"
1078+
yargs "^17.4.1"
1079+
10711080
boolbase@^1.0.0:
10721081
version "1.0.0"
10731082
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
@@ -1137,7 +1146,7 @@ caniuse-lite@^1.0.30001400:
11371146
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001416.tgz#29692af8a6a11412f2d3cf9a59d588fcdd21ce4c"
11381147
integrity sha512-06wzzdAkCPZO+Qm4e/eNghZBDfVNDsCgw33T27OwBH9unE9S478OYw//Q2L7Npf/zBzs7rjZOszIFQkwQKAEqA==
11391148

1140-
chalk@^2.0.0:
1149+
chalk@^2.0.0, chalk@^2.3.2:
11411150
version "2.4.2"
11421151
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
11431152
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@@ -1633,6 +1642,13 @@ fb-watchman@^2.0.0:
16331642
dependencies:
16341643
bser "2.1.1"
16351644

1645+
figures@^2.0.0:
1646+
version "2.0.0"
1647+
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
1648+
integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=
1649+
dependencies:
1650+
escape-string-regexp "^1.0.5"
1651+
16361652
file-entry-cache@^6.0.1:
16371653
version "6.0.1"
16381654
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
@@ -1647,6 +1663,13 @@ fill-range@^7.0.1:
16471663
dependencies:
16481664
to-regex-range "^5.0.1"
16491665

1666+
find-up@^2.0.0:
1667+
version "2.1.0"
1668+
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
1669+
integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c=
1670+
dependencies:
1671+
locate-path "^2.0.0"
1672+
16501673
find-up@^4.0.0, find-up@^4.1.0:
16511674
version "4.1.0"
16521675
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
@@ -1768,10 +1791,10 @@ globby@^11.1.0:
17681791
merge2 "^1.4.1"
17691792
slash "^3.0.0"
17701793

1771-
graceful-fs@^4.2.9:
1772-
version "4.2.10"
1773-
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
1774-
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
1794+
graceful-fs@^4.1.2, graceful-fs@^4.2.9:
1795+
version "4.2.9"
1796+
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"
1797+
integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==
17751798

17761799
grapheme-splitter@^1.0.4:
17771800
version "1.0.4"
@@ -2349,6 +2372,11 @@ jsesc@^2.5.1:
23492372
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
23502373
integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==
23512374

2375+
json-parse-better-errors@^1.0.1:
2376+
version "1.0.2"
2377+
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
2378+
integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==
2379+
23522380
json-parse-even-better-errors@^2.3.0:
23532381
version "2.3.1"
23542382
resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d"
@@ -2397,6 +2425,24 @@ lines-and-columns@^1.1.6:
23972425
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
23982426
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
23992427

2428+
load-json-file@^4.0.0:
2429+
version "4.0.0"
2430+
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b"
2431+
integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs=
2432+
dependencies:
2433+
graceful-fs "^4.1.2"
2434+
parse-json "^4.0.0"
2435+
pify "^3.0.0"
2436+
strip-bom "^3.0.0"
2437+
2438+
locate-path@^2.0.0:
2439+
version "2.0.0"
2440+
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
2441+
integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=
2442+
dependencies:
2443+
p-locate "^2.0.0"
2444+
path-exists "^3.0.0"
2445+
24002446
locate-path@^5.0.0:
24012447
version "5.0.0"
24022448
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
@@ -2585,6 +2631,13 @@ optionator@^0.9.1:
25852631
type-check "^0.4.0"
25862632
word-wrap "^1.2.3"
25872633

2634+
p-limit@^1.1.0:
2635+
version "1.3.0"
2636+
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"
2637+
integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==
2638+
dependencies:
2639+
p-try "^1.0.0"
2640+
25882641
p-limit@^2.2.0:
25892642
version "2.3.0"
25902643
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
@@ -2599,6 +2652,13 @@ p-limit@^3.0.2, p-limit@^3.1.0:
25992652
dependencies:
26002653
yocto-queue "^0.1.0"
26012654

2655+
p-locate@^2.0.0:
2656+
version "2.0.0"
2657+
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
2658+
integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=
2659+
dependencies:
2660+
p-limit "^1.1.0"
2661+
26022662
p-locate@^4.1.0:
26032663
version "4.1.0"
26042664
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
@@ -2613,6 +2673,11 @@ p-locate@^5.0.0:
26132673
dependencies:
26142674
p-limit "^3.0.2"
26152675

2676+
p-try@^1.0.0:
2677+
version "1.0.0"
2678+
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
2679+
integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=
2680+
26162681
p-try@^2.0.0:
26172682
version "2.2.0"
26182683
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
@@ -2625,6 +2690,14 @@ parent-module@^1.0.0:
26252690
dependencies:
26262691
callsites "^3.0.0"
26272692

2693+
parse-json@^4.0.0:
2694+
version "4.0.0"
2695+
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"
2696+
integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=
2697+
dependencies:
2698+
error-ex "^1.3.1"
2699+
json-parse-better-errors "^1.0.1"
2700+
26282701
parse-json@^5.2.0:
26292702
version "5.2.0"
26302703
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd"
@@ -2635,6 +2708,11 @@ parse-json@^5.2.0:
26352708
json-parse-even-better-errors "^2.3.0"
26362709
lines-and-columns "^1.1.6"
26372710

2711+
path-exists@^3.0.0:
2712+
version "3.0.0"
2713+
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
2714+
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
2715+
26382716
path-exists@^4.0.0:
26392717
version "4.0.0"
26402718
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
@@ -2670,11 +2748,24 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1:
26702748
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
26712749
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
26722750

2751+
pify@^3.0.0:
2752+
version "3.0.0"
2753+
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"
2754+
integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=
2755+
26732756
pirates@^4.0.4:
26742757
version "4.0.5"
26752758
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b"
26762759
integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==
26772760

2761+
pkg-conf@^2.1.0:
2762+
version "2.1.0"
2763+
resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-2.1.0.tgz#2126514ca6f2abfebd168596df18ba57867f0058"
2764+
integrity sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=
2765+
dependencies:
2766+
find-up "^2.0.0"
2767+
load-json-file "^4.0.0"
2768+
26782769
pkg-dir@^4.2.0:
26792770
version "4.2.0"
26802771
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
@@ -2850,6 +2941,15 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
28502941
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
28512942
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
28522943

2944+
signale@^1.4.0:
2945+
version "1.4.0"
2946+
resolved "https://registry.yarnpkg.com/signale/-/signale-1.4.0.tgz#c4be58302fb0262ac00fc3d886a7c113759042f1"
2947+
integrity sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==
2948+
dependencies:
2949+
chalk "^2.3.2"
2950+
figures "^2.0.0"
2951+
pkg-conf "^2.1.0"
2952+
28532953
sisteransi@^1.0.5:
28542954
version "1.0.5"
28552955
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
@@ -2909,6 +3009,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
29093009
dependencies:
29103010
ansi-regex "^5.0.1"
29113011

3012+
strip-bom@^3.0.0:
3013+
version "3.0.0"
3014+
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
3015+
integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=
3016+
29123017
strip-bom@^4.0.0:
29133018
version "4.0.0"
29143019
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878"
@@ -3172,12 +3277,12 @@ yargs-parser@^21.0.0, yargs-parser@^21.0.1:
31723277
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
31733278
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
31743279

3175-
yargs@^17.3.1:
3176-
version "17.6.0"
3177-
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.0.tgz#e134900fc1f218bc230192bdec06a0a5f973e46c"
3178-
integrity sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==
3280+
yargs@^17.3.1, yargs@^17.4.1:
3281+
version "17.5.1"
3282+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e"
3283+
integrity sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==
31793284
dependencies:
3180-
cliui "^8.0.1"
3285+
cliui "^7.0.2"
31813286
escalade "^3.1.1"
31823287
get-caller-file "^2.0.5"
31833288
require-directory "^2.1.1"

0 commit comments

Comments
 (0)