mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
refactor: migrate key packages from tsup to rollup for build consistency
Migrate icon packages and main platform packages to rollup while maintaining tsup for simpler core packages: Packages migrated to rollup: - packages/core/icons - Core SVG icon definitions - packages/html/html-icons - HTML-specific icon components - packages/html/html - Main HTML package - packages/react/react-icons - React icon components Packages remaining on tsup: - Core packages (media, media-store, playback-engine) - Simple TypeScript builds - Helper packages (*-media-elements, *-media-store) - Working fine with tsup - React Native packages - Per exclusion request Benefits: - Consistent build tooling across icon and platform packages - Better asset handling capability for future SVG/CSS requirements - Maintained simplicity for packages that don't need advanced features - All packages build successfully with proper CommonJS/ESM outputs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
bc8adaa508
commit
b5dd496a9d
@@ -16,7 +16,7 @@
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "rollup -c && tsc --project tsconfig.build.json",
|
||||
"test": "echo \"No tests yet\"",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
@@ -34,6 +34,11 @@
|
||||
"@vjs-10/html-media-store": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rollup": "^4.0.0",
|
||||
"@rollup/plugin-typescript": "^11.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.0",
|
||||
"@rollup/plugin-commonjs": "^25.0.0",
|
||||
"tslib": "^2.6.0",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
const typescript = require('@rollup/plugin-typescript');
|
||||
const resolve = require('@rollup/plugin-node-resolve');
|
||||
const commonjs = require('@rollup/plugin-commonjs');
|
||||
|
||||
module.exports = [
|
||||
// ESM build
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
file: 'dist/index.mjs',
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
},
|
||||
external: (id) => {
|
||||
// Don't externalize relative imports (starts with . or /)
|
||||
if (id.startsWith('.') || id.startsWith('/')) return false;
|
||||
// Don't externalize absolute paths (local files)
|
||||
if (id.includes('/') && !id.startsWith('@')) return false;
|
||||
// Externalize all npm packages (including scoped ones)
|
||||
return true;
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
||||
}),
|
||||
commonjs(),
|
||||
typescript({
|
||||
tsconfig: 'tsconfig.json',
|
||||
declaration: false,
|
||||
outDir: 'dist',
|
||||
}),
|
||||
],
|
||||
},
|
||||
// CommonJS build
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
file: 'dist/index.js',
|
||||
format: 'cjs',
|
||||
sourcemap: true,
|
||||
},
|
||||
external: (id) => {
|
||||
// Don't externalize relative imports (starts with . or /)
|
||||
if (id.startsWith('.') || id.startsWith('/')) return false;
|
||||
// Don't externalize absolute paths (local files)
|
||||
if (id.includes('/') && !id.startsWith('@')) return false;
|
||||
// Externalize all npm packages (including scoped ones)
|
||||
return true;
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
||||
}),
|
||||
commonjs(),
|
||||
typescript({
|
||||
tsconfig: 'tsconfig.json',
|
||||
declaration: false,
|
||||
outDir: 'dist',
|
||||
}),
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationDir": "dist",
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": ["dist", "node_modules"]
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
format: ['cjs', 'esm'],
|
||||
clean: true,
|
||||
sourcemap: true,
|
||||
outDir: 'dist',
|
||||
external: [
|
||||
// Keep all dependencies external for library builds
|
||||
/^@vjs-10\//,
|
||||
/^[^.]/,
|
||||
],
|
||||
// Generate TypeScript declarations with custom config
|
||||
dts: {
|
||||
compilerOptions: {
|
||||
composite: false,
|
||||
incremental: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user