Repository: grafana/github-datasource Branch: main Commit: fb79f5076332 Files: 248 Total size: 3.6 MB Directory structure: gitextract_10_7h8bn/ ├── .bra.toml ├── .changeset/ │ ├── README.md │ ├── changelog.js │ └── config.json ├── .config/ │ ├── .cprc.json │ ├── .prettierrc.js │ ├── Dockerfile │ ├── README.md │ ├── bundler/ │ │ └── externals.ts │ ├── docker-compose-base.yaml │ ├── entrypoint.sh │ ├── eslint.config.mjs │ ├── jest/ │ │ ├── mocks/ │ │ │ └── react-inlinesvg.tsx │ │ └── utils.js │ ├── jest-setup.js │ ├── jest.config.js │ ├── supervisord/ │ │ └── supervisord.conf │ ├── tsconfig.json │ ├── types/ │ │ ├── bundler-rules.d.ts │ │ ├── custom.d.ts │ │ ├── setupTests.d.ts │ │ └── webpack-plugins.d.ts │ └── webpack/ │ ├── BuildModeWebpackPlugin.ts │ ├── constants.ts │ ├── utils.ts │ └── webpack.config.ts ├── .cprc.json ├── .editorconfig ├── .github/ │ ├── CODEOWNERS │ └── workflows/ │ ├── add-to-project.yml │ ├── publish.yaml │ ├── push.yaml │ └── update-create-plugin.yml ├── .gitignore ├── .nvmrc ├── .prettierrc.js ├── .vscode/ │ └── launch.json ├── .yarn/ │ └── releases/ │ └── yarn-4.13.0.cjs ├── .yarnrc.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── Magefile.go ├── README.md ├── cspell.config.json ├── docker-compose.yaml ├── docs/ │ ├── Makefile │ ├── developer-guide.md │ ├── docs.mk │ ├── make-docs │ ├── sources/ │ │ ├── _index.md │ │ ├── annotations/ │ │ │ └── _index.md │ │ ├── query/ │ │ │ └── _index.md │ │ ├── sample-dashboards/ │ │ │ └── _index.md │ │ ├── setup/ │ │ │ ├── _index.md │ │ │ ├── datasource.md │ │ │ ├── installation.md │ │ │ ├── provisioning.md │ │ │ └── token.md │ │ ├── troubleshoot/ │ │ │ └── _index.md │ │ └── variables-and-macros/ │ │ ├── _index.md │ │ ├── macros.md │ │ └── variables.md │ └── variables.mk ├── eslint.config.mjs ├── go.mod ├── go.sum ├── jest-setup.js ├── jest.config.js ├── package.json ├── pkg/ │ ├── dfutil/ │ │ └── framer.go │ ├── errors/ │ │ ├── docs.go │ │ └── errors.go │ ├── github/ │ │ ├── client/ │ │ │ ├── client.go │ │ │ ├── errorsourcehandling.go │ │ │ └── errorsourcehandling_test.go │ │ ├── codescanning.go │ │ ├── codescanning_handler.go │ │ ├── codescanning_test.go │ │ ├── commit_files.go │ │ ├── commit_files_handler.go │ │ ├── commit_files_test.go │ │ ├── commits.go │ │ ├── commits_handler.go │ │ ├── commits_test.go │ │ ├── constants.go │ │ ├── contributors.go │ │ ├── contributors_handler.go │ │ ├── contributors_test.go │ │ ├── datasource.go │ │ ├── deployments.go │ │ ├── deployments_handler.go │ │ ├── deployments_test.go │ │ ├── docs.go │ │ ├── issues.go │ │ ├── issues_handler.go │ │ ├── issues_test.go │ │ ├── labels.go │ │ ├── labels_handler.go │ │ ├── labels_test.go │ │ ├── macros.go │ │ ├── macros_test.go │ │ ├── milestones.go │ │ ├── milestones_handler.go │ │ ├── milestones_test.go │ │ ├── organizations.go │ │ ├── organizations_handler.go │ │ ├── organizations_test.go │ │ ├── packages.go │ │ ├── packages_handler.go │ │ ├── packages_test.go │ │ ├── projects/ │ │ │ ├── project_items.go │ │ │ ├── project_items_filter.go │ │ │ ├── project_items_filter_test.go │ │ │ ├── project_items_models.go │ │ │ ├── project_items_test.go │ │ │ ├── projects.go │ │ │ ├── projects_test.go │ │ │ └── testdata/ │ │ │ ├── project.golden.jsonc │ │ │ └── projects.golden.jsonc │ │ ├── projects_handler.go │ │ ├── pull_request_reviews.go │ │ ├── pull_request_reviews_handler.go │ │ ├── pull_request_reviews_test.go │ │ ├── pull_requests.go │ │ ├── pull_requests_handler.go │ │ ├── pull_requests_test.go │ │ ├── query_handler.go │ │ ├── releases.go │ │ ├── releases_handler.go │ │ ├── releases_test.go │ │ ├── repositories.go │ │ ├── repositories_handler.go │ │ ├── repositories_test.go │ │ ├── resource_handlers.go │ │ ├── schema.go │ │ ├── sql.go │ │ ├── sql_handler_test.go │ │ ├── stargazers.go │ │ ├── stargazers_handler.go │ │ ├── stargazers_test.go │ │ ├── tags.go │ │ ├── tags_handler.go │ │ ├── tags_test.go │ │ ├── testdata/ │ │ │ ├── commit_files.golden.jsonc │ │ │ ├── commits.golden.jsonc │ │ │ ├── commits_with_files.golden.jsonc │ │ │ ├── contributors.golden.jsonc │ │ │ ├── issues.golden.jsonc │ │ │ ├── milestones.golden.jsonc │ │ │ ├── pull_request_reviews.golden.jsonc │ │ │ ├── pull_requests.golden.jsonc │ │ │ ├── releases.golden.jsonc │ │ │ ├── repositories.golden.jsonc │ │ │ ├── stargazers.golden.jsonc │ │ │ ├── tags.golden.jsonc │ │ │ ├── workflowRuns.golden.jsonc │ │ │ ├── workflowUsage.golden.jsonc │ │ │ └── workflows.golden.jsonc │ │ ├── vulnerabilites_handler.go │ │ ├── vulnerabilities.go │ │ ├── workflows.go │ │ ├── workflows_handler.go │ │ └── workflows_test.go │ ├── httputil/ │ │ └── errors.go │ ├── main.go │ ├── models/ │ │ ├── client.go │ │ ├── codescanning.go │ │ ├── commit_files.go │ │ ├── commits.go │ │ ├── contributors.go │ │ ├── deployments.go │ │ ├── docs.go │ │ ├── issues.go │ │ ├── labels.go │ │ ├── milestones.go │ │ ├── packages.go │ │ ├── packages_test.go │ │ ├── pagination.go │ │ ├── projects.go │ │ ├── pull_requests.go │ │ ├── query.go │ │ ├── releases.go │ │ ├── repositories.go │ │ ├── settings.go │ │ ├── settings_test.go │ │ ├── stargazers.go │ │ ├── tags.go │ │ ├── vulnerabilities.go │ │ └── workflows.go │ ├── plugin/ │ │ ├── datasource.go │ │ ├── datasource_caching.go │ │ ├── datasource_caching_test.go │ │ └── instance.go │ └── testutil/ │ ├── client.go │ ├── frames.go │ ├── maputils.go │ └── typeutils.go ├── playwright.config.ts ├── renovate.json ├── scripts/ │ ├── debug-backend.sh │ ├── e2e.sh │ ├── restart-plugin.sh │ └── test.sh ├── src/ │ ├── DataSource.test.ts │ ├── DataSource.ts │ ├── components/ │ │ ├── FieldSelect.tsx │ │ ├── Filters.tsx │ │ └── selectors.ts │ ├── constants.ts │ ├── dashboards/ │ │ └── dashboard.json │ ├── migrations.ts │ ├── module.ts │ ├── plugin.json │ ├── tracking.ts │ ├── types/ │ │ ├── config.ts │ │ └── query.ts │ ├── validation.ts │ ├── variables.test.ts │ ├── variables.ts │ └── views/ │ ├── ConfigEditor.spec.tsx │ ├── ConfigEditor.tsx │ ├── QueryEditor.tsx │ ├── QueryEditorCodeScanning.tsx │ ├── QueryEditorCommitFiles.tsx │ ├── QueryEditorCommits.tsx │ ├── QueryEditorContributors.tsx │ ├── QueryEditorDeployments.tsx │ ├── QueryEditorIssues.test.tsx │ ├── QueryEditorIssues.tsx │ ├── QueryEditorLabels.tsx │ ├── QueryEditorMilestones.tsx │ ├── QueryEditorPackages.test.tsx │ ├── QueryEditorPackages.tsx │ ├── QueryEditorProjects.tsx │ ├── QueryEditorPullRequestFiles.tsx │ ├── QueryEditorPullRequestReviews.tsx │ ├── QueryEditorPullRequests.tsx │ ├── QueryEditorRepository.test.tsx │ ├── QueryEditorRepository.tsx │ ├── QueryEditorWorkflowRuns.tsx │ ├── QueryEditorWorkflowUsage.tsx │ ├── QueryEditorWorkflows.tsx │ └── VariableQueryEditor.tsx ├── tests/ │ ├── ConfigEditor.spec.ts │ ├── QueryEditor.spec.ts │ └── mocks/ │ └── github-response.ts └── tsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .bra.toml ================================================ # default configuration created by the `mage watch` command. # this file can be edited and should be checked into source control. # see https://github.com/unknwon/bra/blob/master/templates/default.bra.toml for more configuration options. [run] init_cmds = [ ["mage", "-v", "build:debug"], ["mage", "-v" , "reloadPlugin"] ] watch_all = true follow_symlinks = false ignore = [".git", "node_modules", "dist"] ignore_files = ["mage_output_file.go"] watch_dirs = [ "pkg", "src", ] watch_exts = [".go", ".json"] build_delay = 2000 cmds = [ ["mage", "-v", "build:debug"], ["mage", "-v" , "reloadPlugin"] ] ================================================ FILE: .changeset/README.md ================================================ # Changesets Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets) We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) ================================================ FILE: .changeset/changelog.js ================================================ const changelogFunctions = { getReleaseLine: async (changeset, type, options) => { let prefix = '🎉'; if (type === 'major') { prefix = '🎉'; } else if (type === 'minor') { prefix = '🚀'; } else if (type === 'patch') { prefix = '🐛'; } if (changeset && changeset.summary) { const summary = changeset.summary || ''; if (summary.indexOf('Docs') > -1) { prefix = '📝'; } if ( summary.indexOf('Chore') > -1 || summary.indexOf('grafana-plugin-sdk-go') > -1 || summary.indexOf('compiled') > -1 ) { prefix = '⚙️'; } return [prefix, summary].join(' '); } return [prefix, changeset?.summary].join(' '); }, getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => { return '\n'; }, }; module.exports = changelogFunctions; ================================================ FILE: .changeset/config.json ================================================ { "$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json", "changelog": "./changelog.js", "commit": false, "fixed": [], "linked": [], "access": "restricted", "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [] } ================================================ FILE: .config/.cprc.json ================================================ { "version": "7.0.0", "features": {} } ================================================ FILE: .config/.prettierrc.js ================================================ /* * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in .config/README.md */ module.exports = { endOfLine: 'auto', printWidth: 120, trailingComma: 'es5', semi: true, jsxSingleQuote: false, singleQuote: true, useTabs: false, tabWidth: 2, }; ================================================ FILE: .config/Dockerfile ================================================ ARG grafana_version=latest@sha256:8b6530902b3609dac9f82cabbe5a9778e2ca6eda817c4572d5d5c202102fe76d ARG grafana_image=grafana-enterprise FROM grafana/${grafana_image}:${grafana_version} ARG anonymous_auth_enabled=true ARG development=false ARG TARGETARCH ARG GO_VERSION=1.21.6 ARG GO_ARCH=${TARGETARCH:-amd64} ENV DEV "${development}" # Make it as simple as possible to access the grafana instance for development purposes # Do NOT enable these settings in a public facing / production grafana instance ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" ENV GF_AUTH_ANONYMOUS_ENABLED "${anonymous_auth_enabled}" ENV GF_AUTH_BASIC_ENABLED "false" # Set development mode so plugins can be loaded without the need to sign ENV GF_DEFAULT_APP_MODE "development" LABEL maintainer="Grafana Labs " ENV GF_PATHS_HOME="/usr/share/grafana" WORKDIR $GF_PATHS_HOME USER root # Installing supervisor and inotify-tools RUN if [ "${development}" = "true" ]; then \ if grep -i -q alpine /etc/issue; then \ apk add supervisor inotify-tools git; \ elif grep -i -q ubuntu /etc/issue; then \ DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ apt-get install -y supervisor inotify-tools git && \ rm -rf /var/lib/apt/lists/*; \ else \ echo 'ERROR: Unsupported base image' && /bin/false; \ fi \ fi COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Installing Go RUN if [ "${development}" = "true" ]; then \ curl -O -L https://golang.org/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \ rm -rf /usr/local/go && \ tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \ echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bashrc && \ rm -f go${GO_VERSION}.linux-${GO_ARCH}.tar.gz; \ fi # Installing delve for debugging RUN if [ "${development}" = "true" ]; then \ /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest; \ fi # Installing mage for plugin (re)building RUN if [ "${development}" = "true" ]; then \ git clone https://github.com/magefile/mage; \ cd mage; \ export PATH=$PATH:/usr/local/go/bin; \ go run bootstrap.go; \ fi # Inject livereload script into grafana index.html RUN sed -i 's|||g' /usr/share/grafana/public/views/index.html COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] ================================================ FILE: .config/README.md ================================================ # Default build configuration by Grafana **This is an auto-generated directory and is not intended to be changed! ⚠️** The `.config/` directory holds basic configuration for the different tools that are used to develop, test and build the project. In order to make it updates easier we ask you to not edit files in this folder to extend configuration. ## How to extend the basic configs? Bear in mind that you are doing it at your own risk, and that extending any of the basic configuration can lead to issues around working with the project. ### Extending the ESLint config Edit the `.eslintrc` file in the project root in order to extend the ESLint configuration. **Example:** ```json { "extends": "./.config/.eslintrc", "rules": { "react/prop-types": "off" } } ``` --- ### Extending the Prettier config Edit the `.prettierrc.js` file in the project root in order to extend the Prettier configuration. **Example:** ```javascript module.exports = { // Prettier configuration provided by Grafana scaffolding ...require('./.config/.prettierrc.js'), semi: false, }; ``` --- ### Extending the Jest config There are two configuration in the project root that belong to Jest: `jest-setup.js` and `jest.config.js`. **`jest-setup.js`:** A file that is run before each test file in the suite is executed. We are using it to set up the Jest DOM for the testing library and to apply some polyfills. ([link to Jest docs](https://jestjs.io/docs/configuration#setupfilesafterenv-array)) **`jest.config.js`:** The main Jest configuration file that extends the Grafana recommended setup. ([link to Jest docs](https://jestjs.io/docs/configuration)) #### ESM errors with Jest A common issue with the current jest config involves importing an npm package that only offers an ESM build. These packages cause jest to error with `SyntaxError: Cannot use import statement outside a module`. To work around this, we provide a list of known packages to pass to the `[transformIgnorePatterns](https://jestjs.io/docs/configuration#transformignorepatterns-arraystring)` jest configuration property. If need be, this can be extended in the following way: ```javascript process.env.TZ = 'UTC'; const { grafanaESModules, nodeModulesToTransform } = require('./config/jest/utils'); module.exports = { // Jest configuration provided by Grafana ...require('./.config/jest.config'), // Inform jest to only transform specific node_module packages. transformIgnorePatterns: [nodeModulesToTransform([...grafanaESModules, 'packageName'])], }; ``` --- ### Extending the TypeScript config Edit the `tsconfig.json` file in the project root in order to extend the TypeScript configuration. **Example:** ```json { "extends": "./.config/tsconfig.json", "compilerOptions": { "preserveConstEnums": true } } ``` --- ### Extending the Webpack config Follow these steps to extend the basic Webpack configuration that lives under `.config/`: #### 1. Create a new Webpack configuration file Create a new config file that is going to extend the basic one provided by Grafana. It can live in the project root, e.g. `webpack.config.ts`. #### 2. Merge the basic config provided by Grafana and your custom setup We are going to use [`webpack-merge`](https://github.com/survivejs/webpack-merge) for this. ```typescript // webpack.config.ts import type { Configuration } from 'webpack'; import { merge } from 'webpack-merge'; import grafanaConfig, { type Env } from './.config/webpack/webpack.config'; const config = async (env: Env): Promise => { const baseConfig = await grafanaConfig(env); return merge(baseConfig, { // Add custom config here... output: { asyncChunks: true, }, }); }; export default config; ``` #### 3. Update the `package.json` to use the new Webpack config We need to update the `scripts` in the `package.json` to use the extended Webpack configuration. **Update for `build`:** ```diff -"build": "webpack -c ./.config/webpack/webpack.config.ts --env production", +"build": "webpack -c ./webpack.config.ts --env production", ``` **Update for `dev`:** ```diff -"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development", +"dev": "webpack -w -c ./webpack.config.ts --env development", ``` ### Configure grafana image to use when running docker By default, `grafana-enterprise` will be used as the docker image for all docker related commands. If you want to override this behavior, simply alter the `docker-compose.yaml` by adding the following build arg `grafana_image`. **Example:** ```yaml version: '3.7' services: grafana: extends: file: .config/docker-compose-base.yaml service: grafana build: args: grafana_version: ${GRAFANA_VERSION:-9.1.2} grafana_image: ${GRAFANA_IMAGE:-grafana} ``` In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker compose commands, which might be convenient in some scenarios. --- ================================================ FILE: .config/bundler/externals.ts ================================================ import type { Configuration, ExternalItemFunctionData } from 'webpack'; type ExternalsType = Configuration['externals']; export const externals: ExternalsType = [ // Required for dynamic publicPath resolution { 'amd-module': 'module' }, 'lodash', 'jquery', 'moment', 'slate', 'emotion', '@emotion/react', '@emotion/css', 'prismjs', 'slate-plain-serializer', '@grafana/slate-react', 'react', 'react-dom', 'react-redux', 'redux', 'rxjs', 'i18next', 'react-router', 'd3', 'angular', /^@grafana\/ui/i, /^@grafana\/runtime/i, /^@grafana\/data/i, // Mark legacy SDK imports as external if their name starts with the "grafana/" prefix ({ request }: ExternalItemFunctionData, callback: (error?: Error, result?: string) => void) => { const prefix = 'grafana/'; const hasPrefix = (request: string) => request.indexOf(prefix) === 0; const stripPrefix = (request: string) => request.slice(prefix.length); if (request && hasPrefix(request)) { return callback(undefined, stripPrefix(request)); } callback(); }, ]; ================================================ FILE: .config/docker-compose-base.yaml ================================================ services: grafana: user: root container_name: 'grafana-github-datasource' build: context: . args: grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise} grafana_version: ${GRAFANA_VERSION:-12.2.0} development: ${DEVELOPMENT:-false} anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true} ports: - 3000:3000/tcp - 2345:2345/tcp # delve security_opt: - 'apparmor:unconfined' - 'seccomp:unconfined' cap_add: - SYS_PTRACE volumes: - ../dist:/var/lib/grafana/plugins/grafana-github-datasource - ../provisioning:/etc/grafana/provisioning - ..:/root/grafana-github-datasource environment: NODE_ENV: development GF_LOG_FILTERS: plugin.grafana-github-datasource:debug GF_LOG_LEVEL: debug GF_DATAPROXY_LOGGING: 1 GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-github-datasource ================================================ FILE: .config/entrypoint.sh ================================================ #!/bin/sh if [ "${DEV}" = "false" ]; then echo "Starting test mode" exec /run.sh fi echo "Starting development mode" if grep -i -q alpine /etc/issue; then exec /usr/bin/supervisord -c /etc/supervisord.conf elif grep -i -q ubuntu /etc/issue; then exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf else echo 'ERROR: Unsupported base image' exit 1 fi ================================================ FILE: .config/eslint.config.mjs ================================================ import { defineConfig } from 'eslint/config'; import grafanaConfig from '@grafana/eslint-config/flat.js'; export default defineConfig([ ...grafanaConfig, { rules: { 'react/prop-types': 'off', }, }, { files: ['src/**/*.{ts,tsx}'], languageOptions: { parserOptions: { project: './tsconfig.json', }, }, rules: { '@typescript-eslint/no-deprecated': 'warn', }, }, { files: ['./tests/**/*'], rules: { 'react-hooks/rules-of-hooks': 'off', }, }, ]); ================================================ FILE: .config/jest/mocks/react-inlinesvg.tsx ================================================ // Due to the grafana/ui Icon component making fetch requests to // `/public/img/icon/.svg` we need to mock react-inlinesvg to prevent // the failed fetch requests from displaying errors in console. import React from 'react'; type Callback = (...args: any[]) => void; export interface StorageItem { content: string; queue: Callback[]; status: string; } export const cacheStore: { [key: string]: StorageItem } = Object.create(null); const SVG_FILE_NAME_REGEX = /(.+)\/(.+)\.svg$/; const InlineSVG = ({ src }: { src: string }) => { // testId will be the file name without extension (e.g. `public/img/icons/angle-double-down.svg` -> `angle-double-down`) const testId = src.replace(SVG_FILE_NAME_REGEX, '$2'); return ; }; export default InlineSVG; ================================================ FILE: .config/jest/utils.js ================================================ /* * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in .config/README.md */ /* * This utility function is useful in combination with jest `transformIgnorePatterns` config * to transform specific packages (e.g.ES modules) in a projects node_modules folder. */ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNames.join('|')})\/.*)`; // Array of known nested grafana package dependencies that only bundle an ESM version const grafanaESModules = [ '.pnpm', // Support using pnpm symlinked packages '@grafana/schema', '@wojtekmaj/date-utils', 'd3', 'd3-color', 'd3-force', 'd3-interpolate', 'd3-scale-chromatic', 'get-user-locale', 'marked', 'memoize', 'mimic-function', 'ol', 'react-calendar', 'react-colorful', 'rxjs', 'uuid', ]; module.exports = { nodeModulesToTransform, grafanaESModules, }; ================================================ FILE: .config/jest-setup.js ================================================ /* * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config */ import '@testing-library/jest-dom'; import { TextEncoder, TextDecoder } from 'util'; Object.assign(global, { TextDecoder, TextEncoder }); // https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom Object.defineProperty(global, 'matchMedia', { writable: true, value: (query) => ({ matches: false, media: query, onchange: null, addListener: jest.fn(), // deprecated removeListener: jest.fn(), // deprecated addEventListener: jest.fn(), removeEventListener: jest.fn(), dispatchEvent: jest.fn(), }), }); HTMLCanvasElement.prototype.getContext = () => {}; ================================================ FILE: .config/jest.config.js ================================================ /* * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config */ const path = require('path'); const { grafanaESModules, nodeModulesToTransform } = require('./jest/utils'); module.exports = { moduleNameMapper: { '\\.(css|scss|sass)$': 'identity-obj-proxy', 'react-inlinesvg': path.resolve(__dirname, 'jest', 'mocks', 'react-inlinesvg.tsx'), }, modulePaths: ['/src'], setupFilesAfterEnv: ['/jest-setup.js'], testEnvironment: 'jest-environment-jsdom', testMatch: [ '/src/**/__tests__/**/*.{js,jsx,ts,tsx}', '/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}', '/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}', ], transform: { '^.+\\.(t|j)sx?$': [ '@swc/jest', { sourceMaps: 'inline', jsc: { parser: { syntax: 'typescript', tsx: true, decorators: false, dynamicImport: true, }, }, }, ], }, // Jest will throw `Cannot use import statement outside module` if it tries to load an // ES module without it being transformed first. ./config/README.md#esm-errors-with-jest transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)], watchPathIgnorePatterns: ['/node_modules', '/dist'], }; ================================================ FILE: .config/supervisord/supervisord.conf ================================================ [supervisord] nodaemon=true user=root [program:grafana] user=root directory=/var/lib/grafana command=bash -c 'while [ ! -f /root/grafana-github-datasource/dist/gpx_github* ]; do sleep 1; done; /run.sh' stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 redirect_stderr=true killasgroup=true stopasgroup=true autostart=true [program:delve] user=root command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep -f gpx_github); done; /root/go/bin/dlv attach --api-version=2 --headless --continue --accept-multiclient --listen=:2345 $pid' stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 redirect_stderr=true killasgroup=false stopasgroup=false autostart=true autorestart=true [program:build-watcher] user=root command=/bin/bash -c 'while inotifywait -e modify,create,delete -r /var/lib/grafana/plugins/grafana-github-datasource; do echo "Change detected, restarting delve...";supervisorctl restart delve; done' stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 redirect_stderr=true killasgroup=true stopasgroup=true autostart=true [program:mage-watcher] user=root environment=PATH="/usr/local/go/bin:/root/go/bin:%(ENV_PATH)s" directory=/root/grafana-github-datasource command=/bin/bash -c 'git config --global --add safe.directory /root/grafana-github-datasource && mage -v watch' stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 redirect_stderr=true killasgroup=true stopasgroup=true autostart=true ================================================ FILE: .config/tsconfig.json ================================================ /* * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in * https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-typescript-config */ { "compilerOptions": { "alwaysStrict": true, "declaration": false, "rootDir": "../src", "baseUrl": "../src", "typeRoots": ["../node_modules/@types"], "resolveJsonModule": true }, "ts-node": { "compilerOptions": { "module": "commonjs", "target": "es5", "esModuleInterop": true }, "transpileOnly": true }, "include": ["../src", "./types"], "extends": "@grafana/tsconfig" } ================================================ FILE: .config/types/bundler-rules.d.ts ================================================ // Image declarations declare module '*.gif' { const src: string; export default src; } declare module '*.jpg' { const src: string; export default src; } declare module '*.jpeg' { const src: string; export default src; } declare module '*.png' { const src: string; export default src; } declare module '*.webp' { const src: string; export default src; } declare module '*.svg' { const src: string; export default src; } // Font declarations declare module '*.woff'; declare module '*.woff2'; declare module '*.eot'; declare module '*.ttf'; declare module '*.otf'; ================================================ FILE: .config/types/custom.d.ts ================================================ // Image declarations declare module '*.gif' { const src: string; export default src; } declare module '*.jpg' { const src: string; export default src; } declare module '*.jpeg' { const src: string; export default src; } declare module '*.png' { const src: string; export default src; } declare module '*.webp' { const src: string; export default src; } declare module '*.svg' { const content: string; export default content; } // Font declarations declare module '*.woff'; declare module '*.woff2'; declare module '*.eot'; declare module '*.ttf'; declare module '*.otf'; ================================================ FILE: .config/types/setupTests.d.ts ================================================ import '@testing-library/jest-dom'; ================================================ FILE: .config/types/webpack-plugins.d.ts ================================================ declare module 'replace-in-file-webpack-plugin' { import { Compiler, Plugin } from 'webpack'; interface ReplaceRule { search: string | RegExp; replace: string | ((match: string) => string); } interface ReplaceOption { dir?: string; files?: string[]; test?: RegExp | RegExp[]; rules: ReplaceRule[]; } class ReplaceInFilePlugin extends Plugin { constructor(options?: ReplaceOption[]); options: ReplaceOption[]; apply(compiler: Compiler): void; } export = ReplaceInFilePlugin; } declare module 'webpack-livereload-plugin' { import { ServerOptions } from 'https'; import { Compiler, Plugin, Stats, Compilation } from 'webpack'; interface Options extends Pick { /** * protocol for livereload `