Skip to content

Commit

Permalink
feat: add back react entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
eTallang committed Dec 12, 2024
1 parent 160c543 commit b576471
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build-designsystem
- run: cd dist && npm publish --access=public
- run: cd packages/lib/dist && npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
14 changes: 10 additions & 4 deletions packages/lib/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ import esbuild from 'esbuild';
import { dtsPlugin } from 'esbuild-plugin-d.ts';
import litPlugin from 'esbuild-plugin-lit';

import { dependencies } from './package.json';
import { dependencies, peerDependencies } from './package.json';

esbuild.build({
entryPoints: ['components/**/(index|react).ts'],
entryPoints: ['components/**/index.ts', 'components/**/react.ts'],
outdir: 'dist',
bundle: true,
sourcemap: true,
metafile: true,
outbase: 'components',
allowOverwrite: true,
format: 'esm',
plugins: [litPlugin(), dtsPlugin({ tsconfig: 'tsconfig.lib.json' })],
external: [...Object.keys(dependencies)],

/**
* The React wrappers import the web component from the index file.
* We do not want to bundle the web component into the react entry point,
* so we exclude all imports of "./index" from the bundle.
*/
external: [...Object.keys(dependencies), ...Object.keys(peerDependencies), './index*'],
});
5 changes: 4 additions & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
"scripts": {
"build": "bun run build-components && bun run build-global-styles",
"build-global-styles": "tsup global-styles.css --out-dir dist",
"build-components": "rm -rf dist && bun build.ts",
"build-components": "bun build.ts",
"create-icon-registry": "svg-to-ts-constants"
},
"dependencies": {
"@lit/context": "^1.1.3",
"@lit/react": "^1.0.6",
"lit": "^3.2.1"
},
"peerDependencies": {
"react": ">=18.0.0 <20.0.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
"esbuild": "^0.24.0",
Expand Down

0 comments on commit b576471

Please sign in to comment.