Skip to content

Commit

Permalink
Chore: Adding knip config (#227)
Browse files Browse the repository at this point in the history
* Adding knip

* adding prettier back and making things pretty

* add prettier format

* Revert yarn file

* Revert moment

* adding react-router-dom back

* adding ts-node back

* fixing linter
  • Loading branch information
tolzhabayev authored Dec 3, 2024
1 parent a2d6ad5 commit b4b989f
Show file tree
Hide file tree
Showing 18 changed files with 557 additions and 528 deletions.
15 changes: 7 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Basic set up for three package managers
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "monthly"
interval: 'monthly'

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "monthly"
open-pull-requests-limit: 5
interval: 'monthly'
open-pull-requests-limit: 5
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
close-pr-message: >
This pull request has been automatically closed because it has not had
activity in the last 2 weeks. Please feel free to give a status update now, ping for review, or re-open when it's ready.
Thank you for your contributions!
Thank you for your contributions!
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
// Prettier configuration provided by Grafana scaffolding
...require("./.config/.prettierrc.js")
};
...require('./.config/.prettierrc.js'),
};
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@
- Adds tests for migrations

## [2.1.2]

- Improving wrapping of the panel elements to be more responsive to different panel sizes https://github.com/grafana/clock-panel/pull/117
- Fixing a placeholder for the font size field https://github.com/grafana/clock-panel/pull/116
-
-

## [2.1.1]

- Migrate to create-plugin instead of toolkit
- Small typo fixes
- Bump grafana packages / dependencies

## [2.1.0]

- Added support to set timezone from template variable

## [2.0.0]

- Prevent clock panel from crashing Grafana 9.x.x
- Drop support for Grafana 7.x.x

Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Show the time in another office or show a countdown/countup to an important even
- **Countdown End Time**:

Used in conjunction with the mode being set to countdown. Choose a date and time to count down to.
This field also supports dashboard (constant) variables (e.g. ``${countdown_target}``) to dynamically set the countdown deadline for the Dashboard.

This field also supports dashboard (constant) variables (e.g. `${countdown_target}`) to dynamically set the countdown deadline for the Dashboard.

- **Countdown End Text**:

Expand All @@ -53,7 +53,7 @@ Show the time in another office or show a countdown/countup to an important even
Choose a background color for the clock with the color picker.

#### Refresh

- **Sync**:

The clock is paused and only updated when the dashboard refreshes - the clock will show the timestamp for the last refresh.
Expand All @@ -68,14 +68,13 @@ Show the time in another office or show a countdown/countup to an important even
Using Docker:

