Skip to content

Commit

Permalink
[PAY-3747] Add sdk bundle analyzer to browser esm and shortcut for fa…
Browse files Browse the repository at this point in the history
…st build (#10870)
  • Loading branch information
raymondjacobson authored Jan 2, 2025
1 parent a0b27b4 commit 18ea0ce
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 4 deletions.
78 changes: 78 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"harmony:dev": "npm run storybook -w @audius/harmony",
"SDK======================================": "",
"sdk": "turbo run start --filter=@audius/sdk",
"sdk:browser:es": "npm run start:sdk:browser:es -w @audius/sdk",
"PROTOCOL======================================": "",
"protocol": "turbo run start --filter=@audius/compose --",
"PEDALBOARD======================================": "",
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@
"build:sdk": "rm -rf ./dist && rollup -c rollup.sdk.config.ts --configPlugin typescript",
"build:sdk:browser": "rm -rf ./dist && rollup -c rollup.sdk.browser.config.ts --configPlugin typescript",
"build:sdk:browser:dist": "rm -rf ./dist && rollup -c rollup.sdk.browser.dist.config.ts --configPlugin typescript",
"build:sdk:browser:es": "rm -rf ./dist && rollup -c rollup.sdk.browser.es.config.ts --configPlugin typescript",
"build:sdk:native": "rm -rf ./dist && rollup -c rollup.sdk.native.config.ts --configPlugin typescript",
"start": "rollup -c -w --configPlugin typescript",
"start:sdk": "rollup -c rollup.sdk.config.ts -w --configPlugin typescript",
"start:sdk:browser": "rollup -c rollup.sdk.browser.config.ts -w --configPlugin typescript",
"start:sdk:browser:dist": "rollup -c rollup.sdk.browser.dist.config.ts -w --configPlugin typescript",
"start:sdk:browser:es": "rollup -c rollup.sdk.browser.es.config.ts -w --configPlugin typescript",
"start:sdk:native": "rollup -c rollup.sdk.native.config.ts -w --configPlugin typescript",
"lint": "eslint ./src",
"lint:fix": "npm run lint -- --fix",
Expand Down Expand Up @@ -149,6 +151,7 @@
"rollup-plugin-polyfill-node": "0.9.0",
"rollup-plugin-shim": "1.0.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-visualizer": "5.13.1",
"stream-browserify": "3.0.0",
"ts-node": "10.9.2",
"tslib": "^2.6.2",
Expand Down
11 changes: 7 additions & 4 deletions packages/sdk/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import typescript from '@rollup/plugin-typescript'
import ignore from 'rollup-plugin-ignore'
import nodePolyfills from 'rollup-plugin-polyfill-node'
import { terser } from 'rollup-plugin-terser'
import { visualizer } from 'rollup-plugin-visualizer'

import pkg from './package.json'

Expand Down Expand Up @@ -80,10 +81,8 @@ export const outputConfigs = {
},

/**
* SDK (and Libs) Node Package (ES Module)
* SDK Node Package (ES Module)
* Used by third parties using ES Modules
* Could be used by Audius Content Node and Identity Service after moving those services to ES module
* - Includes libs
*/
sdkConfigEs: {
input: 'src/index.ts',
Expand Down Expand Up @@ -205,7 +204,11 @@ export const outputConfigs = {
nodePolyfills(),
babel({ babelHelpers: 'bundled', extensions }),
json(),
pluginTypescript
pluginTypescript,
visualizer({
filename: 'dist/sdk.browser.esm.html',
template: 'sunburst'
})
],
external: external.filter((dep) => !browserInternal.includes(dep))
},
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/rollup.sdk.browser.es.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { outputConfigs } from './rollup.config'

export default [outputConfigs.sdkBrowserConfigEs]

0 comments on commit 18ea0ce

Please sign in to comment.