mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
* Modernize qrcode build * chore(qrcode): add lint helpers * fix sdk qrcode * add new qrcode ci * fix formatting * qrcode fixes * fixes * fixes rd2 * enable corepack * enable corepack * build caching * update caching * cr feedback
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import path from 'path';
|
|
import { defineConfig } from 'tsup';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
// Shared entry map to keep ESM/CJS builds in sync
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const entries = {
|
|
index: 'index.ts',
|
|
'components/LED': 'components/LED.tsx',
|
|
'components/SelfQRcode': 'components/SelfQRcode.tsx',
|
|
'utils/utils': 'utils/utils.ts',
|
|
'utils/styles': 'utils/styles.ts',
|
|
'utils/websocket': 'utils/websocket.ts',
|
|
};
|
|
|
|
export default defineConfig([
|
|
{
|
|
tsconfig: './tsconfig.json',
|
|
entry: entries,
|
|
format: ['esm'],
|
|
outDir: path.resolve(__dirname, 'dist/esm'),
|
|
outExtension: ({ format }) => ({ js: format === 'cjs' ? '.cjs' : '.js' }),
|
|
dts: false,
|
|
splitting: false,
|
|
clean: true,
|
|
sourcemap: true,
|
|
target: 'es2020',
|
|
platform: 'neutral',
|
|
external: [
|
|
/^react/,
|
|
/^react-dom/,
|
|
/^react\/jsx-runtime$/,
|
|
/^lottie-react/,
|
|
/^qrcode.react/,
|
|
/^socket.io-client/,
|
|
/^node-forge/,
|
|
],
|
|
},
|
|
{
|
|
tsconfig: './tsconfig.cjs.json',
|
|
entry: entries,
|
|
format: ['cjs'],
|
|
outDir: path.resolve(__dirname, 'dist/cjs'),
|
|
outExtension: ({ format }) => ({ js: format === 'cjs' ? '.cjs' : '.js' }),
|
|
dts: false,
|
|
splitting: false,
|
|
clean: false,
|
|
sourcemap: true,
|
|
target: 'es2020',
|
|
platform: 'neutral',
|
|
external: [
|
|
/^react/,
|
|
/^react-dom/,
|
|
/^react\/jsx-runtime$/,
|
|
/^lottie-react/,
|
|
/^qrcode.react/,
|
|
/^socket.io-client/,
|
|
/^node-forge/,
|
|
],
|
|
},
|
|
]);
|