jellyfin-sdk-typescript/rollup.config.js
Fernando Fernández a27eba5d2b Drop compare-versions dependency
The version check we needed is simple enough to implement ourselves,
shaving off some bytes from the bundle size consumers will have when using the SDK
2023-04-27 14:52:32 +02:00

35 lines
1.0 KiB
JavaScript

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import typescript from '@rollup/plugin-typescript';
import { glob } from 'glob';
/** @type {import('rollup').RollupOptions} */
export default {
// This is adapted from the sample config: https://www.rollupjs.org/configuration-options/#input
input: Object.fromEntries(
// Only looking for index files since they should be the only entry points
glob.sync('src/**/index.ts', { ignore: 'src/**/__{helpers,tests}__/*' }).map(file => [
// This remove `src/` as well as the file extension from each
// file, so e.g. src/nested/foo.js becomes nested/foo
path.relative(
'src',
file.slice(0, file.length - path.extname(file).length)
),
// This expands the relative paths to absolute paths, so e.g.
// src/nested/foo becomes /project/src/nested/foo.js
fileURLToPath(new URL(file, import.meta.url))
])
),
output: {
dir: 'lib',
format: 'es',
preserveModules: true,
preserveModulesRoot: 'src'
},
external: [
'axios'
],
plugins: [ typescript() ]
};