Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build using @grafana/toolkit #75

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

138 changes: 111 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,115 @@
version: 2
jobs:
build:
build_plugin:
docker:
# specify the version you desire here
- image: circleci/node:8

working_directory: ~/repo

- image: circleci/node:10
working_directory: ~/plugin
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: yarn install
command: 'yarn install --pure-lockfile --no-progress'
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: test
command: 'yarn test'
- run:
name: build
command: 'yarn build'
- run:
name: zip dist
command: 'cd dist && zip -r9 ../grafana-plotly-panel-dev.zip *'
- store_artifacts:
path: grafana-plotly-panel-dev.zip
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install yarn
command: |
yarn install --pure-lockfile
- run:
name: Run Toolkit Build
command: npx grafana-toolkit plugin:ci-build
- save_cache:
paths:
- node_modules
key: yarn-packages-{{ checksum "yarn.lock" }}
- persist_to_workspace:
root: .
paths:
- ci
package:
docker:
- image: circleci/node:10
working_directory: ~/plugin
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Package Distribution
command: npx grafana-toolkit plugin:ci-package
- persist_to_workspace:
root: .
paths:
- ci/jobs/package
- ci/packages
- ci/dist
- ci/grafana-test-env
test_6_5_1:
docker:
- image: circleci/node:10-browsers
working_directory: ~/plugin
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Setup Grafana (local install)
command: |
wget https://dl.grafana.com/oss/release/grafana_6.5.1_amd64.deb
sudo apt-get install -y adduser libfontconfig1
sudo dpkg -i grafana_6.5.1_amd64.deb
sudo apt-get install locate
sudo updatedb
sudo locate grafana
sudo cat /etc/grafana/grafana.ini
sudo echo ------------------------
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini
sudo service grafana-server start
sudo grafana-cli --version
- run:
name: Run e2e tests
command: |
npx grafana-toolkit plugin:ci-test
- persist_to_workspace:
root: .
paths:
- ci/jobs/test_6_5_1
- store_test_results:
path: ci/jobs/test_6_5_1
- store_artifacts:
path: ci/jobs/test_6_5_1
report:
docker:
- image: circleci/node:10
working_directory: ~/plugin
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Toolkit Report
command: npx grafana-toolkit plugin:ci-report
- store_artifacts:
path: ci
workflows:
version: 2
plugin_workflow:
jobs:
- build_plugin
- package:
requires:
- build_plugin
- test_6_5_1:
requires:
- package
- report:
requires:
- test_6_5_1
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require("./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json"),
};
18 changes: 0 additions & 18 deletions .release-it.json

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ env GITHUB_TOKEN=your_token yarn release-it patch

#### Changelog


##### v0.0.7
- build with toolkit


##### v0.0.6

