From 84c9d37cb7db4661e2446cd43a0204940447d8fd Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:53:19 +0200 Subject: [PATCH] Revise build step and dist structure for better Webpack, CJS and pnpm support --- .github/workflows/lint.yaml | 1 + .gitignore | 1 - README.md | 2 +- api-extractor.json | 2 +- build.mjs | 8 ++--- dev/convert.html | 2 +- dev/demux.html | 2 +- dev/live.html | 2 +- dev/mux.html | 2 +- dev/player.html | 2 +- package-lock.json | 58 ++++++++++++++----------------------- package.json | 22 ++++++++------ scripts/append-namespace.ts | 3 -- src/index.ts | 3 ++ src/tsconfig.json | 3 +- vite.config.ts | 2 +- 16 files changed, 52 insertions(+), 63 deletions(-) delete mode 100644 scripts/append-namespace.ts diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ea5e0d8..8456745 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -2,6 +2,7 @@ name: Lint on: push: + pull_request: jobs: lint: diff --git a/.gitignore b/.gitignore index 2d5e455..9f717d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /node_modules -/build /dist /dist-docs .DS_Store diff --git a/README.md b/README.md index 91e7547..49a45ec 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ For development, clone this repository and install it using a modern version of ```bash npm install # Install dependencies -npm run watch # Development build with watch mode +npm run watch # Build bundles on watch mode npm run build # Production build with type definitions diff --git a/api-extractor.json b/api-extractor.json index 2b6166d..4bd5a02 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -1,6 +1,6 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "build/index.d.ts", + "mainEntryPointFilePath": "dist/modules/index.d.ts", "bundledPackages": [], "compiler": {}, "apiReport": { diff --git a/build.mjs b/build.mjs index 9b4b7f8..4ac1cb5 100644 --- a/build.mjs +++ b/build.mjs @@ -37,20 +37,20 @@ const esmConfig = { const ctxUmd = await esbuild.context({ ...umdConfig, - outfile: 'dist/mediabunny.js', + outfile: 'dist/bundles/mediabunny.cjs', }); const ctxEsm = await esbuild.context({ ...esmConfig, - outfile: 'dist/mediabunny.mjs', + outfile: 'dist/bundles/mediabunny.mjs', }); const ctxUmdMinified = await esbuild.context({ ...umdConfig, - outfile: 'dist/mediabunny.min.js', + outfile: 'dist/bundles/mediabunny.min.cjs', minify: true, }); const ctxEsmMinified = await esbuild.context({ ...esmConfig, - outfile: 'dist/mediabunny.min.mjs', + outfile: 'dist/bundles/mediabunny.min.mjs', minify: true, }); diff --git a/dev/convert.html b/dev/convert.html index 3fcaad9..6f1a27c 100644 --- a/dev/convert.html +++ b/dev/convert.html @@ -1,6 +1,6 @@ - + + + + +