1. Clone the repository and `cd` to it
1. make sure you have [yarn]( https://yarnpkg.com/) installed
1. make sure you have [yarn](https://yarnpkg.com/) installed
1. install project dependencies: `yarn install --pure-lockfile`
1. Start the "watch" task: `yarn watch`
1. Run a local Grafana instance with the development version of the plugin: `docker run -p 3000:3000 -d --name grafana-plugin-dev --env GF_AUTH_ANONYMOUS_ORG_ROLE="Admin" --env GF_AUTH_ANONYMOUS_ENABLED="true" --env GF_AUTH_BASIC_ENABLED="false" --env GF_DEFAULT_APP_MODE="development" --volume $(pwd)/dist:/var/lib/grafana/plugins/clock-panel grafana/grafana`
2. Check the logs to see that Grafana has started up: `docker logs -f grafana-plugin-dev`
3. Open Grafana at http://localhost:3000/
4. Log in with username "admin" and password "admin"
5. Create new dashboard and add the plugin
1. Check the logs to see that Grafana has started up: `docker logs -f grafana-plugin-dev`
1. Open Grafana at http://localhost:3000/
1. Log in with username "admin" and password "admin"
1. Create new dashboard and add the plugin

To build a production build with minification: `yarn build`

36 changes: 14 additions & 22 deletions cspell.config.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
{
"ignorePaths": [
"node_modules/**",
"dist/**",
"src/external/**",
"provisioning/**",
"package.json"
],
"words": [
"gdev",
"grafana",
"datasource",
"datasources",
"rgba",
"countup",
"Themeable",
"Unthemed",
"testdata",
"testid"
],
"ignoreRegExpList": [
"@[\\w]+"
]
"ignorePaths": ["node_modules/**", "dist/**", "src/external/**", "provisioning/**", "package.json"],
"words": [
"gdev",
"grafana",
"datasource",
"datasources",
"rgba",
"countup",
"Themeable",
"Unthemed",
"testdata",
"testid"
],
"ignoreRegExpList": ["@[\\w]+"]
}
1 change: 0 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

services:
grafana:
container_name: 'grafana-clock-panel'
Expand Down
11 changes: 11 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["src/module.{js,ts,tsx}"],
"project": ["src/**/*", "tests/**/*", ".config/**/*"],
"eslint": {
"config": [".config/.eslintrc", "./.eslintrc"]
},
"webpack": {
"config": [".config/webpack/webpack.config.ts"]
}
}
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
"e2e": "playwright test",
"e2e:update": "yarn exec cypress install && yarn exec grafana-e2e run --update-screenshots",
"format": "prettier --write ./src",
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "yarn lint --fix",
"playwright:test": "npx playwright test",
Expand All @@ -28,48 +28,48 @@
"author": "Grafana Labs",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.25.2",
"@grafana/eslint-config": "^7.0.0",
"@grafana/eslint-config": "^8.0.0",
"@grafana/plugin-e2e": "^1.12.3",
"@grafana/tsconfig": "^2.0.0",
"@playwright/test": "^1.42.1",
"@stylistic/eslint-plugin-ts": "^2.11.0",
"@swc/core": "^1.9.0",
"@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.29",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.0",
"@types/lodash": "^4.17.6",
"@types/node": "^20.8.7",
"@types/react": "17.0.38",
"@types/react-dom": "17.0.11",
"@types/react-router-dom": "^5.2.0",
"@types/testing-library__jest-dom": "5.14.8",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"copy-webpack-plugin": "^12.0.2",
"cspell": "8.8.4",
"css-loader": "^6.7.3",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-jsdoc": "^46.8.0",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-webpack-plugin": "^4.0.1",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"glob": "^10.3.10",
"identity-obj-proxy": "3.0.0",
"imports-loader": "^5.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"lodash": "latest",
"moment": "2.29.4",
"prettier": "^3.3.3",
"prettier": "^3.4.1",
"replace-in-file-webpack-plugin": "^1.0.6",
"sass": "1.63.2",
"sass-loader": "13.3.1",
"semver": "^7.6.3",
"style-loader": "3.3.3",
"swc-loader": "^0.2.4",
"terser-webpack-plugin": "^5.3.10",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "5.5.4",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
Expand All @@ -81,13 +81,11 @@
"@emotion/css": "^11.11.2",
"@grafana/data": "^11.3.0",
"@grafana/runtime": "^11.3.0",
"@grafana/schema": "^11.3.0",
"@grafana/ui": "^11.3.0",
"moment-timezone": "0.5.38",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "5.3.3",
"tslib": "2.5.3"
"react-router-dom": "5.3.3"
},
"engines": {
"node": ">=20"
Expand Down
3 changes: 1 addition & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default defineConfig<PluginOptions>({
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['auth'],
}
},
],

});
2 changes: 1 addition & 1 deletion provisioning/dashboards/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ providers:
- name: Default
type: file
options:
path: /etc/grafana/provisioning/dashboards
path: /etc/grafana/provisioning/dashboards
2 changes: 1 addition & 1 deletion provisioning/datasources/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: 1

datasources:
- name: ClockTestData
type: testdata
type: testdata
2 changes: 1 addition & 1 deletion src/ClockPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function ClockPanel(props: Props) {
const { timezone: optionsTimezone, dateSettings, timezoneSettings } = options;
// notice the uppercase Z.
const { timeZone: dashboardTimezone } = props;
const timezoneToUse = optionsTimezone === 'dashboard' ? dashboardTimezone : optionsTimezone ?? '';
const timezoneToUse = optionsTimezone === 'dashboard' ? dashboardTimezone : (optionsTimezone ?? '');
const [now, setNow] = useState<Moment>(getMoment(timezoneToUse));

const className = useMemo(() => {
Expand Down
Loading

0 comments on commit b4b989f

Please sign in to comment.