@grafana/create-plugin 7.4.0 → 7.5.0-canary.2630.25781529436.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.
@@ -93,7 +93,7 @@ function getActionsForTemplateFolder({
93
93
  templateData
94
94
  }) {
95
95
  let files = glob.sync(`${folderPath}/**`, { dot: true });
96
- if (templateData.packageManagerName !== "pnpm") {
96
+ if (templateData.packageManagerName !== "npm") {
97
97
  files = files.filter((file) => path.basename(file) !== "npmrc");
98
98
  }
99
99
  files = files.filter((file) => {
@@ -17,9 +17,17 @@ async function configureYarn(cwd, packageManagerVersion) {
17
17
  shell: true,
18
18
  cwd
19
19
  });
20
- return "Configured Yarn Berry to use node_modules (PnP is not supported)";
20
+ spawnSync("yarn", ["config", "set", "enableScripts", "false"], {
21
+ shell: true,
22
+ cwd
23
+ });
24
+ return "Configured Yarn Berry to use node_modules and disabled script execution during installation.";
21
25
  }
22
- return "";
26
+ spawnSync("yarn", ["config", "set", "ignore-scripts", "true"], {
27
+ shell: true,
28
+ cwd
29
+ });
30
+ return "Configured Yarn to ignore scripts during installation.";
23
31
  } catch (error) {
24
32
  throw new Error(
25
33
  "There was an error configuring Yarn. Please run `yarn set version stable && yarn config set nodeLinker node-modules` in your plugin directory."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "7.4.0",
3
+ "version": "7.5.0-canary.2630.25781529436.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": "d9190314df0893842f12e33bbdfb7d39c3a704cc"
58
+ "gitHead": "0adaf30d9affc28be99d6d96ead3a05fc58172db"
59
59
  }
@@ -135,8 +135,7 @@ function getActionsForTemplateFolder({
135
135
  }) {
136
136
  let files = glob.sync(`${folderPath}/**`, { dot: true });
137
137
 
138
- // The npmrc file is only useful for `pnpm` settings. We can remove it for other package managers.
139
- if (templateData.packageManagerName !== 'pnpm') {
138
+ if (templateData.packageManagerName !== 'npm') {
140
139
  files = files.filter((file) => path.basename(file) !== 'npmrc');
141
140
  }
142
141
 
@@ -24,9 +24,18 @@ export async function configureYarn(cwd: string, packageManagerVersion: string)
24
24
  shell: true,
25
25
  cwd,
26
26
  });
27
- return 'Configured Yarn Berry to use node_modules (PnP is not supported)';
27
+ spawnSync('yarn', ['config', 'set', 'enableScripts', 'false'], {
28
+ shell: true,
29
+ cwd,
30
+ });
31
+ return 'Configured Yarn Berry to use node_modules and disabled script execution during installation.';
28
32
  }
29
- return '';
33
+ spawnSync('yarn', ['config', 'set', 'ignore-scripts', 'true'], {
34
+ shell: true,
35
+ cwd,
36
+ });
37
+
38
+ return 'Configured Yarn to ignore scripts during installation.';
30
39
  } catch (error) {
31
40
  throw new Error(
32
41
  'There was an error configuring Yarn. Please run `yarn set version stable && yarn config set nodeLinker node-modules` in your plugin directory.'
@@ -1,12 +1,5 @@
1
- # This file is required for PNPM
2
-
3
- # PNPM 8 changed the default resolution mode to "lowest-direct" which is not how we expect resolutions to work
4
- resolution-mode="highest"
5
-
6
- # Make sure the default patterns are still included (https://pnpm.io/npmrc#public-hoist-pattern)
7
- public-hoist-pattern[]="*eslint*"
8
- public-hoist-pattern[]="*prettier*"
9
-
10
- # Hoist all types packages to the root for better TS support
11
- public-hoist-pattern[]="@types/*"
12
- public-hoist-pattern[]="*terser-webpack-plugin*"
1
+ # Disable post install scripts to prevent execution of arbitrary code during package installation.
2
+ # This secures both local development and CI from common supply chain attacks.
3
+ # If you experience problems with legitimate lifecycle scripts rather than
4
+ # disable this please use https://www.npmjs.com/package/@lavamoat/allow-scripts
5
+ ignore-scripts=true