- Fix axis range configuration bug [#49](https://github.com/NatelEnergy/grafana-plotly-panel/issues/49)
Expand Down
21 changes: 0 additions & 21 deletions jest.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions mocks/sdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

export class MetricsPanelCtrl {
ctrl = {
panel: {
version: 1,
},
updateTimeRange: () => {}
}
};

export default {}
55 changes: 10 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
"version": "0.0.7-dev",
"description": "Plot.ly Panel Plugin for Grafana",
"scripts": {
"build": "webpack --config webpack.config.prod.js",
"dev": "webpack --mode development",
"watch": "webpack --mode development --watch",
"test": "jest --config jest.config.js",
"precommit": "pretty-quick --staged",
"lint": "tslint -c tslint.json --project tsconfig.json",
"format": "prettier-eslint --write \"src/**/*.{ts,tsx,json,css,js,jsx}\"",
"zip": "yarn build && rm -f ../grafana-plotly-panel.zip && zip -r ../grafana-plotly-panel.zip dist"
"build": "grafana-toolkit plugin:build",
"test": "grafana-toolkit plugin:test",
"dev": "grafana-toolkit plugin:dev"
},
"author": "ryantxu",
"license": "MIT",
Expand All @@ -25,16 +20,10 @@
"type": "git",
"url": "https://github.com/NatelEnergy/grafana-plotly-panel.git"
},
"lint-staged": {
"src/**/*.{ts,tsx,json,css,js,jsx}": [
"prettier-eslint"
]
},
"prettier": {
"trailingComma": "es5",
"singleQuote": true,
"bracketSpacing": false,
"printWidth": 100
"jest": {
"moduleNameMapper": {
"grafana/app/plugins/sdk": "<rootDir>/node_modules/grafana-sdk-mocks/app/plugins/sdk.ts"
}
},
"dependencies": {
"jquery": "^3.2.1",
Expand All @@ -44,32 +33,8 @@
"scriptjs": "^2.5.9"
},
"devDependencies": {
"@types/jest": "^24.0.0",
"@types/lodash": "^4.14.74",
"@types/plotly.js": "^1.38.0",
"@types/scriptjs": "^0.0.2",
"babel-core": "^6.26.3",
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"clean-webpack-plugin": "^1.0.1",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^2.1.0",
"grafana-sdk-mocks": "github:grafana/grafana-sdk-mocks",
"jest": "^24.1.0",
"ng-annotate-webpack-plugin": "^0.3.0",
"prettier": "^1.15.3",
"prettier-eslint": "^8.8.0",
"prettier-eslint-cli": "^4.7.0",
"pretty-quick": "^1.10.0",
"release-it": "^10",
"replace-in-file-webpack-plugin": "^1.0.6",
"style-loader": "^0.23.1",
"ts-jest": "^23",
"ts-loader": "^5.3.3",
"typescript": "^3",
"uglifyjs-webpack-plugin": "^2.1.1",
"webpack": "^4.9.1",
"webpack-cli": "^3.1"
"@grafana/toolkit": "next",
"@types/grafana": "github:CorpGlory/types-grafana.git",
"grafana-sdk-mocks": "github:grafana/grafana-sdk-mocks"
}
}
31 changes: 0 additions & 31 deletions specs/lib/template_srv_stub.ts

This file was deleted.

10 changes: 0 additions & 10 deletions specs/typing.d.ts

This file was deleted.

10 changes: 6 additions & 4 deletions specs/series.jest.ts → src/SeriesWrapper.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
///<reference path="../node_modules/@types/jest/index.d.ts" />

import {
SeriesWrapper,
SeriesWrapperSeries,
// SeriesWrapperTable,
} from '../src/SeriesWrapper';
} from './SeriesWrapper';

describe('Check Series Helper', () => {
// $scope, $injector, $window, private $rootScope, public uiSegmentSrv

// Skip those for now because they rely on real template expansion
describe('check Series Helper', () => {
const series = {
datapoints: [[1.23, 100], [2.24, 101], [3.45, 102]],
datapoints: [
[1.23, 100],
[2.24, 101],
[3.45, 102],
],
};
const helperValue: SeriesWrapper = new SeriesWrapperSeries('AAA', series, 'value');
const helperTime: SeriesWrapper = new SeriesWrapperSeries('AAA', series, 'time');
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/anno.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Shape, Data} from 'plotly.js';
import { Shape, Data } from 'plotly.js';

export class AnnoInfo {
trace: Data;
Expand Down Expand Up @@ -66,7 +66,7 @@ export class AnnoInfo {
});

// Overwrite it with new points
this.trace = {...this.trace, x, y, text};
this.trace = { ...this.trace, x, y, text };
this.trace.marker!.color = color;
return x.length > 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/editor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import {PlotlyPanelCtrl} from './module';
import { PlotlyPanelCtrl } from './module';

class AxisInfo {
label: string;
Expand Down
3 changes: 0 additions & 3 deletions src/lib/plotly-cartesian.min.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib/plotly.min.js

This file was deleted.

Loading