Skip to content

Commit efde1de

Browse files
committed
Simon Game initial workspace
1 parent 943daa5 commit efde1de

File tree

9 files changed

+184
-0
lines changed

9 files changed

+184
-0
lines changed

workspaces/simon-game/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist/
2+
3+
data.json
4+
secrets_DO_NOT_COMMIT_OR_SHARE.json
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import config from "@code-chronicles/eslint-config";
2+
3+
// TODO: maybe read the .gitignore?
4+
export default [...config, { ignores: ["dist/"] }];

workspaces/simon-game/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Simon Game</title>
6+
<script async="" src="dist/main.js"></script>
7+
<script async="" src="dist/dependencies.js"></script>
8+
<link href="style.css" rel="stylesheet" />
9+
</head>
10+
<body>
11+
<div id="main"></div>
12+
</body>
13+
</html>

workspaces/simon-game/package.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "@code-chronicles/simon-game",
3+
"version": "0.0.1",
4+
"license": "MIT",
5+
"private": false,
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/code-chronicles-code/leetcode-curriculum.git",
9+
"directory": "workspaces/simon-game"
10+
},
11+
"author": {
12+
"name": "Miorel-Lucian Palii",
13+
"url": "https://github.com/miorel"
14+
},
15+
"type": "module",
16+
"exports": "./src/main.ts",
17+
"scripts": {
18+
"build": "cross-env NODE_OPTIONS=\"--import tsx\" webpack",
19+
"format": "prettier --color --write .",
20+
"lint": "eslint --color --max-warnings=0 .",
21+
"start": "tsx src/main.ts",
22+
"typecheck": "tsx -e 'require(\"@code-chronicles/repository-scripts/typecheck\").run()'"
23+
},
24+
"dependencies": {
25+
"@code-chronicles/leetcode-api": "workspace:*",
26+
"@code-chronicles/util": "workspace:*",
27+
"bufferutil": "4.0.8",
28+
"discord.js": "14.15.3",
29+
"invariant": "2.2.4",
30+
"react": "18.3.1",
31+
"react-dom": "18.3.1",
32+
"utf-8-validate": "6.0.4",
33+
"ws": "8.18.0",
34+
"zod": "3.23.8"
35+
},
36+
"devDependencies": {
37+
"@code-chronicles/eslint-config": "workspace:*",
38+
"@code-chronicles/repository-scripts": "workspace:*",
39+
"@code-chronicles/webpack-make-output-executable-plugin": "workspace:*",
40+
"@types/invariant": "2.2.37",
41+
"@types/node": "22.7.6",
42+
"@types/react": "18.3.11",
43+
"@types/react-dom": "18.3.1",
44+
"cross-env": "7.0.3",
45+
"eslint": "9.12.0",
46+
"fork-ts-checker-webpack-plugin": "9.0.2",
47+
"prettier": "3.3.3",
48+
"tsx": "4.19.1",
49+
"typescript": "5.6.3",
50+
"webpack": "5.95.0",
51+
"webpack-cli": "5.1.4"
52+
}
53+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from "react";
2+
3+
export function App() {
4+
return <div>Hello World!</div>
5+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import nullthrows from "nullthrows";
2+
import React from "react";
3+
import ReactDOM from "react-dom/client";
4+
5+
import { App } from "./components/App.tsx";
6+
7+
window.addEventListener(
8+
"load",
9+
() => {
10+
ReactDOM.createRoot(
11+
nullthrows(
12+
document.getElementById("main"),
13+
'No element with id "main" in the DOM!',
14+
),
15+
).render(<App />);
16+
},
17+
{ once: true },
18+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../tsconfig-base.json"
3+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { execSync } from "node:child_process";
2+
import path from "node:path";
3+
4+
import { DefinePlugin, type Configuration } from "webpack";
5+
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
6+
7+
const config: Configuration = {
8+
target: "web",
9+
// TODO: for Chrome extension we will need devtool: "cheap-source-map" since we can't eval.
10+
entry: "./src/app/main.tsx",
11+
output: {
12+
filename: "[name].js",
13+
path: path.resolve(__dirname, "dist"),
14+
},
15+
16+
module: {
17+
rules: [
18+
{
19+
test: /\.tsx?$/,
20+
use: [
21+
{
22+
loader: "ts-loader",
23+
options: {
24+
transpileOnly: true,
25+
},
26+
},
27+
],
28+
exclude: /\bnode_modules\b/,
29+
},
30+
],
31+
},
32+
33+
resolve: {
34+
conditionNames: ["import"],
35+
},
36+
37+
plugins: [new ForkTsCheckerWebpackPlugin()],
38+
39+
optimization: {
40+
splitChunks: {
41+
cacheGroups: {
42+
dependencies: {
43+
test: /\bnode_modules\b/,
44+
name: "dependencies",
45+
chunks: "all",
46+
},
47+
},
48+
},
49+
},
50+
};
51+
52+
export default config;

yarn.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)