@grafana/create-plugin 7.0.2 → 7.0.3-canary.2510.22708978262.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.
@@ -5,8 +5,22 @@ import { getExportTemplateName, getOnlyNotExistingInCwd, getOnlyExistingInCwd, r
5
5
  import { hasNpmDependenciesToUpdate, getPackageJsonUpdatesAsText, updatePackageJson, getRemovableNpmDependencies, removeNpmDependencies, updateNpmScripts, writePackageManagerInPackageJson, cleanUpPackageJson } from '../utils/utils.npm.js';
6
6
  import { getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
7
7
  import { styleText } from 'node:util';
8
+ import { performPreCodemodChecks } from '../utils/utils.checks.js';
9
+ import { getConfig } from '../utils/utils.config.js';
8
10
 
9
- const migrate = async () => {
11
+ const migrate = async (argv) => {
12
+ await performPreCodemodChecks(argv);
13
+ const { version } = getConfig();
14
+ if (version) {
15
+ output.error({
16
+ title: `Your plugin is using create-plugin version ${version}.`,
17
+ body: [
18
+ "This command is designed to migrate plugins from @grafana/toolkit to @grafana/create-plugin, it should not be used to update plugins that already use @grafana/create-plugin.",
19
+ "If you want to update your plugin to the latest version of @grafana/create-plugin please use the `update` command instead."
20
+ ]
21
+ });
22
+ process.exit(1);
23
+ }
10
24
  try {
11
25
  output.warning({
12
26
  title: "Please make sure that you have backed up your changes before continuing."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "7.0.2",
3
+ "version": "7.0.3-canary.2510.22708978262.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -55,5 +55,5 @@
55
55
  "engines": {
56
56
  "node": ">=20"
57
57
  },
58
- "gitHead": "717ec903ba1ba2abf2fcbb5f10dabea356e39ad8"
58
+ "gitHead": "f8ec4554ec6d5b9702a9e11b039180ca39e21e55"
59
59
  }
@@ -1,3 +1,4 @@
1
+ import minimist from 'minimist';
1
2
  import { MIGRATION_CONFIG } from '../constants.js';
2
3
  import { displayArrayAsList, confirmPrompt, output } from '../utils/utils.console.js';
3
4
  import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates.js';
@@ -19,8 +20,24 @@ import {
19
20
  } from '../utils/utils.npm.js';
20
21
  import { getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
21
22
  import { styleText } from 'node:util';
23
+ import { performPreCodemodChecks } from '../utils/utils.checks.js';
24
+ import { getConfig } from '../utils/utils.config.js';
25
+
26
+ export const migrate = async (argv: minimist.ParsedArgs) => {
27
+ await performPreCodemodChecks(argv);
28
+ const { version } = getConfig();
29
+
30
+ if (version) {
31
+ output.error({
32
+ title: `Your plugin is using create-plugin version ${version}.`,
33
+ body: [
34
+ 'This command is designed to migrate plugins from @grafana/toolkit to @grafana/create-plugin, it should not be used to update plugins that already use @grafana/create-plugin.',
35
+ 'If you want to update your plugin to the latest version of @grafana/create-plugin please use the `update` command instead.',
36
+ ],
37
+ });
38
+ process.exit(1);
39
+ }
22
40
 
23
- export const migrate = async () => {
24
41
  try {
25
42
  // 0. Warning
26
43
  // -----------