Alerting: Add rollup config for package (#106326)

This commit is contained in:
Gilles De Mey
2025-06-18 17:06:57 +02:00
committed by GitHub
parent 6e45069cdd
commit 97e33b5da4
6 changed files with 85 additions and 17 deletions
+30 -7
View File
@@ -2,8 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/alerting",
"version": "12.0.0-pre",
"private": true,
"version": "12.1.0-pre",
"description": "Grafana Alerting Library – Build vertical integrations on top of the industry-leading alerting solution",
"keywords": [
"typescript",
@@ -15,13 +14,14 @@
"sideEffects": false,
"repository": {
"type": "git",
"url": "http://github.com/grafana/grafana.git",
"url": "git+http://github.com/grafana/grafana.git",
"directory": "packages/grafana-alerting"
},
"main": "src/index.ts",
"types": "src/index.ts",
"module": "src/index.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./src/index.ts",
"require": "./src/index.ts"
@@ -39,12 +39,28 @@
"require": "./src/testing.ts"
}
},
"publishConfig": {
"main": "./dist/cjs/index.cjs",
"module": "./dist/esm/index.mjs",
"types": "./dist/types/index.d.ts",
"access": "public"
},
"files": [
"./dist",
"./README.md",
"./CHANGELOG.md",
"./LICENSE_APACHE2"
],
"scripts": {
"build": "tsc -p ./tsconfig.build.json && rollup -c rollup.config.ts --configPlugin esbuild",
"bundle": "rollup -c rollup.config.ts --configPlugin esbuild",
"clean": "rimraf ./dist ./compiled ./unstable ./package.tgz",
"typecheck": "tsc --emitDeclarationOnly false --noEmit",
"codegen": "rtk-query-codegen-openapi ./scripts/codegen.ts"
"codegen": "rtk-query-codegen-openapi ./scripts/codegen.ts",
"prepack": "cp package.json package.json.bak && ALIAS_PACKAGE_NAME=unstable node ../../scripts/prepare-npm-package.js",
"postpack": "mv package.json.bak package.json && rimraf ./unstable"
},
"devDependencies": {
"@faker-js/faker": "^9.7.0",
"@grafana/test-utils": "workspace:*",
"@grafana/tsconfig": "^2.0.0",
"@rtk-query/codegen-openapi": "^2.0.0",
@@ -57,17 +73,24 @@
"react": "18.3.1",
"react-dom": "18.3.1",
"react-redux": "^9.2.0",
"rimraf": "^6.0.1",
"rollup": "^4.22.4",
"rollup-plugin-esbuild": "6.2.0",
"rollup-plugin-node-externals": "^8.0.0",
"type-fest": "^4.40.0",
"typescript": "5.7.3"
},
"peerDependencies": {
"@grafana/runtime": "^12.0.0-pre",
"@grafana/ui": "^12.0.0-pre",
"@grafana/runtime": ">=11.6 <= 12.x",
"@grafana/ui": ">=11.6 <= 12.x",
"@reduxjs/toolkit": "^2.8.0",
"msw": "^2.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"dependencies": {
"@faker-js/faker": "^9.8.0",
"fishery": "^2.3.1",
"lodash": "^4.17.21"
}
}
@@ -0,0 +1,19 @@
import { createRequire } from 'node:module';
import { cjsOutput, entryPoint, esmOutput, plugins } from '../rollup.config.parts';
const rq = createRequire(import.meta.url);
const pkg = rq('./package.json');
export default [
{
input: entryPoint,
plugins,
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-alerting')],
},
{
input: 'src/unstable.ts',
plugins,
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-alerting')],
},
];
+3 -1
View File
@@ -6,4 +6,6 @@
*
* Breaking changes should be avoided to maintain backwards compatibility for consumers of this package.
*/
export default {};
// This is a dummy export so typescript doesn't error importing an "empty module"
export const index = {};
@@ -1,4 +1,4 @@
{
"exclude": ["dist", "node_modules", "test", "**/*.test.ts*"],
"exclude": ["dist", "node_modules", "tests", "**/*.test.ts*"],
"extends": "./tsconfig.json"
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"declarationDir": "./compiled",
"declarationDir": "./dist/types",
"emitDeclarationOnly": true,
"isolatedModules": true,
"rootDirs": ["."],
+31 -7
View File
@@ -2320,13 +2320,20 @@ __metadata:
languageName: node
linkType: hard
"@faker-js/faker@npm:^9.0.0, @faker-js/faker@npm:^9.7.0":
"@faker-js/faker@npm:^9.0.0":
version: 9.7.0
resolution: "@faker-js/faker@npm:9.7.0"
checksum: 10/5167cc179bbf5f140b957f600af24772ca8c6e7e42405c312c25a6b4278b851b84bd8e3065f80e667dd4c35dd5aeb0ed490b0b1872f908d58ffae1cef9a5ef72
languageName: node
linkType: hard
"@faker-js/faker@npm:^9.8.0":
version: 9.8.0
resolution: "@faker-js/faker@npm:9.8.0"
checksum: 10/d7d7940ba7f2bd0d266d507bb7a33ec5099654da624dc8647d7cfd2e908b75ba06ed7dd0ec3b771a18600a734f420370b3cecd1ee5d4799993b1ee3505f866d8
languageName: node
linkType: hard
"@fingerprintjs/fingerprintjs@npm:^3.4.2":
version: 3.4.2
resolution: "@fingerprintjs/fingerprintjs@npm:3.4.2"
@@ -2954,7 +2961,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@grafana/alerting@workspace:packages/grafana-alerting"
dependencies:
"@faker-js/faker": "npm:^9.7.0"
"@faker-js/faker": "npm:^9.8.0"
"@grafana/test-utils": "workspace:*"
"@grafana/tsconfig": "npm:^2.0.0"
"@rtk-query/codegen-openapi": "npm:^2.0.0"
@@ -2964,16 +2971,22 @@ __metadata:
"@types/lodash": "npm:^4"
"@types/react": "npm:18.3.18"
"@types/react-dom": "npm:18.3.5"
fishery: "npm:^2.3.1"
lodash: "npm:^4.17.21"
react: "npm:18.3.1"
react-dom: "npm:18.3.1"
react-redux: "npm:^9.2.0"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.22.4"
rollup-plugin-esbuild: "npm:6.2.0"
rollup-plugin-node-externals: "npm:^8.0.0"
type-fest: "npm:^4.40.0"
typescript: "npm:5.7.3"
peerDependencies:
"@grafana/runtime": ^12.0.0-pre
"@grafana/ui": ^12.0.0-pre
"@grafana/runtime": ">=11.6 <= 12.x"
"@grafana/ui": ">=11.6 <= 12.x"
"@reduxjs/toolkit": ^2.8.0
msw: ^2.0.0
react: ^18.0.0
react-dom: ^18.0.0
languageName: unknown
@@ -9268,7 +9281,18 @@ __metadata:
languageName: node
linkType: hard
"@types/express-serve-static-core@npm:*, @types/express-serve-static-core@npm:^4.17.21, @types/express-serve-static-core@npm:^4.17.33":
"@types/express-serve-static-core@npm:*, @types/express-serve-static-core@npm:^4.17.33":
version: 4.17.33
resolution: "@types/express-serve-static-core@npm:4.17.33"
dependencies:
"@types/node": "npm:*"
"@types/qs": "npm:*"
"@types/range-parser": "npm:*"
checksum: 10/47ee1b46be710ae6451a2e658e2eab75f4affe874b0d156a31e792db0ddb35184ac7b35be926eb23424cc45f6e0d3dbacc86ac5d63a3c988d8235aedb1143841
languageName: node
linkType: hard
"@types/express-serve-static-core@npm:^4.17.21":
version: 4.19.6
resolution: "@types/express-serve-static-core@npm:4.19.6"
dependencies:
@@ -17059,7 +17083,7 @@ __metadata:
languageName: node
linkType: hard
"fishery@npm:^2.2.2":
"fishery@npm:^2.2.2, fishery@npm:^2.3.1":
version: 2.3.1
resolution: "fishery@npm:2.3.1"
dependencies:
@@ -27733,7 +27757,7 @@ __metadata:
languageName: node
linkType: hard
"rimraf@npm:6.0.1":
"rimraf@npm:6.0.1, rimraf@npm:^6.0.1":
version: 6.0.1
resolution: "rimraf@npm:6.0.1"
dependencies: