From ce72afb8ed4864cbcd16377ffe29f34c8cb7fcaf Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 13 Dec 2022 18:21:38 +0100 Subject: [PATCH] Move website to separate subdirectory --- .eslintrc.cjs | 7 +--- .vscode/launch.json | 4 +- package-lock.json | 40 +++++++++++++------ package.json | 38 ++++++++---------- packages/game/.eslintrc.cjs | 14 +++++++ .../game/app.jsconfig.json | 0 packages/game/eslint.jsconfig.json | 6 +++ .../game/gulp.tsconfig.json | 0 {gulp => packages/game/gulp}/Context.ts | 0 gulpfile.ts => packages/game/gulpfile.ts | 0 packages/game/package.json | 31 ++++++++++++++ {src => packages/game/src}/index.html | 0 {src => packages/game/src}/js/Constants.js | 0 {src => packages/game/src}/js/Game.js | 0 {src => packages/game/src}/js/State.js | 0 {src => packages/game/src}/js/elt.js | 0 {src => packages/game/src}/js/main.js | 0 {src => packages/game/src}/js/types.d.ts | 0 {src => packages/game/src}/styles/style.css | 0 packages/game/tsconfig.base.json | 3 ++ packages/game/tsconfig.json | 15 +++++++ tsconfig.base.json | 4 +- tsconfig.json | 5 +-- 23 files changed, 119 insertions(+), 48 deletions(-) create mode 100644 packages/game/.eslintrc.cjs rename app.jsconfig.json => packages/game/app.jsconfig.json (100%) create mode 100644 packages/game/eslint.jsconfig.json rename gulp.tsconfig.json => packages/game/gulp.tsconfig.json (100%) rename {gulp => packages/game/gulp}/Context.ts (100%) rename gulpfile.ts => packages/game/gulpfile.ts (100%) create mode 100644 packages/game/package.json rename {src => packages/game/src}/index.html (100%) rename {src => packages/game/src}/js/Constants.js (100%) rename {src => packages/game/src}/js/Game.js (100%) rename {src => packages/game/src}/js/State.js (100%) rename {src => packages/game/src}/js/elt.js (100%) rename {src => packages/game/src}/js/main.js (100%) rename {src => packages/game/src}/js/types.d.ts (100%) rename {src => packages/game/src}/styles/style.css (100%) create mode 100644 packages/game/tsconfig.base.json create mode 100644 packages/game/tsconfig.json diff --git a/.eslintrc.cjs b/.eslintrc.cjs index cdcf40f..2b6562c 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -2,19 +2,16 @@ const { join } = require("node:path"); const { PluginName, PresetName } = require("@manuth/eslint-plugin-typescript"); module.exports = { + root: true, extends: [ `plugin:${PluginName}/${PresetName.RecommendedWithTypeChecking}` ], env: { - browser: true, - es6: true, node: true }, parserOptions: { project: [ - join(__dirname, "app.jsconfig.json"), - join(__dirname, "eslint.jsconfig.json"), - join(__dirname, "gulp.tsconfig.json") + join(__dirname, "eslint.jsconfig.json") ] } }; diff --git a/.vscode/launch.json b/.vscode/launch.json index 1e4bf96..57dfffb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,10 +9,10 @@ "request": "launch", "name": "Launch Website in Chrome", "url": "http://localhost:3000", - "webRoot": "${workspaceFolder}/lib/static", + "webRoot": "${workspaceFolder}/packages/game/lib/static", "preLaunchTask": "Build", "pathMapping": { - "/": "${workspaceFolder}/src" + "/": "${workspaceFolder}/packages/game/src" } } ] diff --git a/package-lock.json b/package-lock.json index 618dd15..2b59c7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,20 +6,14 @@ "packages": { "": { "name": "connect-force", - "version": "0.0.0", "devDependencies": { "@manuth/eslint-plugin-typescript": "^4.0.1", - "@manuth/tsconfig": "^3.0.2", - "@types/browser-sync": "^2.26.3", - "@types/gulp": "^4.0.10", - "@types/node": "^18.11.11", - "browser-sync": "^2.27.10", - "cross-env": "^7.0.3", - "eslint": "^8.29.0", - "gulp": "^4.0.2", - "rimraf": "^3.0.2", - "ts-node": "^10.9.1", - "upath": "^2.0.1" + "eslint": "^8.29.0" + }, + "workspaces": { + "packages": [ + "./packages/*" + ] } }, "node_modules/@babel/code-frame": { @@ -2035,6 +2029,10 @@ "node": ">= 0.10.0" } }, + "node_modules/connect-force": { + "resolved": "packages/game", + "link": true + }, "node_modules/connect-history-api-fallback": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", @@ -9065,6 +9063,24 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "packages/game": { + "name": "connect-force", + "version": "0.0.0", + "devDependencies": { + "@manuth/eslint-plugin-typescript": "^4.0.1", + "@manuth/tsconfig": "^3.0.2", + "@types/browser-sync": "^2.26.3", + "@types/gulp": "^4.0.10", + "@types/node": "^18.11.11", + "browser-sync": "^2.27.10", + "cross-env": "^7.0.3", + "eslint": "^8.29.0", + "gulp": "^4.0.2", + "rimraf": "^3.0.2", + "ts-node": "^10.9.1", + "upath": "^2.0.1" + } } } } diff --git a/package.json b/package.json index 38b2204..43d23e0 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,25 @@ { "name": "connect-force", - "version": "0.0.0", - "type": "module", - "description": "A selfmade Connect Four game.", - "author": "Manuel Thalmann ", + "private": true, + "files": [], + "workspaces": { + "packages": [ + "./packages/*" + ] + }, "scripts": { - "gulp": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" gulp --", - "build": "npm run gulp Build", - "rebuild": "npm run clean && npm run build", - "watch": "npm run gulp Watch", - "clean": "rimraf ./lib", - "lint": "eslint --max-warnings 0 ./src .eslintrc.cjs", - "lint-ide": "npm run lint || exit 0", + "rebuild": "npm run --workspaces rebuild", + "watch": "npm run --workspaces watch", + "clean": "npm run --workspaces clean", + "lint-local": "eslint --max-warnings 0 .eslintrc.cjs", + "lint-local-ide": "npm run lint-local || exit 0", + "lint": "npm run lint-local && npm run --workspaces lint", + "lint-ide": "npm run lint-local-ide && npm run --workspaces lint-ide", + "test": "npm run --workspaces test", "prepare": "npm run rebuild" }, "devDependencies": { "@manuth/eslint-plugin-typescript": "^4.0.1", - "@manuth/tsconfig": "^3.0.2", - "@types/browser-sync": "^2.26.3", - "@types/gulp": "^4.0.10", - "@types/node": "^18.11.11", - "browser-sync": "^2.27.10", - "cross-env": "^7.0.3", - "eslint": "^8.29.0", - "gulp": "^4.0.2", - "rimraf": "^3.0.2", - "ts-node": "^10.9.1", - "upath": "^2.0.1" + "eslint": "^8.29.0" } } diff --git a/packages/game/.eslintrc.cjs b/packages/game/.eslintrc.cjs new file mode 100644 index 0000000..8ace1ab --- /dev/null +++ b/packages/game/.eslintrc.cjs @@ -0,0 +1,14 @@ +const { join } = require("node:path"); + +module.exports = { + env: { + browser: true + }, + parserOptions: { + project: [ + join(__dirname, "app.jsconfig.json"), + join(__dirname, "eslint.jsconfig.json"), + join(__dirname, "gulp.tsconfig.json") + ] + } +}; diff --git a/app.jsconfig.json b/packages/game/app.jsconfig.json similarity index 100% rename from app.jsconfig.json rename to packages/game/app.jsconfig.json diff --git a/packages/game/eslint.jsconfig.json b/packages/game/eslint.jsconfig.json new file mode 100644 index 0000000..f7b8742 --- /dev/null +++ b/packages/game/eslint.jsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.base.json", + "include": [ + "./.eslintrc.cjs" + ] +} diff --git a/gulp.tsconfig.json b/packages/game/gulp.tsconfig.json similarity index 100% rename from gulp.tsconfig.json rename to packages/game/gulp.tsconfig.json diff --git a/gulp/Context.ts b/packages/game/gulp/Context.ts similarity index 100% rename from gulp/Context.ts rename to packages/game/gulp/Context.ts diff --git a/gulpfile.ts b/packages/game/gulpfile.ts similarity index 100% rename from gulpfile.ts rename to packages/game/gulpfile.ts diff --git a/packages/game/package.json b/packages/game/package.json new file mode 100644 index 0000000..38b2204 --- /dev/null +++ b/packages/game/package.json @@ -0,0 +1,31 @@ +{ + "name": "connect-force", + "version": "0.0.0", + "type": "module", + "description": "A selfmade Connect Four game.", + "author": "Manuel Thalmann ", + "scripts": { + "gulp": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" gulp --", + "build": "npm run gulp Build", + "rebuild": "npm run clean && npm run build", + "watch": "npm run gulp Watch", + "clean": "rimraf ./lib", + "lint": "eslint --max-warnings 0 ./src .eslintrc.cjs", + "lint-ide": "npm run lint || exit 0", + "prepare": "npm run rebuild" + }, + "devDependencies": { + "@manuth/eslint-plugin-typescript": "^4.0.1", + "@manuth/tsconfig": "^3.0.2", + "@types/browser-sync": "^2.26.3", + "@types/gulp": "^4.0.10", + "@types/node": "^18.11.11", + "browser-sync": "^2.27.10", + "cross-env": "^7.0.3", + "eslint": "^8.29.0", + "gulp": "^4.0.2", + "rimraf": "^3.0.2", + "ts-node": "^10.9.1", + "upath": "^2.0.1" + } +} diff --git a/src/index.html b/packages/game/src/index.html similarity index 100% rename from src/index.html rename to packages/game/src/index.html diff --git a/src/js/Constants.js b/packages/game/src/js/Constants.js similarity index 100% rename from src/js/Constants.js rename to packages/game/src/js/Constants.js diff --git a/src/js/Game.js b/packages/game/src/js/Game.js similarity index 100% rename from src/js/Game.js rename to packages/game/src/js/Game.js diff --git a/src/js/State.js b/packages/game/src/js/State.js similarity index 100% rename from src/js/State.js rename to packages/game/src/js/State.js diff --git a/src/js/elt.js b/packages/game/src/js/elt.js similarity index 100% rename from src/js/elt.js rename to packages/game/src/js/elt.js diff --git a/src/js/main.js b/packages/game/src/js/main.js similarity index 100% rename from src/js/main.js rename to packages/game/src/js/main.js diff --git a/src/js/types.d.ts b/packages/game/src/js/types.d.ts similarity index 100% rename from src/js/types.d.ts rename to packages/game/src/js/types.d.ts diff --git a/src/styles/style.css b/packages/game/src/styles/style.css similarity index 100% rename from src/styles/style.css rename to packages/game/src/styles/style.css diff --git a/packages/game/tsconfig.base.json b/packages/game/tsconfig.base.json new file mode 100644 index 0000000..4c409ed --- /dev/null +++ b/packages/game/tsconfig.base.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.base.json" +} \ No newline at end of file diff --git a/packages/game/tsconfig.json b/packages/game/tsconfig.json new file mode 100644 index 0000000..c78fdbc --- /dev/null +++ b/packages/game/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.base.json", + "references": [ + { + "path": "./app.jsconfig.json" + }, + { + "path": "./eslint.jsconfig.json" + }, + { + "path": "./gulp.tsconfig.json" + } + ], + "include": [] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index ff601d4..37881ac 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,8 +1,6 @@ { "extends": "@manuth/tsconfig/recommended", "compilerOptions": { - "module": "Node16", - "allowJs": true, - "checkJs": true + "module": "Node16" } } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index c78fdbc..2dec9ec 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,11 @@ { "extends": "./tsconfig.base.json", "references": [ - { - "path": "./app.jsconfig.json" - }, { "path": "./eslint.jsconfig.json" }, { - "path": "./gulp.tsconfig.json" + "path": "./packages/game" } ], "include": []