Skip to content

Commit f228227

Browse files
committed
build: Migrate build to rollup
1 parent bcd447d commit f228227

File tree

4 files changed

+134
-4
lines changed

4 files changed

+134
-4
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rollup.config.mjs

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
"author": "Oliver Roick <oliver@roick.email>",
77
"license": "MIT",
88
"private": false,
9-
"main": "./dist/index.js",
10-
"module": "./dist/index.js",
9+
"main": "./dist/index.cjs",
10+
"module": "./dist/index.es.mjs",
1111
"types": "./dist/index.d.ts",
1212
"source": "./src/index.ts",
1313
"peerDependencies": {
1414
"react": "^18.1.0",
1515
"react-dom": "^18.1.0"
1616
},
1717
"devDependencies": {
18+
"@rollup/plugin-typescript": "^9.0.2",
1819
"@testing-library/jest-dom": "^5.16.4",
1920
"@testing-library/react": "^13.1.1",
2021
"@testing-library/react-hooks": "^8.0.0",
@@ -31,13 +32,15 @@
3132
"jest-fetch-mock": "^3.0.3",
3233
"react": "^18.1.0",
3334
"react-dom": "^18.1.0",
35+
"rollup": "^3.4.0",
36+
"rollup-plugin-dts": "^5.0.0",
3437
"ts-jest": "^27.1.4",
3538
"typescript": "^4.6.4"
3639
},
3740
"scripts": {
3841
"test": "jest",
3942
"lint": "eslint 'src/**/*.ts'",
40-
"build": "tsc"
43+
"build": "rollup -c rollup.config.mjs"
4144
},
4245
"dependencies": {}
4346
}

rollup.config.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import typescript from "@rollup/plugin-typescript";
2+
import dts from "rollup-plugin-dts";
3+
4+
const input = "./src/index.ts";
5+
const sourcemap = true;
6+
7+
export default [
8+
{
9+
input,
10+
output: {
11+
file: "dist/stac-react.es.mjs",
12+
format: "es",
13+
sourcemap,
14+
},
15+
plugins: [typescript()],
16+
},
17+
{
18+
input,
19+
output: {
20+
file: "dist/index.d.ts",
21+
format: "es",
22+
},
23+
plugins: [dts()],
24+
},
25+
{
26+
input,
27+
output: {
28+
file: "dist/stac-react.cjs",
29+
format: "cjs",
30+
sourcemap,
31+
},
32+
plugins: [typescript()],
33+
},
34+
];

yarn.lock

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
dependencies:
1818
"@babel/highlight" "^7.16.7"
1919

20+
"@babel/code-frame@^7.18.6":
21+
version "7.18.6"
22+
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a"
23+
integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==
24+
dependencies:
25+
"@babel/highlight" "^7.18.6"
26+
2027
"@babel/compat-data@^7.17.10":
2128
version "7.17.10"
2229
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.10.tgz#711dc726a492dfc8be8220028b1b92482362baab"
@@ -129,6 +136,11 @@
129136
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad"
130137
integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==
131138

139+
"@babel/helper-validator-identifier@^7.18.6":
140+
version "7.19.1"
141+
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
142+
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
143+
132144
"@babel/helper-validator-option@^7.16.7":
133145
version "7.16.7"
134146
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23"
@@ -152,6 +164,15 @@
152164
chalk "^2.0.0"
153165
js-tokens "^4.0.0"
154166

167+
"@babel/highlight@^7.18.6":
168+
version "7.18.6"
169+
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf"
170+
integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==
171+
dependencies:
172+
"@babel/helper-validator-identifier" "^7.18.6"
173+
chalk "^2.0.0"
174+
js-tokens "^4.0.0"
175+
155176
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.7", "@babel/parser@^7.17.10":
156177
version "7.17.10"
157178
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.10.tgz#873b16db82a8909e0fbd7f115772f4b739f6ce78"
@@ -559,6 +580,23 @@
559580
"@nodelib/fs.scandir" "2.1.5"
560581
fastq "^1.6.0"
561582

583+
"@rollup/plugin-typescript@^9.0.2":
584+
version "9.0.2"
585+
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-9.0.2.tgz#c0cdfa39e267f306ff7316405a35406d5821eaa7"
586+
integrity sha512-/sS93vmHUMjzDUsl5scNQr1mUlNE1QjBBvOhmRwJCH8k2RRhDIm3c977B3wdu3t3Ap17W6dDeXP3hj1P1Un1bA==
587+
dependencies:
588+
"@rollup/pluginutils" "^5.0.1"
589+
resolve "^1.22.1"
590+
591+
"@rollup/pluginutils@^5.0.1":
592+
version "5.0.2"
593+
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33"
594+
integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==
595+
dependencies:
596+
"@types/estree" "^1.0.0"
597+
estree-walker "^2.0.2"
598+
picomatch "^2.3.1"
599+
562600
"@sinonjs/commons@^1.7.0":
563601
version "1.8.3"
564602
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d"
@@ -662,6 +700,11 @@
662700
dependencies:
663701
"@babel/types" "^7.3.0"
664702

