Skip to content

Commit

Permalink
Merge pull request #153 from sasaki77/update-packages
Browse files Browse the repository at this point in the history
MAINT: Update package versions
  • Loading branch information
sasaki77 authored Aug 23, 2023
2 parents a14cca4 + 29f7d88 commit 59d6b91
Show file tree
Hide file tree
Showing 9 changed files with 2,276 additions and 1,812 deletions.
4 changes: 2 additions & 2 deletions .config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ A common issue found with the current jest config involves importing an npm pack

```javascript
process.env.TZ = 'UTC';
const { grafanaESModules, nodeModulesToTransform } = require('./jest/utils');
const { grafanaESModules, nodeModulesToTransform } = require('./config/jest/utils');

module.exports = {
// Jest configuration provided by Grafana
Expand Down Expand Up @@ -161,4 +161,4 @@ services:
In this example we are assigning the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will give you the possibility to set the value while running the docker-compose commands which might be convinent in some scenarios.

---
---
2 changes: 1 addition & 1 deletion .config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
sourceMaps: true,
sourceMaps: 'inline',
jsc: {
parser: {
syntax: 'typescript',
Expand Down
7 changes: 5 additions & 2 deletions .config/jest/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!(${moduleNames

// Array of known nested grafana package dependencies that only bundle an ESM version
const grafanaESModules = [
'.pnpm', // Support using pnpm symlinked packages
'@grafana/schema',
'd3',
'd3-color',
'd3-force',
'd3-interpolate',
'd3-scale-chromatic',
'ol',
'react-colorful',
'rxjs',
'uuid',
];

module.exports = {
nodeModulesToTransform,
grafanaESModules
}
grafanaESModules,
};
25 changes: 21 additions & 4 deletions .config/webpack/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import fs from 'fs';
import process from 'process';
import os from 'os';
import path from 'path';
import util from 'util';
import glob from 'glob';
import { glob } from 'glob';
import { SOURCE_DIR } from './constants';

const globAsync = util.promisify(glob);

export function isWSL() {
if (process.platform !== 'linux') {
return false;
}

if (os.release().toLowerCase().includes('microsoft')) {
return true;
}

try {
return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft');
} catch {
return false;
}
}

export function getPackageJson() {
return require(path.resolve(process.cwd(), 'package.json'));
Expand All @@ -21,11 +38,11 @@ export function hasReadme() {
// Support bundling nested plugins by finding all plugin.json files in src directory
// then checking for a sibling module.[jt]sx? file.
export async function getEntries(): Promise<Record<string, string>> {
const pluginsJson = await globAsync('**/src/**/plugin.json', { absolute: true });
const pluginsJson = await glob('**/src/**/plugin.json', { absolute: true });

const plugins = await Promise.all(pluginsJson.map((pluginJson) => {
const folder = path.dirname(pluginJson);
return globAsync(`${folder}/module.{ts,tsx,js,jsx}`, { absolute: true });
return glob(`${folder}/module.{ts,tsx,js,jsx}`, { absolute: true });
})
);

Expand Down
Loading

0 comments on commit 59d6b91

Please sign in to comment.