mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
d282b7a6f8
* moved themecontext to data * chore(grafana-ui): re-export ThemeContext from grafana/data for backwards compatibility * Moved icon bundling to core. * feat(plugins): share react-inlinesvg with plugins for grafana/ui bundling * chore(codeowners): add generate-icon-bundle.js to file * chore(storybook): update path to iconBundle file for theme * feat(plugins): share i18n dependency via systemjs * Make sure that icon bundle is initialized for tests. * Removed comment. * added tests for icon root. * Removing the need of having an init variable. * feat(grafana-ui): add icon svgs to bundle for projects that don't rely on grafana --------- Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import resolve from '@rollup/plugin-node-resolve';
|
|
import path from 'path';
|
|
import copy from 'rollup-plugin-copy';
|
|
import dts from 'rollup-plugin-dts';
|
|
import esbuild from 'rollup-plugin-esbuild';
|
|
import { externals } from 'rollup-plugin-node-externals';
|
|
|
|
const icons = require('../../public/app/core/icons/cached.json');
|
|
|
|
const pkg = require('./package.json');
|
|
|
|
const iconSrcPaths = icons.map((iconSubPath) => {
|
|
return `../../public/img/icons/${iconSubPath}.svg`;
|
|
});
|
|
|
|
export default [
|
|
{
|
|
input: 'src/index.ts',
|
|
plugins: [
|
|
externals({ deps: true, packagePath: './package.json' }),
|
|
resolve(),
|
|
copy({
|
|
targets: [{ src: iconSrcPaths, dest: './dist/public/' }],
|
|
flatten: false,
|
|
}),
|
|
esbuild(),
|
|
],
|
|
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-ui/src`),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
input: './compiled/index.d.ts',
|
|
plugins: [dts()],
|
|
output: {
|
|
file: pkg.publishConfig.types,
|
|
format: 'es',
|
|
},
|
|
},
|
|
];
|