Skip to content

Commit a211bc3

Browse files
committed
fix: Ensure static plugin names
1 parent 97a11f8 commit a211bc3

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

scripts/release.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,35 @@ const { execSync } = require('child_process');
22
const path = require('path');
33
const fs = require('fs');
44

5+
const GetPluginName = (pluginDir) => {
6+
const jsonPath = path.join(pluginDir, 'plugin.json');
7+
8+
try {
9+
if (fs.existsSync(jsonPath)) {
10+
const pluginJson = JSON.parse(fs.readFileSync(jsonPath));
11+
return pluginJson.name;
12+
}
13+
}
14+
catch (error) {
15+
return null;
16+
}
17+
}
18+
519
const ParsePlugin = (pluginsDir, submodule) => {
620
const submodulePath = path.join(pluginsDir, submodule);
721

22+
const pluginName = execSync(`git -C ${submodulePath} rev-list --max-parents=0 HEAD`, { encoding: 'utf-8' }).trim();
23+
824
if (fs.existsSync(path.join(submodulePath, '.git'))) {
925
try {
10-
return { plugin: submodule, commitId: execSync(`git -C ${submodulePath} rev-parse HEAD`, { encoding: 'utf-8' }).trim() };
26+
return { plugin: pluginName, commitId: execSync(`git -C ${submodulePath} rev-parse HEAD`, { encoding: 'utf-8' }).trim() };
1127
}
1228
catch (error) {
13-
return { plugin: submodule, commitId: null };
29+
return { plugin: pluginName, commitId: null };
1430
}
1531
}
1632
else {
17-
return { plugin: submodule, commitId: null };
33+
return { plugin: pluginName, commitId: null };
1834
}
1935
}
2036

0 commit comments

Comments
 (0)