Skip to content

Commit 11047e9

Browse files
cleanup: remove dead vars, restore app.js build output for test compat
- Remove unused MILESTONES array in referral-program.js (declared, never read) - Remove unused CATEGORIES array in community-showcase.js (filter labels are hardcoded in HTML; JS never references the var) - build.js now also writes app.js at repo root — 39 test files use readFileSync('../app.js') + eval() inside jsdom. After the modularisation to src/modules/*, app.js was removed, breaking the entire legacy test suite. Writing the bundle to both dist/bundle.js and app.js restores test infrastructure without rewriting tests. - Add pretest script to auto-build before test runs - Add app.js to .gitignore (build artifact) - Rebuild dist/bundle.js
1 parent 9a2c9f8 commit 11047e9

6 files changed

Lines changed: 11 additions & 9 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ node_modules/
22
coverage/
33
agentlens/
44

5+
# Build artifacts
6+
app.js
7+
58
# Build output committed for GitHub Pages
69

build.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,10 @@ for (const file of files) {
9292
const outPath = path.join(distDir, 'bundle.js');
9393
fs.writeFileSync(outPath, bundle);
9494

95-
console.log(`Bundled ${files.length} files (${(totalSize / 1024).toFixed(1)} KB) → dist/bundle.js (${(bundle.length / 1024).toFixed(1)} KB)`);
95+
// Also write app.js at the repo root for backward-compatible test loading.
96+
// Many test files use `readFileSync('../app.js')` and eval() the result
97+
// inside jsdom. Writing the same bundle here avoids rewriting 39+ tests.
98+
const appPath = path.join(__dirname, 'app.js');
99+
fs.writeFileSync(appPath, bundle);
100+
101+
console.log(`Bundled ${files.length} files (${(totalSize / 1024).toFixed(1)} KB) → dist/bundle.js + app.js (${(bundle.length / 1024).toFixed(1)} KB)`);

dist/bundle.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7371,8 +7371,6 @@ var CommunityShowcase = (function () {
73717371

73727372
var STORAGE_KEY = "agentbox_showcase_likes";
73737373

7374-
var CATEGORIES = ["All", "Productivity", "Developer", "Creative", "Business", "Research"];
7375-
73767374
var SHOWCASES = [
73777375
{
73787376
id: "sc-1", title: "Daily Standup Summarizer",
@@ -9366,8 +9364,6 @@ var ReferralProgram = (function () {
93669364
{ min: 50, label: 'Legend', icon: '👑', color: '#ef4444', perk: 'Lifetime Pro + custom personality' }
93679365
];
93689366

9369-
var MILESTONES = [3, 10, 25, 50, 100];
9370-
93719367
var state = {
93729368
handle: '',
93739369
referrals: 0,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"LICENSE"
1414
],
1515
"scripts": {
16+
"pretest": "node build.js",
1617
"test": "jest --verbose",
1718
"test:coverage": "jest --verbose --coverage",
1819
"build": "node build.js",

src/modules/community-showcase.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ var CommunityShowcase = (function () {
1010

1111
var STORAGE_KEY = "agentbox_showcase_likes";
1212

13-
var CATEGORIES = ["All", "Productivity", "Developer", "Creative", "Business", "Research"];
14-
1513
var SHOWCASES = [
1614
{
1715
id: "sc-1", title: "Daily Standup Summarizer",

src/modules/referral-program.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ var ReferralProgram = (function () {
1111
{ min: 50, label: 'Legend', icon: '👑', color: '#ef4444', perk: 'Lifetime Pro + custom personality' }
1212
];
1313

14-
var MILESTONES = [3, 10, 25, 50, 100];
15-
1614
var state = {
1715
handle: '',
1816
referrals: 0,

0 commit comments

Comments
 (0)