File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -2,19 +2,35 @@ const { execSync } = require('child_process');
22const path = require ( 'path' ) ;
33const 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+
519const 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
You can’t perform that action at this time.
0 commit comments