Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.

Commit 71eff43

Browse files
authored
Merge pull request #102 from RyanLua/build-script
Add scripts to build extension
2 parents 0bb52a2 + c24025b commit 71eff43

4 files changed

Lines changed: 53 additions & 2 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"stylelint.vscode-stylelint"
88
]
99
}
10-
}
10+
},
11+
"postCreateCommand": "chmod +x ./scripts/build.sh"
1112
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node_modules
1+
builds/

.vscode/tasks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build extension",
6+
"type": "shell",
7+
"command": "./scripts/build.sh",
8+
"group": {
9+
"kind": "build",
10+
"isDefault": true
11+
}
12+
}
13+
]
14+
}

scripts/build.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Building Classroom Dark Mode extension..."
5+
6+
VERSION=$(grep -oP '"version":\s*"\K[0-9.]+(?=")' src/manifest.json)
7+
BUILD_DIR="builds"
8+
CHROMIUM_FOLDER="ClassroomDarkMode-$VERSION-chromium"
9+
FIREFOX_FOLDER="ClassroomDarkMode-$VERSION-firefox"
10+
11+
# Setup build directory
12+
echo "Cleaning up build directory..."
13+
rm -rf "$BUILD_DIR"
14+
mkdir -p "$BUILD_DIR"
15+
cd "$BUILD_DIR"
16+
17+
# Build Chromium extension
18+
mkdir -p "$CHROMIUM_FOLDER"
19+
cp -r ../src/* "$CHROMIUM_FOLDER"
20+
rm "$CHROMIUM_FOLDER/manifest.firefox.json"
21+
cd "$CHROMIUM_FOLDER"
22+
zip -rq "../$CHROMIUM_FOLDER.zip" *
23+
cd ..
24+
echo "Chromium extension built successfully"
25+
26+
# Build Firefox extension
27+
mkdir -p "$FIREFOX_FOLDER"
28+
cp -r ../src/* "$FIREFOX_FOLDER"
29+
cp "$FIREFOX_FOLDER/manifest.firefox.json" "$FIREFOX_FOLDER/manifest.json"
30+
rm "$FIREFOX_FOLDER/manifest.firefox.json"
31+
cd "$FIREFOX_FOLDER"
32+
zip -rq "../$FIREFOX_FOLDER.zip" *
33+
cd ..
34+
echo "Firefox extension built successfully"
35+
36+
echo "Build completed successfully!"

0 commit comments

Comments
 (0)