mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 17:12:19 +08:00

* feat(grafana-ui): build unstable entrypoint for experimental components * feat(plugins): expose grafana/ui/unstable * build(grafana-ui): add rollup plugin to create alias package.json for unstable entrypoint * build(packages): rewrite prepare npm script to generate alias packagejson files * chore(packages): use relative paths in publishConfig for exports generation * chore(frontend): move npmcli/package-json package to root package.json * revert(grafana-ui): remove rollup plugin for generating alias package.json files * chore(grafana-ui): clean up unstable directory postpack to prevent yarn lock issues * build(packages): fix scope for pkgName usage * feat(packages): create separate cjs and esm builds that validate with arethetypeswrong cli * chore(yarn): refresh lock file * fix(packages): make sure alias package.jsons point to existing files
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { createRequire } from 'node:module';
|
|
import copy from 'rollup-plugin-copy';
|
|
import svg from 'rollup-plugin-svg-import';
|
|
|
|
import { cjsOutput, entryPoint, esmOutput, plugins, tsDeclarationOutput } from '../rollup.config.parts';
|
|
|
|
const rq = createRequire(import.meta.url);
|
|
const icons = rq('../../public/app/core/icons/cached.json');
|
|
const pkg = rq('./package.json');
|
|
|
|
const iconSrcPaths = icons.map((iconSubPath) => {
|
|
return `../../public/img/icons/${iconSubPath}.svg`;
|
|
});
|
|
|
|
export default [
|
|
{
|
|
input: entryPoint,
|
|
plugins: [
|
|
...plugins,
|
|
svg({ stringify: true }),
|
|
copy({
|
|
targets: [{ src: iconSrcPaths, dest: './dist/public/' }],
|
|
flatten: false,
|
|
}),
|
|
],
|
|
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-ui')],
|
|
},
|
|
{
|
|
input: 'src/unstable.ts',
|
|
plugins: [
|
|
...plugins,
|
|
svg({ stringify: true }),
|
|
copy({
|
|
targets: [{ src: iconSrcPaths, dest: './dist/public/' }],
|
|
flatten: false,
|
|
}),
|
|
],
|
|
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-ui')],
|
|
},
|
|
tsDeclarationOutput(pkg),
|
|
tsDeclarationOutput(pkg, {
|
|
input: './compiled/unstable.d.ts',
|
|
output: [
|
|
{
|
|
file: './dist/cjs/unstable.d.cts',
|
|
format: 'cjs',
|
|
},
|
|
{
|
|
file: './dist/esm/unstable.d.mts',
|
|
format: 'es',
|
|
},
|
|
],
|
|
}),
|
|
];
|