703+
"@types/estree@^1.0.0":
704+
version "1.0.0"
705+
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2"
706+
integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==
707+
665708
"@types/geojson@^7946.0.8":
666709
version "7946.0.8"
667710
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca"
@@ -1616,6 +1659,11 @@ estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0:
16161659
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
16171660
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
16181661

1662+
estree-walker@^2.0.2:
1663+
version "2.0.2"
1664+
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
1665+
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
1666+
16191667
esutils@^2.0.2:
16201668
version "2.0.3"
16211669
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@@ -1740,7 +1788,7 @@ fs.realpath@^1.0.0:
17401788
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
17411789
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
17421790

1743-
fsevents@^2.3.2:
1791+
fsevents@^2.3.2, fsevents@~2.3.2:
17441792
version "2.3.2"
17451793
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
17461794
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
@@ -2019,6 +2067,13 @@ is-core-module@^2.2.0, is-core-module@^2.8.1:
20192067
dependencies:
20202068
has "^1.0.3"
20212069

2070+
is-core-module@^2.9.0:
2071+
version "2.11.0"
2072+
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144"
2073+
integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==
2074+
dependencies:
2075+
has "^1.0.3"
2076+
20222077
is-date-object@^1.0.1:
20232078
version "1.0.5"
20242079
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f"
@@ -2734,6 +2789,13 @@ lz-string@^1.4.4:
27342789
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
27352790
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=
27362791

2792+
magic-string@^0.26.7:
2793+
version "0.26.7"
2794+
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.7.tgz#caf7daf61b34e9982f8228c4527474dac8981d6f"
2795+
integrity sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==
2796+
dependencies:
2797+
sourcemap-codec "^1.4.8"
2798+
27372799
make-dir@^3.0.0:
27382800
version "3.1.0"
27392801
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
@@ -3181,6 +3243,15 @@ resolve@^1.20.0:
31813243
path-parse "^1.0.7"
31823244
supports-preserve-symlinks-flag "^1.0.0"
31833245

3246+
resolve@^1.22.1:
3247+
version "1.22.1"
3248+
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177"
3249+
integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==
3250+
dependencies:
3251+
is-core-module "^2.9.0"
3252+
path-parse "^1.0.7"
3253+
supports-preserve-symlinks-flag "^1.0.0"
3254+
31843255
resolve@^2.0.0-next.3:
31853256
version "2.0.0-next.3"
31863257
resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46"
@@ -3201,6 +3272,22 @@ rimraf@^3.0.0, rimraf@^3.0.2:
32013272
dependencies:
32023273
glob "^7.1.3"
32033274

3275+
rollup-plugin-dts@^5.0.0:
3276+
version "5.0.0"
3277+
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-5.0.0.tgz#d645f222ea6f7d6b7ddb7ea98c45a0e5a3a569ec"
3278+
integrity sha512-OO8ayCvuJCKaQSShyVTARxGurVVk4ulzbuvz+0zFd1f93vlnWFU5pBMT7HFeS6uj7MvvZLx4kUAarGATSU1+Ng==
3279+
dependencies:
3280+
magic-string "^0.26.7"
3281+
optionalDependencies:
3282+
"@babel/code-frame" "^7.18.6"
3283+
3284+
rollup@^3.4.0:
3285+
version "3.4.0"
3286+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.4.0.tgz#3f363d46474deb54e6da38d398c3af845c1b7d43"
3287+
integrity sha512-4g8ZrEFK7UbDvy3JF+d5bLiC8UKkS3n/27/cnVeESwB1LVPl6MoPL32/6+SCQ1vHTp6Mvp2veIHtwELhi+uXEw==
3288+
optionalDependencies:
3289+
fsevents "~2.3.2"
3290+
32043291
run-parallel@^1.1.9:
32053292
version "1.2.0"
32063293
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
@@ -3306,6 +3393,11 @@ source-map@^0.7.3:
33063393
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
33073394
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
33083395

3396+
sourcemap-codec@^1.4.8:
3397+
version "1.4.8"
3398+
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
3399+
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
3400+
33093401
sprintf-js@~1.0.2:
33103402
version "1.0.3"
33113403
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"

0 commit comments

Comments
 (0)