jellyfin-sdk-typescript/rollup.config.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-03-20 17:17:41 +00:00
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import typescript from '@rollup/plugin-typescript';
import { glob } from 'glob';
2023-03-23 20:47:54 +00:00
/** @type {import('rollup').RollupOptions} */
2023-03-20 17:17:41 +00:00
export default {
// This is adapted from the sample config: https://www.rollupjs.org/configuration-options/#input
input: Object.fromEntries(
2023-03-23 20:47:54 +00:00
// Only looking for index files since they should be the only entry points
glob.sync('src/**/index.ts', { ignore: 'src/**/__{helpers,tests}__/*' }).map(file => [
2023-03-20 17:17:41 +00:00
// 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',
2023-03-23 20:47:54 +00:00
format: 'es',
preserveModules: true,
preserveModulesRoot: 'src'
2023-03-20 17:17:41 +00:00
},
external: [
'axios'
2023-03-20 17:17:41 +00:00
],
plugins: [ typescript() ]
};