Skip to content

Commit

Permalink
chore: made some frontend code optional
Browse files Browse the repository at this point in the history
Using NODE_ENV to determine if frontend code should be included in the build.
  • Loading branch information
joamag committed Jan 2, 2024
1 parent c3041cc commit 0ed1c27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

*
* Made part of the frontend code conditional on `NODE_ENV = "development"`

### Fixed

Expand Down
7 changes: 4 additions & 3 deletions frontends/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "Apache-2.0",
"scripts": {
"build": "parcel build index.html",
"build": "NODE_ENV=production parcel build index.html",
"dev": "parcel index.html",
"lint": "eslint .",
"nodemon": "nodemon --exec \"parcel --no-cache index.html\"",
Expand All @@ -19,10 +19,11 @@
"source": "index.ts",
"devDependencies": {
"@parcel/transformer-typescript-tsc": "^2.10.3",
"@types/node": "^20.10.6",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"buffer": "^6.0.3",
"emukit": "^0.9.4",
"eslint": "^8.56.0",
Expand Down
13 changes: 8 additions & 5 deletions frontends/web/ts/gb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,17 +543,20 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
}

get sections(): SectionInfo[] {
return [
const _sections: SectionInfo[] = [
{
name: "Serial",
icon: require("../res/serial.svg"),
node: SerialSection({ emulator: this })
},
{
name: "Test",
node: TestSection({})
}
];
if (process.env.NODE_ENV === "development") {
_sections.push({
name: "Test",
node: TestSection({})
});
}
return _sections;
}

get help(): HelpPanel[] {
Expand Down

0 comments on commit 0ed1c27

Please sign in to comment.