diff --git a/.github/workflows/browser-package-size.yml b/.github/workflows/browser-package-size.yml new file mode 100644 index 0000000000..293eb1c396 --- /dev/null +++ b/.github/workflows/browser-package-size.yml @@ -0,0 +1,14 @@ +name: sdk/browser/package-size + +on: + pull_request: + branches: [main, 'feat/**'] + paths-ignore: + - '**.md' + +jobs: + package-size: + uses: launchdarkly/js-core/.github/workflows/package-size.yml@rlamb/sdk-167/bundle-size-report + with: + workspace_name: '@launchdarkly/js-client-sdk' + workspace_path: 'packages/sdk/browser' diff --git a/.github/workflows/browser.yml b/.github/workflows/browser.yml index da12b51e59..bfe0877917 100644 --- a/.github/workflows/browser.yml +++ b/.github/workflows/browser.yml @@ -31,3 +31,8 @@ jobs: with: workspace_name: '@launchdarkly/js-client-sdk' workspace_path: packages/sdk/browser + package-size: + uses: launchdarkly/js-core/.github/workflows/package-size.yml@rlamb/sdk-167/bundle-size-report + with: + workspace_name: '@launchdarkly/js-client-sdk' + workspace_path: 'packages/sdk/browser' diff --git a/.github/workflows/package-size.yml b/.github/workflows/package-size.yml new file mode 100644 index 0000000000..7931e159fc --- /dev/null +++ b/.github/workflows/package-size.yml @@ -0,0 +1,34 @@ +name: Package size report. +on: + workflow_call: + inputs: + workspace_name: + type: string + description: 'Name, from the package.json, of the package to build/test.' + required: true + workspace_path: + type: string + description: 'Path to the package to release.' + required: true + +permissions: + pull-requests: write +jobs: + size: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 21 + registry-url: 'https://registry.npmjs.org' + + - run: yarn workspaces focus ${{ inputs.workspace_name }} + + - uses: andresz1/size-limit-action@v1 + with: + directory: ${{ inputs.workspace_path }} + github_token: ${{ secrets.GITHUB_TOKEN }} + build_script: build-with-deps + skip_step: install diff --git a/packages/sdk/browser/package.json b/packages/sdk/browser/package.json index 8f66ed8d70..b4762cec93 100644 --- a/packages/sdk/browser/package.json +++ b/packages/sdk/browser/package.json @@ -48,6 +48,7 @@ "scripts": { "clean": "rimraf dist", "build": "tsup", + "build-with-deps": "yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/js-client-sdk' run build", "lint": "eslint . --ext .ts,.tsx", "prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore", "test": "npx jest --runInBand", diff --git a/packages/shared/sdk-client/package.json b/packages/shared/sdk-client/package.json index 28f75f9f02..8f909eba3d 100644 --- a/packages/shared/sdk-client/package.json +++ b/packages/shared/sdk-client/package.json @@ -35,6 +35,7 @@ "make-esm-package-json": "echo '{\"type\":\"module\"}' > dist/esm/package.json", "make-package-jsons": "npm run make-cjs-package-json && npm run make-esm-package-json", "build": "npx tsc --noEmit && rollup -c rollup.config.js && npm run make-package-jsons", + "build-with-deps": "yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/js-client-sdk-common' run build", "clean": "rimraf dist", "lint": "npx eslint . --ext .ts", "lint:fix": "yarn run lint -- --fix",