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

project: Release 0.3.3 #68

Merged
merged 3 commits into from
Jul 9, 2024
Merged
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
2 changes: 1 addition & 1 deletion .config/.cprc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "4.11.4"
"version": "4.16.1"
}
1 change: 1 addition & 0 deletions .config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ARG grafana_image=grafana-enterprise
FROM grafana/${grafana_image}:${grafana_version}

ARG development=false
ARG TARGETARCH


ENV DEV "${development}"
Expand Down
17 changes: 17 additions & 0 deletions .config/webpack/publicPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* This file dynamically sets the public path at runtime based on the location of the plugin's AMD module.
* It relies on the magic `module` which is defined by the AMD loader.
* https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#module
*
* We fallback to the plugin root so that older versions of Grafana will continue to load the plugin correctly.
*/

// @ts-nocheck
import amdMetaModule from 'amd-module';

__webpack_public_path__ =
amdMetaModule && amdMetaModule.uri
? amdMetaModule.uri.slice(0, amdMetaModule.uri.lastIndexOf('/') + 1)
: 'public/plugins/fetzerch-sunandmoon-datasource/';
5 changes: 5 additions & 0 deletions .config/webpack/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export function getPluginJson() {
return require(path.resolve(process.cwd(), `${SOURCE_DIR}/plugin.json`));
}

export function getCPConfigVersion() {
const cprcJson = path.resolve(__dirname, '../', '.cprc.json');
return fs.existsSync(cprcJson) ? require(cprcJson).version : { version: 'unknown' };
}

export function hasReadme() {
return fs.existsSync(path.resolve(process.cwd(), SOURCE_DIR, 'README.md'));
}
Expand Down
51 changes: 42 additions & 9 deletions .config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import path from 'path';
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
import { Configuration } from 'webpack';
import TerserPlugin from 'terser-webpack-plugin';
import { type Configuration, BannerPlugin } from 'webpack';

import { getPackageJson, getPluginJson, hasReadme, getEntries, isWSL } from './utils';
import { getPackageJson, getPluginJson, hasReadme, getEntries, isWSL, getCPConfigVersion } from './utils';
import { SOURCE_DIR, DIST_DIR } from './constants';

const pluginJson = getPluginJson();
const cpVersion = getCPConfigVersion();

const config = async (env): Promise<Configuration> => {
const baseConfig: Configuration = {
Expand All @@ -34,6 +36,8 @@ const config = async (env): Promise<Configuration> => {
entry: await getEntries(),

externals: [
// Required for dynamic publicPath resolution
{ 'amd-module': 'module' },
'lodash',
'jquery',
'moment',
Expand Down Expand Up @@ -71,6 +75,11 @@ const config = async (env): Promise<Configuration> => {
},
],

// Support WebAssembly according to latest spec - makes WebAssembly module async
experiments: {
asyncWebAssembly: true,
},

mode: env.production ? 'production' : 'development',

module: {
Expand All @@ -95,6 +104,17 @@ const config = async (env): Promise<Configuration> => {
},
},
},
{
test: /src\/(?:.*\/)?module\.tsx?$/,
use: [
{
loader: 'imports-loader',
options: {
imports: `side-effects ${path.join(__dirname, 'publicPath.ts')}`,
},
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
Expand All @@ -107,25 +127,32 @@ const config = async (env): Promise<Configuration> => {
test: /\.(png|jpe?g|gif|svg)$/,
type: 'asset/resource',
generator: {
// Keep publicPath relative for host.com/grafana/ deployments
publicPath: `public/plugins/${pluginJson.id}/img/`,
outputPath: 'img/',
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
},
},
{
test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
type: 'asset/resource',
generator: {
// Keep publicPath relative for host.com/grafana/ deployments
publicPath: `public/plugins/${pluginJson.id}/fonts/`,
outputPath: 'fonts/',
filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]',
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
},
},
],
},

optimization: {
minimize: Boolean(env.production),
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: (_, { type, value }) => type === 'comment2' && value.trim().startsWith('[create-plugin]'),
},
},
}),
],
},

output: {
clean: {
keep: new RegExp(`(.*?_(amd64|arm(64)?)(.exe)?|go_plugin_build_manifest)`),
Expand All @@ -140,6 +167,12 @@ const config = async (env): Promise<Configuration> => {
},

plugins: [
// Insert create plugin version information into the bundle
new BannerPlugin({
banner: '/* [create-plugin] version: ' + cpVersion + ' */',
raw: true,
entryOnly: true,
}),
new CopyWebpackPlugin({
patterns: [
// If src/README.md exists use it; otherwise the root README
Expand Down
6 changes: 6 additions & 0 deletions .cprc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"features": {
"bundleGrafanaUI": false,
"useReactRouterV6": false
}
}
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.3] - 2024-07-09

### Fixed

- Prepare for compatibility with Grafana 12.0.

## [0.3.2] - 2024-06-09

### Added
Expand Down Expand Up @@ -114,7 +120,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial version with sun and moon calculation and annotations.

[Unreleased]: https://github.com/fetzerch/grafana-sunandmoon-datasource/compare/v0.3.2...HEAD
[Unreleased]: https://github.com/fetzerch/grafana-sunandmoon-datasource/compare/v0.3.3...HEAD
[0.3.3]: https://github.com/fetzerch/grafana-sunandmoon-datasource/compare/v0.3.1...v0.3.3
[0.3.2]: https://github.com/fetzerch/grafana-sunandmoon-datasource/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/fetzerch/grafana-sunandmoon-datasource/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/fetzerch/grafana-sunandmoon-datasource/compare/v0.2.1...v0.3.0
Expand Down
Loading
Loading