Skip to content

Commit

Permalink
Chore: Build package using ESbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Oct 19, 2021
1 parent 76743ad commit 19ff586
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 10 deletions.
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
{
"name": "@lmc-eu/cookie-consent",
"name": "@lmc-eu/cookie-consent-manager",
"version": "0.1.0",
"description": "Cookie consent banner compatible with Spirit Design System",
"license": "MIT",
"publishConfig": {
"access": "public",
"directory": "dist"
},
"scripts": {
"prebuild": "rm -rf dist && mkdir -p dist && cp package.json README.md src/cookieconsent.js dist/",
"build": "yarn css",
"prebuild": "rm -rf dist && mkdir -p dist && cp package.json README.md dist/",
"build:css": "yarn css",
"precss": "yarn css:lint",
"css": "yarn css:compile && yarn css:prefix && yarn css:minify",
"css:lint": "stylelint --config .stylelintrc \"src/**/*.scss\" --cache --cache-location .cache/.stylelintcache",
"css:compile": "sass --load-path=node_modules/@lmc-eu/spirit-design-tokens/dist/default/scss src/cookieconsent.scss dist/cookieconsent.css",
"css:prefix": "postcss --config postcss.config.js --replace \"dist/*.css\" \"!dist/*.min.css\"",
"css:minify": "cleancss --format breaksWith=lf --source-map-inline-sources --batch --batch-suffix \".min\" \"dist/*.css\" \"!dist/*.min.css\"",
"test": "yarn css:lint"
"test": "yarn css:lint",
"build:js": "node scripts/build.js",
"build": "yarn build:js && yarn build:css"
},
"dependencies": {
"@lmc-eu/spirit-design-tokens": "^0.2.0",
"vanilla-cookieconsent": "^2.5.1"
"vanilla-cookieconsent": "^2.6.0"
},
"devDependencies": {
"@lmc-eu/browserslist-config": "^1.0.0",
"@lmc-eu/stylelint-config": "^1.0.3",
"autoprefixer": "^10.3.1",
"clean-css-cli": "^5.3.3",
"esbuild": "^0.13.6",
"postcss": "^8.3.6",
"postcss-cli": "^8.3.1",
"sass": "^1.37.5",
Expand Down
37 changes: 37 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const { build } = require('esbuild')

build({
entryPoints: ['src/index.js'],
bundle: true,
minify: true,
sourcemap: true,
target: 'es2017',
outfile: 'dist/index.min.js',
}).catch((error) => {
console.error(error)
process.exit(1)
})

build({
entryPoints: ['src/index.js'],
bundle: true,
minify: false,
sourcemap: true,
target: 'es2017',
outfile: 'dist/index.js',
}).catch((error) => {
console.error(error)
process.exit(1)
})

build({
entryPoints: ['src/LmcCookieConsent.js'],
bundle: true,
minify: false,
sourcemap: false,
target: 'es2019',
outfile: 'dist/LmcCookieConsent.js',
}).catch((error) => {
console.error(error)
process.exit(1)
})
110 changes: 109 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,114 @@ error-ex@^1.3.1:
dependencies:
is-arrayish "^0.2.1"

esbuild-android-arm64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.13.6.tgz#a109b4e5203e9ec144cadccdf18a5daf021423e5"
integrity sha512-uEwrMRzqNzXxzIi0K/CtHn3/SPoRso4Dd/aJCpf9KuX+kCs9Tlhz29cKbZieznYAekdo36fDUrZyuugAwSdI+A==

esbuild-darwin-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.13.6.tgz#1a00ef4d2b3b1fe9de28a5cf195df113d6461155"
integrity sha512-oJdWZn2QV5LTM24/vVWaUFlMVlRhpG9zZIA6Xd+xbCULOURwYnYRQWIzRpXNtTfuAr3+em9PqKUaGtYqvO/DYg==

esbuild-darwin-arm64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.6.tgz#f48954d441059e2d06c1675ddcc25af00b164935"
integrity sha512-+f8Yn5doTEpCWtBaGxciDTikxESdGCNZpLYtXzMJLTWFHr8zqfAf4TAYGvg6T5T6N7OMC8HHy3GM+BijFXDXMg==

esbuild-freebsd-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.6.tgz#b3bfea7e21f0d80796220927118fc76170cac06f"
integrity sha512-Yb/DgZUX0C6i4vnOymthLzoWAJBYWbn3Y2F4wKEufsx2veGN/wlwO/yz7IWGVVzb2zMUqbt30hCLF61sUFe7gA==

esbuild-freebsd-arm64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.6.tgz#e6f5777a85012457ada049fc6b1e3e2c36161514"
integrity sha512-UKYlEb7mwprSJ9VW9+q3/Mgxest45I6rGMB/hrKY1T6lqoBVhWS4BTbL4EGetWdk05Tw4njFAO9+nmxgl7jMlA==

esbuild-linux-32@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.13.6.tgz#8b04058312a76faec6964b954f1f02ab32ce43fe"
integrity sha512-hQCZfSLBYtn8f1afFT6Dh9KeLsW12xLqrqssbhpi/xfN9c/bbCh/QQZaR9ZOEnmBHHRPb7rbSo3jQqlCWYb7LQ==

esbuild-linux-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.13.6.tgz#554d8edfe3f791f8b26978eb173b2e13643442c0"
integrity sha512-bRQwsD+xJoajonfyeq5JpiNRogH4mYFYbYsGhwrtQ4pMGk93V/4KuKQiKEisRZO0hYhZL4MtxufwF195zKlCAw==

esbuild-linux-arm64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.6.tgz#2142fadbdbc0ebd52a166f956f0ecb1f6602112a"
integrity sha512-sRc1lt9ma1xBvInCwpS77ywR6KVdcJNsErsrDkDXx3mVe8DLLEn05TG0nIX9I+s8ouHEepikdKCfe1DZdILRjQ==

esbuild-linux-arm@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.13.6.tgz#ced8e35a94e0adbf134e5fa4e2b661f897e14b27"
integrity sha512-qQUrpL7QoPqujXEFSpeu6QZ43z0+OdDPHDkLO0GPbpV/jebP7J+0FreMqoq7ZxWG4rPigwcRdEyqzHh8Bh4Faw==

esbuild-linux-mips64le@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.6.tgz#e5cbc050f5d44f8ecc0f79b1641bbad3919a2b3a"
integrity sha512-1lsHZaIsHlFkHn1QRa/EONPGVHwzdIrkKn6r2m9cYUIn2J+rKtJg0e+WkNG3MaIrxozaGKaiSPGvaG1toCbZjw==

esbuild-linux-ppc64le@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.6.tgz#57868a7eb762c1d19fa6d367b09a4610f0cbf7ca"
integrity sha512-x223JNC8XeLDf05zLaKfxqCEWVct4frp8ft8Qc13cha33TMrqMFaSPq6cgpgT2VYuUsXtwoocoWChKfvy+AUQg==

esbuild-netbsd-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.6.tgz#1c5daa62571f1065e4a1100a1db5e488ef259024"
integrity sha512-TonKf530kT25+zi1Da6esITmuBJe13QiN+QGVch6YE8t720IvIelDGwkOQN3Td7A0JjbSbK3u+Fo6YaL151VxQ==

esbuild-openbsd-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.6.tgz#315fd85970365835f6a1eb7b6e9335d59f772564"
integrity sha512-WFa5J0IuyER0UJbCGw87gvGWXGfhxeNppYcvQjp0pWYuH4FS+YqphyjV0RJlybzzDpAXkyZ9RzkMFtSAp+6AUA==

esbuild-sunos-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.13.6.tgz#8422eeb9f3712daa4befd19e5da6d7c9af9fc744"
integrity sha512-duCL8Ewri+zjKxuN/61maniDxcd8fHwSuubdAPofll0y0E6WcL/R/e/mQzhHIuoguFm5RJkKun1qua54javh7g==

esbuild-windows-32@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.13.6.tgz#694eb4768ee72219d3bc6415b1d3a0f843aea9ec"
integrity sha512-U8RkpT4f0/dygA5ytFyHNZ/fRECU9LWBMrqWflNhM31iTi6RhU0QTuOzFYkmpYnwl358ZZhVoBeEOm313d4u4A==

esbuild-windows-64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.13.6.tgz#1adbf5367b08e735262f57098d19c07d0a2fec1c"
integrity sha512-A23VyUeyBfSWUYNL0jtrJi5M/2yR/RR8zfpGQ0wU0fldqV2vxnvmBYOBwRxexFYCDRpRWh4cPFsoYoXRCFa8Dg==

esbuild-windows-arm64@0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.6.tgz#9279083740ec90a2d638485c97b1d003771d685a"
integrity sha512-K/pFqK/s5C6wXYcFKO9iPY4yU3DI0/Gbl1W2+OhaPHoXu13VGBmqbCiQ5lohHGE72FFQl76naOjEayEiI+gDMQ==

esbuild@^0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.13.6.tgz#b9be288108d47e814a6c8729e495dce0fddbf441"
integrity sha512-zkMkYwC9ohVe6qxXykKf/4jfbtM/09CL8UEEnwuhO7Xq8NOTN2yAwCrmKKvHlGrEej6Y8e/tAmHB7wMMg7O0ew==
optionalDependencies:
esbuild-android-arm64 "0.13.6"
esbuild-darwin-64 "0.13.6"
esbuild-darwin-arm64 "0.13.6"
esbuild-freebsd-64 "0.13.6"
esbuild-freebsd-arm64 "0.13.6"
esbuild-linux-32 "0.13.6"
esbuild-linux-64 "0.13.6"
esbuild-linux-arm "0.13.6"
esbuild-linux-arm64 "0.13.6"
esbuild-linux-mips64le "0.13.6"
esbuild-linux-ppc64le "0.13.6"
esbuild-netbsd-64 "0.13.6"
esbuild-openbsd-64 "0.13.6"
esbuild-sunos-64 "0.13.6"
esbuild-windows-32 "0.13.6"
esbuild-windows-64 "0.13.6"
esbuild-windows-arm64 "0.13.6"

escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
Expand Down Expand Up @@ -2077,7 +2185,7 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"

vanilla-cookieconsent@^2.5.1:
vanilla-cookieconsent@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/vanilla-cookieconsent/-/vanilla-cookieconsent-2.6.0.tgz#2f9073ce9082a9e3dbe685af0aa5907054a93dca"
integrity sha512-8ndntzgKWgBkDG7U5vGCpP5iRCa/UeUzxTmjkdYnzKwuYddFDTBSxFGgxYYQh9CO12md/oXQawNS9YOQNyCIMw==
Expand Down

0 comments on commit 19ff586

Please sign in to comment.