@grafana/create-plugin 7.4.0 → 7.5.0-canary.2630.25781735426.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
|
|
96
|
+
if (templateData.packageManagerName === "yarn") {
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "7.5.0-canary.2630.25781735426.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": "
|
|
58
|
+
"gitHead": "b92e8671ea11d60bf79cc2c03cb7c5a6afe75b58"
|
|
59
59
|
}
|
|
@@ -135,8 +135,8 @@ function getActionsForTemplateFolder({
|
|
|
135
135
|
}) {
|
|
136
136
|
let files = glob.sync(`${folderPath}/**`, { dot: true });
|
|
137
137
|
|
|
138
|
-
//
|
|
139
|
-
if (templateData.packageManagerName
|
|
138
|
+
// If the user selected yarn as their package manager, filter out npmrc file from templates since it's only needed for npm/pnpm.
|
|
139
|
+
if (templateData.packageManagerName === 'yarn') {
|
|
140
140
|
files = files.filter((file) => path.basename(file) !== 'npmrc');
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -24,9 +24,18 @@ export async function configureYarn(cwd: string, packageManagerVersion: string)
|
|
|
24
24
|
shell: true,
|
|
25
25
|
cwd,
|
|
26
26
|
});
|
|
27
|
-
|
|
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
|
-
|
|
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.'
|
package/templates/common/npmrc
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
|
|
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
|