22/* eslint-disable require-jsdoc */
33// build/ensure-submodules.ts
44import { spawnSync } from 'node:child_process' ;
5- import { existsSync , readFileSync } from 'node:fs' ;
6- import { resolve } from 'node:path' ;
5+ import { existsSync } from 'node:fs' ;
76import { ConsoleStyles , logWithStyle } from './lib/build-error' ;
87
98function sh ( cmd : string , args : string [ ] , opts : { allowFail ?: boolean } = { } ) {
@@ -16,34 +15,6 @@ function sh(cmd: string, args: string[], opts: { allowFail?: boolean } = {}) {
1615 return res . status === 0 ;
1716}
1817
19- function listSubmodules ( ) : { name : string ; path : string } [ ] {
20- const gm = resolve ( process . cwd ( ) , '.gitmodules' ) ;
21-
22- if ( ! existsSync ( gm ) ) {
23- return [ ] ;
24- }
25- const txt = readFileSync ( gm , 'utf8' ) ;
26- // Minimal parser: lines like [submodule "name"] then path = foo/bar
27- const out : { name : string ; path : string } [ ] = [ ] ;
28- let current : string | null = null ;
29-
30- for ( const line of txt . split ( / \r ? \n / u) ) {
31- const h = line . match ( / ^ \s * \[ s u b m o d u l e \s + " ( .+ ?) " \s * \] \s * $ / u) ;
32-
33- if ( h ) {
34- // eslint-disable-next-line max-statements-per-line
35- current = h [ 1 ] ; continue ;
36- }
37- const p = line . match ( / ^ \s * p a t h \s * = \s * ( .+ ) \s * $ / u) ;
38-
39- if ( p && current ) {
40- out . push ( { name : current , path : p [ 1 ] . trim ( ) } ) ;
41- }
42- }
43-
44- return out ;
45- }
46-
4718function ensureSubmodules ( ) {
4819 if ( ! existsSync ( '.git' ) || ! existsSync ( '.gitmodules' ) ) {
4920 logWithStyle ( '[submodules] No git or no .gitmodules; skipping.' , ConsoleStyles . WARNING ) ;
@@ -52,11 +23,8 @@ function ensureSubmodules() {
5223 }
5324
5425 // Get all submodules and split into optional vs required
55- const subs = listSubmodules ( ) ;
56- const optionalNames = new Set ( [ 'src/plugins-pro' ] ) ; // mark expected-to-fail here
57-
58- const required = subs . filter ( ( s ) => ! optionalNames . has ( s . name ) ) ;
59- const optional = subs . filter ( ( s ) => optionalNames . has ( s . name ) ) ;
26+ const required = [ { name : 'src/engine' , path : 'src/engine' } ] ;
27+ const optional = [ { name : 'src/plugins-pro' , path : 'src/plugins-pro' } ] ;
6028
6129 if ( required . length === 0 && optional . length === 0 ) {
6230 logWithStyle ( '[submodules] No submodules found.' , ConsoleStyles . WARNING ) ;
0 commit comments