From dd5dfbbb4331a1d0aecf7824e796b939ed43865f Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Mon, 19 Feb 2024 14:49:19 -0800 Subject: [PATCH 1/7] standardize configs across apps --- .eslintrc.js | 14 +++++++++++--- .github/workflows/deploy.yml | 9 +++++++-- .gitignore | 5 ++++- .stylelintrc.json | 5 ++++- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9c9ab4a..41ccbc6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,21 +1,29 @@ module.exports = { env: { - jest: true, node: true, browser: true, - es2021: true, "shared-node-browser": true, + es2021: true, + jest: true, }, - extends: ["eslint:recommended", "plugin:react/recommended"], + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:react-hooks/recommended", + ], overrides: [], parserOptions: { ecmaVersion: "latest", sourceType: "module", + ecmaFeatures: { + jsx: true, + }, }, plugins: ["react"], rules: { "react/prop-types": "off", }, + ignorePatterns: ["dist/*"], settings: { react: { version: "detect", diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9ae3ee8..2ac0491 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,10 +7,15 @@ on: - "README.md" - "TODO.md" - ".github/ISSUE_TEMPLATE/*" + - ".eslintrc.json" + - ".gitignore" + - ".prettierignore" + - ".prettierrc.json" + - ".stylelintrc.json" workflow_dispatch: permissions: - contents: write # write for bumping version (read-only required for deployment) + contents: write # Required for bumping version (read-only required for deployment) pages: write # Required for deployment id-token: write # Required for deployment @@ -43,7 +48,7 @@ jobs: - name: Bump version run: npm version patch - - name: Push + - name: Push the version bump run: | git push origin main diff --git a/.gitignore b/.gitignore index effa275..859c8da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ node_modules dist -PWA_Builder \ No newline at end of file +PWA_Builder +.vscode/settings.json +.env +.env.test diff --git a/.stylelintrc.json b/.stylelintrc.json index eb9a523..010d13b 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -2,6 +2,9 @@ "extends": "stylelint-config-standard", "rules": { "selector-class-pattern": null, - "selector-id-pattern": null + "selector-id-pattern": null, + "custom-property-pattern": null, + "keyframes-name-pattern": null, + "declaration-block-no-redundant-longhand-properties": null } } From 509403c443e753536402a0795ab28f8ff8a0a6ff Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Mon, 19 Feb 2024 18:08:01 -0800 Subject: [PATCH 2/7] standardize config --- webpack.config.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 1af54a3..43eb27f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const path = require("path"); const WorkboxPlugin = require("workbox-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); +const packageJson = require("./package.json"); module.exports = (env, argv) => { if (argv.mode === "development") { @@ -70,10 +71,11 @@ module.exports = (env, argv) => { }); const serviceWorkerPlugin = new WorkboxPlugin.GenerateSW({ - // these options encourage the ServiceWorkers to get in there fast - // and not allow any straggling "old" SWs to hang around + // This helps ensure that all pages will be controlled by a service worker immediately after that service worker activates clientsClaim: true, + // This skips the service worker waiting phase, meaning the service worker activates as soon as it's finished installing skipWaiting: true, + cacheId: `logic-grid-${packageJson.version}`, }); const plugins = @@ -97,7 +99,7 @@ module.exports = (env, argv) => { use: ["style-loader", "css-loader"], }, { - test: /\.(png|svg|jpg|jpeg|gif)$/i, + test: /\.(png|svg|jpg|jpeg|gif|webp)$/i, type: "asset/resource", }, ], @@ -110,12 +112,13 @@ module.exports = (env, argv) => { clean: true, // removes unused files from output dir }, performance: { + // special case to cache scenarios for offline play maxEntrypointSize: 400000, // bytes + // special case to cache scenarios for offline play maxAssetSize: 400000, // bytes }, devServer: { static: "./dist", - historyApiFallback: true, }, plugins: plugins, }; From 61f1cd6a81f1d0b956d96b989b45466a50b0c431 Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Tue, 20 Feb 2024 08:14:52 -0800 Subject: [PATCH 3/7] standardize babel config across apps --- babel.config.cjs | 13 ------------- babel.config.json | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 babel.config.cjs create mode 100644 babel.config.json diff --git a/babel.config.cjs b/babel.config.cjs deleted file mode 100644 index 41e4b4c..0000000 --- a/babel.config.cjs +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - presets: [ - [ - "@babel/preset-env", - { - targets: { - node: "current", - }, - }, - ], - "@babel/preset-react", - ], -}; diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..2250a39 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,13 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "node": "current" + } + } + ], + "@babel/preset-react" + ] +} From 65762a13cc3eef32dd1392362929f877e24f8609 Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Wed, 21 Feb 2024 07:31:05 -0800 Subject: [PATCH 4/7] standardize configs across apps --- package-lock.json | 20 ++++++++++++++++++++ package.json | 21 +++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4eda3aa..a54def5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "css-loader": "^6.7.3", "eslint": "^8.44.0", "eslint-plugin-react": "^7.32.2", + "eslint-plugin-react-hooks": "^4.6.0", "html-webpack-plugin": "^5.5.1", "jest": "^29.5.0", "prettier": "^2.8.7", @@ -4945,6 +4946,18 @@ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" } }, + "node_modules/eslint-plugin-react-hooks": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", + "dev": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + } + }, "node_modules/eslint-plugin-react/node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -15383,6 +15396,13 @@ } } }, + "eslint-plugin-react-hooks": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", + "dev": true, + "requires": {} + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", diff --git a/package.json b/package.json index ea698f6..384c406 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,16 @@ "name": "logic-grid", "version": "1.0.33", "description": "", - "main": "code.js", + "main": "index.js", "scripts": { - "test": "jest --config=jest.config.cjs", + "test": "jest", "build": "webpack", "dev": "webpack-dev-server --mode development", - "start": "webpack-dev-server" + "start": "webpack-dev-server", + "eslint": "npx eslint --ignore-path .gitignore . --fix", + "prettier": "npx prettier --write .", + "style": "npx stylelint '**/*.css' --fix", + "lint": "npm run eslint && npm run prettier && npm run style" }, "repository": { "type": "git", @@ -20,6 +24,11 @@ "url": "https://github.com/skedwards88/logic-grid/issues" }, "homepage": "https://github.com/skedwards88/logic-grid#readme", + "dependencies": { + "lodash.clonedeep": "^4.5.0", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, "devDependencies": { "@babel/core": "^7.21.4", "@babel/preset-env": "^7.21.4", @@ -30,6 +39,7 @@ "css-loader": "^6.7.3", "eslint": "^8.44.0", "eslint-plugin-react": "^7.32.2", + "eslint-plugin-react-hooks": "^4.6.0", "html-webpack-plugin": "^5.5.1", "jest": "^29.5.0", "prettier": "^2.8.7", @@ -40,10 +50,5 @@ "webpack-cli": "^5.0.2", "webpack-dev-server": "^4.13.3", "workbox-webpack-plugin": "^7.0.0" - }, - "dependencies": { - "lodash.clonedeep": "^4.5.0", - "react": "^18.2.0", - "react-dom": "^18.2.0" } } From 94f1bb9719accade042fde98a659b7d4e3691121 Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Thu, 22 Feb 2024 07:02:23 -0800 Subject: [PATCH 5/7] standardize configs across apps --- src/index.html | 17 ++++++++++------- src/manifest.json | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/index.html b/src/index.html index 163b91e..388dadc 100644 --- a/src/index.html +++ b/src/index.html @@ -7,20 +7,23 @@ src="https://www.googletagmanager.com/gtag/js?id=G-0ECKDWFGDF" > Logic Grid + - diff --git a/src/manifest.json b/src/manifest.json index cb5bd62..09e5622 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,6 +2,7 @@ "name": "Logic Grid", "short_name": "Logic Grid", "description": "A logic grid puzzle game", + "id": "?logic_grid=202402221", "dir": "auto", "lang": "en-US", "display": "standalone", From ee8cb59d9926af34c98868b88d1b177721be0b55 Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Thu, 22 Feb 2024 07:06:21 -0800 Subject: [PATCH 6/7] prettier --- src/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index 388dadc..ae13eb4 100644 --- a/src/index.html +++ b/src/index.html @@ -22,7 +22,12 @@ Logic Grid - + From 7b4af8f88fd849626152b502fff94c75ab7791c2 Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Sun, 21 Apr 2024 11:14:26 -0700 Subject: [PATCH 7/7] remove backup copy share --- src/components/Share.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Share.js b/src/components/Share.js index e6fdc21..f90511a 100644 --- a/src/components/Share.js +++ b/src/components/Share.js @@ -10,8 +10,6 @@ function handleShare(text) { }) .then(() => console.log("Successful share")) .catch((error) => { - // copy to clipboard as backup - handleCopy(text); console.log("Error sharing", error); }); sendAnalytics("share");