Skip to content

Commit 28c11ea

Browse files
feat: add submodule
1 parent 20c44f2 commit 28c11ea

5 files changed

Lines changed: 41 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23+
with:
24+
submodules: true
2325

2426
- name: Setup Node.js
2527
uses: actions/setup-node@v4

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "buriedtown"]
2+
path = buriedtown
3+
url = https://github.com/githubfrostpixel/buried-city-web.git

buriedtown

Submodule buriedtown added at 4153719

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc -b && vite build",
8+
"build": "npm run build:all",
9+
"build:main": "tsc -b && vite build",
10+
"build:submodule": "cd buriedtown && npm ci && npm run build",
11+
"build:all": "npm run build:main && npm run build:submodule && node scripts/copy-submodule-build.js",
912
"lint": "eslint .",
1013
"preview": "vite preview"
1114
},

scripts/copy-submodule-build.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { cpSync, existsSync } from 'fs';
2+
import { join } from 'path';
3+
import { fileURLToPath } from 'url';
4+
import { dirname } from 'path';
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = dirname(__filename);
8+
const rootDir = join(__dirname, '..');
9+
const submoduleDist = join(rootDir, 'buriedtown', 'dist');
10+
const mainDist = join(rootDir, 'dist');
11+
const targetDir = join(mainDist, 'buriedtown');
12+
13+
if (!existsSync(submoduleDist)) {
14+
console.error('Error: Submodule dist directory does not exist. Make sure to build the submodule first.');
15+
process.exit(1);
16+
}
17+
18+
if (!existsSync(mainDist)) {
19+
console.error('Error: Main dist directory does not exist. Make sure to build the main project first.');
20+
process.exit(1);
21+
}
22+
23+
try {
24+
// Copy the entire submodule dist to dist/buriedtown
25+
cpSync(submoduleDist, targetDir, { recursive: true, force: true });
26+
console.log('✓ Successfully copied submodule build to dist/buriedtown/');
27+
} catch (error) {
28+
console.error('Error copying submodule build:', error);
29+
process.exit(1);
30+
}
31+

0 commit comments

Comments
 (0)