@grafana/create-plugin 7.0.7-canary.2525.22908701835.0 → 7.0.7

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v7.0.7 (Wed Mar 11 2026)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Update dependency @grafana/plugin-e2e to v3.4.4 [#2519](https://github.com/grafana/plugin-tools/pull/2519) ([@renovate-sh-app[bot]](https://github.com/renovate-sh-app[bot]))
6
+
7
+ #### Authors: 1
8
+
9
+ - [@renovate-sh-app[bot]](https://github.com/renovate-sh-app[bot])
10
+
11
+ ---
12
+
1
13
  # v7.0.6 (Tue Mar 10 2026)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -22,12 +22,12 @@ class Context {
22
22
  }
23
23
  deleteFile(filePath) {
24
24
  const path = this.normalisePath(filePath);
25
- if (this.files[path]?.changeType === "add") {
25
+ if (this.files[path] && this.files[path].changeType === "add") {
26
26
  delete this.files[path];
27
27
  return;
28
28
  } else if (this.doesFileExistOnDisk(path)) {
29
29
  this.files[path] = { ...this.files[path], changeType: "delete" };
30
- } else if (this.files[path]?.changeType === "update") {
30
+ } else if (this.files[path] && this.files[path].changeType === "update") {
31
31
  throw new Error(`File ${path} was marked as updated already`);
32
32
  } else {
33
33
  throw new Error(`File ${path} does not exist`);
@@ -40,8 +40,7 @@ class Context {
40
40
  throw new Error(`File ${path} does not exist`);
41
41
  }
42
42
  if (originalContent !== content) {
43
- const isNewFile = this.files[path]?.changeType === "add";
44
- this.files[path] = { content, changeType: isNewFile ? "add" : "update" };
43
+ this.files[path] = { content, changeType: "update" };
45
44
  } else {
46
45
  codemodsDebug(`Context.updateFile() - no updates for ${filePath}`);
47
46
  }
@@ -64,7 +63,7 @@ class Context {
64
63
  }
65
64
  getFile(filePath) {
66
65
  const path = this.normalisePath(filePath);
67
- if (this.files[path]?.changeType === "delete") {
66
+ if (this.files[path] && this.files[path].changeType === "delete") {
68
67
  return void 0;
69
68
  }
70
69
  if (this.files[path]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "7.0.7-canary.2525.22908701835.0",
3
+ "version": "7.0.7",
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": "03ff50fe8759f3694ce34034184ec59e7936f5d8"
58
+ "gitHead": "711581e2cfaa07e7bb83adfb1de2fdba7408e192"
59
59
  }
@@ -62,9 +62,10 @@ describe('Context', () => {
62
62
 
63
63
  describe('updateFile', () => {
64
64
  it('should update a file in the context', () => {
65
- const context = new Context(`${__dirname}/migrations/fixtures`);
66
- context.updateFile('foo/bar.ts', 'new content');
67
- expect(context.listChanges()).toEqual({ 'foo/bar.ts': { content: 'new content', changeType: 'update' } });
65
+ const context = new Context();
66
+ context.addFile('file.txt', 'content');
67
+ context.updateFile('file.txt', 'new content');
68
+ expect(context.listChanges()).toEqual({ 'file.txt': { content: 'new content', changeType: 'update' } });
68
69
  });
69
70
 
70
71
  it('should not update a file if it does not exist', () => {
@@ -72,13 +73,6 @@ describe('Context', () => {
72
73
 
73
74
  expect(() => context.updateFile('file.txt', 'new content')).toThrowError('File file.txt does not exist');
74
75
  });
75
-
76
- it('should not replace an update with an add if the file was added in the current context', () => {
77
- const context = new Context();
78
- context.addFile('file.txt', 'content');
79
- context.updateFile('file.txt', 'new content');
80
- expect(context.listChanges()).toEqual({ 'file.txt': { content: 'new content', changeType: 'add' } });
81
- });
82
76
  });
83
77
 
84
78
  describe('renameFile', () => {
@@ -33,7 +33,7 @@ export class Context {
33
33
  const path = this.normalisePath(filePath);
34
34
 
35
35
  // Delete a file that was added to the current context
36
- if (this.files[path]?.changeType === 'add') {
36
+ if (this.files[path] && this.files[path].changeType === 'add') {
37
37
  delete this.files[path];
38
38
  return;
39
39
  }
@@ -42,7 +42,7 @@ export class Context {
42
42
  this.files[path] = { ...this.files[path], changeType: 'delete' };
43
43
  }
44
44
  // Delete a file that was updated in the current context
45
- else if (this.files[path]?.changeType === 'update') {
45
+ else if (this.files[path] && this.files[path].changeType === 'update') {
46
46
  throw new Error(`File ${path} was marked as updated already`);
47
47
  } else {
48
48
  throw new Error(`File ${path} does not exist`);
@@ -58,9 +58,7 @@ export class Context {
58
58
  }
59
59
 
60
60
  if (originalContent !== content) {
61
- // new files should be written as 'add' to ensure their directories are created.
62
- const isNewFile = this.files[path]?.changeType === 'add';
63
- this.files[path] = { content, changeType: isNewFile ? 'add' : 'update' };
61
+ this.files[path] = { content, changeType: 'update' };
64
62
  } else {
65
63
  codemodsDebug(`Context.updateFile() - no updates for ${filePath}`);
66
64
  }
@@ -92,7 +90,7 @@ export class Context {
92
90
  const path = this.normalisePath(filePath);
93
91
 
94
92
  // Deleted in this context
95
- if (this.files[path]?.changeType === 'delete') {
93
+ if (this.files[path] && this.files[path].changeType === 'delete') {
96
94
  return undefined;
97
95
  }
98
96
 
@@ -17,7 +17,7 @@
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
19
  "@grafana/eslint-config": "^9.0.0",
20
- "@grafana/plugin-e2e": "^3.4.2",
20
+ "@grafana/plugin-e2e": "^3.4.4",
21
21
  "@grafana/tsconfig": "^2.0.1",
22
22
  "@playwright/test": "^1.57.0",{{#if useExperimentalRspack}}
23
23
  "@rspack/core": "^1.6.0",