grafana/packages/grafana-prometheus/rollup.config.ts
Brendan O'Handley c6f8462a06
Prometheus: Library fixes for using in external vendor DS (#82115)
* fix stateSlice type errors for build, do not export stateSlice in the future

* fix exports for consistency

* fix package.json for rollup, update licence, keep private

* rollup as devdependencies

* try a different version of @testing-library/dom to try to fix the aria-query issue in drone

* remove testUtils export

* change @testing-library/dom version back

* remove icon bundling, grafana-ui handles this

* remove unused dependencies

* components folder: avoid nested barrel files and use named exports

* configuration folder: avoid nested barrel files and use named exports

* querybuilder folder: avoid nested barrel files and use named exports

* general files: use named exports

* fix loader issue with promql for external ds

* default to support labels match api

* export things necessary for custom config auth

* remove changes to core datasource.test.ts

* Update packages/grafana-prometheus/package.json

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>

* remove icons script, not needed

* update readme, remove references to grafana/ui

* remove private property

* check tests

* remove private property in package.json

* update changelog

* update npm drone script for file checks

* debug why updating test in script broke another library that had never been tested before

* fix npm test for checking licenses

* fix npm test for checking licenses

* fix npm test for checking licenses

* fix npm test for checking licenses

* update license file for npm drone test

* fix bash script

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2024-02-16 12:55:39 -06:00

39 lines
1.1 KiB
TypeScript

import image from '@rollup/plugin-image';
import resolve from '@rollup/plugin-node-resolve';
import path from 'path';
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
import { externals } from 'rollup-plugin-node-externals';
const pkg = require('./package.json');
export default [
{
input: 'src/index.ts',
plugins: [externals({ deps: true, packagePath: './package.json' }), resolve(), esbuild(), image()],
output: [
{
format: 'cjs',
sourcemap: true,
dir: path.dirname(pkg.publishConfig.main),
},
{
format: 'esm',
sourcemap: true,
dir: path.dirname(pkg.publishConfig.module),
preserveModules: true,
// @ts-expect-error (TS cannot assure that `process.env.PROJECT_CWD` is a string)
preserveModulesRoot: path.join(process.env.PROJECT_CWD, `packages/grafana-prometheus/src`),
},
],
},
{
input: './compiled/index.d.ts',
plugins: [dts()],
output: {
file: pkg.publishConfig.types,
format: 'es',
},
},
];