@grafana/create-plugin 6.2.0-canary.2233.19368311379.0 → 6.2.0-canary.2233.19424871609.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,8 @@
1
- import { resolveScriptPath } from '../utils.js';
2
-
3
1
  var defaultAdditions = [
4
2
  {
5
3
  name: "example-addition",
6
4
  description: "Example addition demonstrating Valibot schema with type inference",
7
- scriptPath: resolveScriptPath(import.meta.url, "./scripts/example-addition.js")
5
+ scriptPath: import.meta.resolve("./scripts/example-addition.js")
8
6
  }
9
7
  ];
10
8
 
@@ -1,36 +1,35 @@
1
1
  import { LEGACY_UPDATE_CUTOFF_VERSION } from '../../constants.js';
2
- import { resolveScriptPath } from '../utils.js';
3
2
 
4
3
  var defaultMigrations = [
5
4
  {
6
5
  name: "001-update-grafana-compose-extend",
7
6
  version: LEGACY_UPDATE_CUTOFF_VERSION,
8
7
  description: "Update ./docker-compose.yaml to extend from ./.config/docker-compose-base.yaml.",
9
- scriptPath: resolveScriptPath(import.meta.url, "./scripts/001-update-grafana-compose-extend.js")
8
+ scriptPath: import.meta.resolve("./scripts/001-update-grafana-compose-extend.js")
10
9
  },
11
10
  {
12
11
  name: "002-update-is-compatible-workflow",
13
12
  version: LEGACY_UPDATE_CUTOFF_VERSION,
14
13
  description: "Update ./.github/workflows/is-compatible.yml to use is-compatible github action instead of calling levitate directly",
15
- scriptPath: resolveScriptPath(import.meta.url, "./scripts/002-update-is-compatible-workflow.js")
14
+ scriptPath: import.meta.resolve("./scripts/002-update-is-compatible-workflow.js")
16
15
  },
17
16
  {
18
17
  name: "003-update-eslint-deprecation-rule",
19
18
  version: LEGACY_UPDATE_CUTOFF_VERSION,
20
19
  description: "Replace deprecated eslint-plugin-deprecation with @typescript-eslint/no-deprecated rule.",
21
- scriptPath: resolveScriptPath(import.meta.url, "./scripts/003-update-eslint-deprecation-rule.js")
20
+ scriptPath: import.meta.resolve("./scripts/003-update-eslint-deprecation-rule.js")
22
21
  },
23
22
  {
24
23
  name: "004-eslint9-flat-config",
25
24
  version: LEGACY_UPDATE_CUTOFF_VERSION,
26
25
  description: "Migrate eslint config to flat config format and update devDependencies to latest versions.",
27
- scriptPath: resolveScriptPath(import.meta.url, "./scripts/004-eslint9-flat-config.js")
26
+ scriptPath: import.meta.resolve("./scripts/004-eslint9-flat-config.js")
28
27
  },
29
28
  {
30
29
  name: "005-react-18-3",
31
30
  version: "6.1.9",
32
31
  description: "Update React and ReactDOM 18.x versions to ^18.3.0 to surface React 19 compatibility issues.",
33
- scriptPath: resolveScriptPath(import.meta.url, "./scripts/005-react-18-3.js")
32
+ scriptPath: import.meta.resolve("./scripts/005-react-18-3.js")
34
33
  }
35
34
  // Do not use LEGACY_UPDATE_CUTOFF_VERSION for new migrations. It is only used above to force migrations to run
36
35
  // for those written before the switch to updates as migrations.
@@ -1,4 +1,4 @@
1
- import { dirname, resolve, join } from 'node:path';
1
+ import { join, dirname } from 'node:path';
2
2
  import { createRequire } from 'node:module';
3
3
  import { mkdirSync, writeFileSync, rmSync } from 'node:fs';
4
4
  import chalk from 'chalk';
@@ -6,7 +6,6 @@ import { output } from '../utils/utils.console.js';
6
6
  import { getPackageManagerWithFallback, getPackageManagerSilentInstallCmd } from '../utils/utils.packageManager.js';
7
7
  import { execSync } from 'node:child_process';
8
8
  import { gte, gt, clean, coerce } from 'semver';
9
- import { fileURLToPath } from 'node:url';
10
9
 
11
10
  function printChanges(context, key, description) {
12
11
  const changes = context.listChanges();
@@ -204,10 +203,5 @@ function cleanSemver(version) {
204
203
  function sortObjectByKeys(obj) {
205
204
  return Object.keys(obj).sort().reduce((acc, key) => ({ ...acc, [key]: obj[key] }), {});
206
205
  }
207
- function resolveScriptPath(callerUrl, relativePath) {
208
- const __filename = fileURLToPath(callerUrl);
209
- const __dirname = dirname(__filename);
210
- return resolve(__dirname, relativePath);
211
- }
212
206
 
213
- export { addDependenciesToPackageJson, flushChanges, formatFiles, installNPMDependencies, isVersionGreater, printChanges, readJsonFile, removeDependenciesFromPackageJson, resolveScriptPath };
207
+ export { addDependenciesToPackageJson, flushChanges, formatFiles, installNPMDependencies, isVersionGreater, printChanges, readJsonFile, removeDependenciesFromPackageJson };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "6.2.0-canary.2233.19368311379.0",
3
+ "version": "6.2.0-canary.2233.19424871609.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=20"
62
62
  },
63
- "gitHead": "265f74e1e4a843bdeaad5300a13b94391ffd5fff"
63
+ "gitHead": "0b0b05e102a885fb4fb16588c6cfbd0f0b69392f"
64
64
  }
@@ -1,10 +1,9 @@
1
1
  import { Codemod } from '../types.js';
2
- import { resolveScriptPath } from '../utils.js';
3
2
 
4
3
  export default [
5
4
  {
6
5
  name: 'example-addition',
7
6
  description: 'Example addition demonstrating Valibot schema with type inference',
8
- scriptPath: resolveScriptPath(import.meta.url, './scripts/example-addition.js'),
7
+ scriptPath: import.meta.resolve('./scripts/example-addition.js'),
9
8
  },
10
9
  ] satisfies Codemod[];
@@ -1,4 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
+ import { fileURLToPath } from 'node:url';
2
3
  import defaultMigrations from './migrations.js';
3
4
 
4
5
  describe('migrations json', () => {
@@ -7,8 +8,9 @@ describe('migrations json', () => {
7
8
  // This test now only asserts that the migration script source file exists.
8
9
  defaultMigrations.forEach((migration) => {
9
10
  it(`should have a valid migration script path for ${migration.name}`, () => {
10
- // ensure migration script exists
11
- const sourceFilePath = migration.scriptPath.replace('.js', '.ts');
11
+ // import.meta.resolve() returns a file:// URL, convert to path
12
+ const filePath = fileURLToPath(migration.scriptPath);
13
+ const sourceFilePath = filePath.replace('.js', '.ts');
12
14
  expect(existsSync(sourceFilePath)).toBe(true);
13
15
  });
14
16
  });
@@ -1,6 +1,5 @@
1
1
  import { LEGACY_UPDATE_CUTOFF_VERSION } from '../../constants.js';
2
2
  import { Codemod } from '../types.js';
3
- import { resolveScriptPath } from '../utils.js';
4
3
 
5
4
  export interface Migration extends Codemod {
6
5
  version: string;
@@ -11,32 +10,32 @@ export default [
11
10
  name: '001-update-grafana-compose-extend',
12
11
  version: LEGACY_UPDATE_CUTOFF_VERSION,
13
12
  description: 'Update ./docker-compose.yaml to extend from ./.config/docker-compose-base.yaml.',
14
- scriptPath: resolveScriptPath(import.meta.url, './scripts/001-update-grafana-compose-extend.js'),
13
+ scriptPath: import.meta.resolve('./scripts/001-update-grafana-compose-extend.js'),
15
14
  },
16
15
  {
17
16
  name: '002-update-is-compatible-workflow',
18
17
  version: LEGACY_UPDATE_CUTOFF_VERSION,
19
18
  description:
20
19
  'Update ./.github/workflows/is-compatible.yml to use is-compatible github action instead of calling levitate directly',
21
- scriptPath: resolveScriptPath(import.meta.url, './scripts/002-update-is-compatible-workflow.js'),
20
+ scriptPath: import.meta.resolve('./scripts/002-update-is-compatible-workflow.js'),
22
21
  },
23
22
  {
24
23
  name: '003-update-eslint-deprecation-rule',
25
24
  version: LEGACY_UPDATE_CUTOFF_VERSION,
26
25
  description: 'Replace deprecated eslint-plugin-deprecation with @typescript-eslint/no-deprecated rule.',
27
- scriptPath: resolveScriptPath(import.meta.url, './scripts/003-update-eslint-deprecation-rule.js'),
26
+ scriptPath: import.meta.resolve('./scripts/003-update-eslint-deprecation-rule.js'),
28
27
  },
29
28
  {
30
29
  name: '004-eslint9-flat-config',
31
30
  version: LEGACY_UPDATE_CUTOFF_VERSION,
32
31
  description: 'Migrate eslint config to flat config format and update devDependencies to latest versions.',
33
- scriptPath: resolveScriptPath(import.meta.url, './scripts/004-eslint9-flat-config.js'),
32
+ scriptPath: import.meta.resolve('./scripts/004-eslint9-flat-config.js'),
34
33
  },
35
34
  {
36
35
  name: '005-react-18-3',
37
36
  version: '6.1.9',
38
37
  description: 'Update React and ReactDOM 18.x versions to ^18.3.0 to surface React 19 compatibility issues.',
39
- scriptPath: resolveScriptPath(import.meta.url, './scripts/005-react-18-3.js'),
38
+ scriptPath: import.meta.resolve('./scripts/005-react-18-3.js'),
40
39
  },
41
40
  // Do not use LEGACY_UPDATE_CUTOFF_VERSION for new migrations. It is only used above to force migrations to run
42
41
  // for those written before the switch to updates as migrations.
@@ -1,4 +1,4 @@
1
- import { dirname, join, resolve } from 'node:path';
1
+ import { dirname, join } from 'node:path';
2
2
  import { createRequire } from 'node:module';
3
3
  import { Context } from './context.js';
4
4
  import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
@@ -7,7 +7,6 @@ import { output } from '../utils/utils.console.js';
7
7
  import { getPackageManagerSilentInstallCmd, getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
8
8
  import { execSync } from 'node:child_process';
9
9
  import { clean, coerce, gt, gte } from 'semver';
10
- import { fileURLToPath } from 'node:url';
11
10
 
12
11
  export function printChanges(context: Context, key: string, description: string) {
13
12
  const changes = context.listChanges();
@@ -298,16 +297,3 @@ function sortObjectByKeys<T extends Record<string, any>>(obj: T): T {
298
297
  .sort()
299
298
  .reduce((acc, key) => ({ ...acc, [key]: obj[key] }), {} as T);
300
299
  }
301
-
302
- /**
303
- * Resolves a script path relative to the caller's file location.
304
- *
305
- * @param callerUrl - The import.meta.url from the calling file
306
- * @param relativePath - The relative path to resolve (e.g., './scripts/example.js')
307
- * @returns The absolute resolved path
308
- */
309
- export function resolveScriptPath(callerUrl: string, relativePath: string): string {
310
- const __filename = fileURLToPath(callerUrl);
311
- const __dirname = dirname(__filename);
312
- return resolve(__dirname, relativePath);
313
- }