Skip to content

Commit 45931a9

Browse files
committed
chore: ⚙️ hardcode submodules in build script and add src/engine to .gitmodules
1 parent 99cbca0 commit 45931a9

File tree

2 files changed

+7
-36
lines changed

2 files changed

+7
-36
lines changed

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "src/plugins-pro"]
22
path = src/plugins-pro
3-
url = [email protected]:thkruz/keeptrack-space-pro.git
3+
url = [email protected]:thkruz/keeptrack-space-pro.git
4+
[submodule "src/engine"]
5+
path = src/engine
6+
url = https://github.com/thkruz/doris.git

build/get-submodules.ts

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
/* eslint-disable require-jsdoc */
33
// build/ensure-submodules.ts
44
import { spawnSync } from 'node:child_process';
5-
import { existsSync, readFileSync } from 'node:fs';
6-
import { resolve } from 'node:path';
5+
import { existsSync } from 'node:fs';
76
import { ConsoleStyles, logWithStyle } from './lib/build-error';
87

98
function 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*\[submodule\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*path\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-
4718
function 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

Comments
 (0)