Skip to content

Commit cc6eeba

Browse files
committed
feat(pie-cookie-banner): DSW-2679 cDN build output
1 parent 094bfe4 commit cc6eeba

File tree

6 files changed

+152
-95
lines changed

6 files changed

+152
-95
lines changed

.changeset/tidy-dolls-confess.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@justeattakeaway/pie-cookie-banner": patch
3+
---
4+
5+
[Added] - CDN dist output containing all cookie-banner and dependency code for uses where consumers cannot use npm/yarn or build tools.

packages/components/pie-cookie-banner/.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.turbo
2+
cdn_dist
23
dist
34
node_modules
45
lit-browsers-report
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cdn_dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { defineConfig } from 'vite';
2+
import dts from 'vite-plugin-dts';
3+
import { visualizer } from 'rollup-plugin-visualizer';
4+
5+
import { deepmerge } from 'deepmerge-ts';
6+
7+
// https://vitejs.dev/config/
8+
const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
9+
build: deepmerge({
10+
lib: {
11+
entry: {
12+
index: 'src/index.ts',
13+
},
14+
formats: ['es'],
15+
},
16+
rollupOptions: {
17+
external: (id) => {
18+
if (['react', '@lit/react'].includes(id)) {
19+
return true;
20+
}
21+
return false;
22+
},
23+
},
24+
outDir: 'cdn_dist',
25+
}, build),
26+
test: {
27+
dir: '.',
28+
environment: 'jsdom',
29+
globals: true,
30+
include: [
31+
'./src/__tests__/**/*.{spec,test}.{js,ts}',
32+
'./test/unit/**/*.{spec,test}.{js,ts}',
33+
],
34+
exclude: ['**/node_modules/**'],
35+
},
36+
plugins: deepmerge([dts({
37+
insertTypesEntry: true,
38+
outputDir: 'cdn_dist',
39+
rollupTypes: true,
40+
}),
41+
visualizer({
42+
gzipSize: true,
43+
brotliSize: true,
44+
})], plugins),
45+
46+
...rest,
47+
});
48+
49+
export default sharedConfig;

packages/components/pie-cookie-banner/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"componentStatus": "stable"
1818
},
1919
"scripts": {
20-
"build": "run -T vite build",
20+
"build": "run -T vite build && yarn build:cdn",
21+
"build:cdn": "run -T vite build --config './cdn.vite.confg.js'",
2122
"build:react-wrapper": "npx build-react-wrapper",
2223
"create:manifest": "yarn cem analyze --litelement",
2324
"lint:scripts": "run -T eslint .",

0 commit comments

Comments
 (0)