Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(bueno): improve exports, externalize dependencies from bundles #4987

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"disabled": $[IS_NIGHTLY],
"bucket": "{terraform.infra.infra.bucket_binaries}",
"directory": "proda/StaticCDN/bueno/v$[BUENO_PATCH_VERSION]",
"source": "packages/bueno/dist/browser",
"source": "packages/bueno/cdn",
"parameters": {
"acl": "public-read"
}
Expand All @@ -33,7 +33,7 @@
"disabled": $[IS_NIGHTLY],
"bucket": "{terraform.infra.infra.bucket_binaries}",
"directory": "proda/StaticCDN/bueno/v$[BUENO_MINOR_VERSION]",
"source": "packages/bueno/dist/browser",
"source": "packages/bueno/cdn",
"parameters": {
"acl": "public-read"
}
Expand All @@ -45,7 +45,7 @@
"disabled": $[IS_NIGHTLY],
"bucket": "{terraform.infra.infra.bucket_binaries}",
"directory": "proda/StaticCDN/bueno/v$[BUENO_MAJOR_VERSION]",
"source": "packages/bueno/dist/browser",
"source": "packages/bueno/cdn",
"parameters": {
"acl": "public-read"
}
Expand All @@ -57,7 +57,7 @@
"disabled": $[IS_NOT_NIGHTLY],
"bucket": "{terraform.infra.infra.bucket_binaries}",
"directory": "proda/StaticCDN/bueno/v$[BUENO_MAJOR_VERSION]-nightly",
"source": "packages/bueno/dist/browser",
"source": "packages/bueno/cdn",
"parameters": {
"acl": "public-read"
}
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ utils/**/.storybook/**
**/.angular/**
**/.next/**
**/www/**
**/cdn/**
scripts/deploy/execute-deployment-pipeline.mjs
**/staticresources/**
packages/atomic-hosted-page/loader/**/*
Expand All @@ -29,4 +30,3 @@ packages/samples/vuejs/public/lang/*.json
.deployment.config.json
packages/atomic-angular/scripts/build-lit.mjs
packages/atomic-react/scripts/build-lit.mjs
packages/atomic-hosted-page/cdn/**/*
2 changes: 1 addition & 1 deletion packages/atomic-hosted-page/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const run = async () => {

console.log(`Copying bueno files to ${devPublicDir}/bueno/v${buenoVersion}`);
await copyFiles(
path.join(buenoDir, 'dist/browser'),
path.join(buenoDir, 'cdn'),
`${devPublicDir}/bueno/v${buenoVersion}`
);

Expand Down
2 changes: 1 addition & 1 deletion packages/atomic/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default defineConfig({
? {
command:
process.env.DEPLOYMENT_ENVIRONMENT === 'CDN'
? 'cp -r ../headless/dist/browser ./dist-storybook/headless/ && cp -r ../bueno/dist/browser ./dist-storybook/bueno/ && npx ws -c ws.config.cjs'
? 'cp -r ../headless/dist/browser ./dist-storybook/headless/ && cp -r ../bueno/cdn ./dist-storybook/bueno/ && npx ws -c ws.config.cjs'
: 'npx ws -d ./dist-storybook -p 4400',
port: 4400,
timeout: 120 * 1000,
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic/scripts/start-vite.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const run = async () => {

console.log(`Copying bueno files to ${devPublicDir}/bueno/v${buenoVersion}`);
await copyFiles(
path.join(buenoDir, 'dist/browser'),
path.join(buenoDir, 'cdn'),
`${devPublicDir}/bueno/v${buenoVersion}`
);

Expand Down
1 change: 1 addition & 0 deletions packages/bueno/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cdn/
6 changes: 4 additions & 2 deletions packages/bueno/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function nodeCjs() {
return build({
...base,
platform: 'node',
packages: 'external',
outfile: 'dist/bueno.js',
format: 'cjs',
});
Expand All @@ -29,6 +30,7 @@ function nodeEsm() {
return build({
...base,
platform: 'node',
packages: 'external',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bueno has no dependencies !

outfile: 'dist/bueno.esm.js',
format: 'esm',
});
Expand All @@ -38,7 +40,7 @@ function browserEsm() {
return build({
...base,
platform: 'browser',
outfile: 'dist/browser/bueno.esm.js',
outfile: 'cdn/bueno.esm.js',
format: 'esm',
watch: devMode,
});
Expand Down Expand Up @@ -70,7 +72,7 @@ function browserUmd() {
return build({
...base,
platform: 'browser',
outfile: 'dist/browser/bueno.js',
outfile: 'cdn/bueno.js',
format: 'cjs',
banner: {
js: `${base.banner.js}`,
Expand Down
12 changes: 8 additions & 4 deletions packages/bueno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
},
"main": "./dist/bueno.js",
"module": "./dist/bueno.esm.js",
"browser": {
"./dist/bueno.esm.js": "./dist/browser/bueno.esm.js",
"./dist/bueno.js": "./dist/browser/bueno.js"
},
"types": "./dist/definitions/index.d.ts",
"license": "Apache-2.0",
"version": "1.0.7",
"files": [
"dist/"
],
"exports": {
".": {
"types": "./dist/definitions/index.d.ts",
"import": "./dist/bueno.esm.js",
"require": "./dist/bueno.js",
"default": "./dist/bueno.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put ESM as default ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but I think it might be breaking

}
},
"scripts": {
"dev": "concurrently \"npm run build:definitions -- -w\" \"npm run build:bundles -- dev\"",
"build": "nx build",
Expand Down
2 changes: 1 addition & 1 deletion packages/quantic/build-static-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const LIBRARY_CONFIG = {
],
files: [
{
src: resolveLibraryPath('@coveo/bueno', '../dist/browser/bueno.js'),
src: resolveLibraryPath('@coveo/bueno', '../cdn/bueno.js'),
dest: `${STATIC_RESOURCES_PATH}/coveobueno/browser/bueno.js`,
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/headless-commerce-react/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineConfig({
viteStaticCopy({
targets: [
{
src: '../../bueno/dist/browser/*',
src: '../../bueno/cdn/*',
dest: `./bueno/${buenoVersion}`,
},
{
Expand Down
Loading