@@ -4,6 +4,52 @@ import { version as commandkitVersion } from '../version';
4
4
import fs from 'node:fs' ;
5
5
import path from 'node:path' ;
6
6
7
+ function $getKnownPlugins ( ) {
8
+ 'use macro' ;
9
+
10
+ // remove name from the list when that plugin is stable
11
+ const BLACKLISTED = new Set ( [
12
+ 'commandkit' , // core package itself, not a plugin
13
+ 'create-commandkit' , // generator, not a plugin
14
+ 'tsconfig' , // repo config related, not a plugin
15
+ 'devtools-ui' , // the ui part of devtools, not a plugin
16
+ // the plugins below are TBD
17
+ 'devtools' ,
18
+ 'tasks' ,
19
+ ] ) ;
20
+
21
+ const { readdirSync, readFileSync } =
22
+ require ( 'node:fs' ) as typeof import ( 'node:fs' ) ;
23
+ const { join } = require ( 'node:path' ) as typeof path ;
24
+
25
+ const pluginsPath = join ( __dirname , '..' , '..' , '..' ) ;
26
+
27
+ const entries = readdirSync ( pluginsPath , { withFileTypes : true } ) . filter (
28
+ ( e ) => ! BLACKLISTED . has ( e . name ) ,
29
+ ) ;
30
+
31
+ const packages = entries . map ( ( p ) =>
32
+ join ( p . parentPath , p . name , 'package.json' ) ,
33
+ ) ;
34
+
35
+ const knownPlugins : string [ ] = [ ] ;
36
+
37
+ for ( const pkg of packages ) {
38
+ try {
39
+ const { name } = JSON . parse ( readFileSync ( pkg , 'utf8' ) ) ;
40
+ if ( name && ! BLACKLISTED . has ( name ) ) {
41
+ knownPlugins . push ( name ) ;
42
+ }
43
+ } catch {
44
+ // Ignore errors
45
+ }
46
+ }
47
+
48
+ return knownPlugins ;
49
+ }
50
+
51
+ const knownPlugins : string [ ] = $getKnownPlugins ( ) ;
52
+
7
53
function findPackageVersion ( packageName : string ) {
8
54
try {
9
55
const packageJsonPath = require . resolve ( `${ packageName } /package.json` ) ;
@@ -82,13 +128,6 @@ function getBinaryVersion(binary: string) {
82
128
}
83
129
84
130
export async function showInformation ( ) {
85
- const knownPlugins = [
86
- '@commandkit/redis' ,
87
- '@commandkit/legacy' ,
88
- '@commandkit/devtools' ,
89
- '@commandkit/i18n' ,
90
- ] ;
91
-
92
131
const runtimeName : string = ( ( ) => {
93
132
// @ts -ignore
94
133
if ( 'Deno' in globalThis && typeof Deno !== 'undefined' ) return 'Deno' ;
0 commit comments