diff --git a/.drone.yml b/.drone.yml index 0fef85a..3bb1890 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,8 +33,8 @@ steps: commands: - yarn build environment: - SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8} - REVISION: ${DRONE_COMMIT_SHA} + VITE_SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8} + VITE_APP_REVISION: ${DRONE_COMMIT_SHA} when: event: - push @@ -46,9 +46,9 @@ steps: commands: - yarn build environment: - SUBPATH: /tghandbook/pr-${DRONE_PULL_REQUEST} + VITE_SUBPATH: /tghandbook/pr-${DRONE_PULL_REQUEST} OUTDIR: ./dist-pr - REVISION: ${DRONE_COMMIT_SHA} + VITE_APP_REVISION: ${DRONE_COMMIT_SHA} when: event: - pull_request @@ -60,9 +60,9 @@ steps: commands: - yarn build environment: - SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_} + VITE_SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_} OUTDIR: ./dist-branch - REVISION: ${DRONE_COMMIT_SHA} + VITE_APP_REVISION: ${DRONE_COMMIT_SHA} when: event: - push @@ -143,6 +143,11 @@ volumes: - name: cache host: path: /opt/gitea/drone-cache/hamcha/tghandbook + +trigger: + event: + - push + - pull_request --- kind: signature -hmac: 55dfd5c47c79e51394c5cdfaa9b98a6f6acd84e751e92964c202ac19b46c0373 +hmac: c7b6e232691aff687451a9f85599852d4af0e3b63198c41116be4e09e7d82e93 diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 83% rename from .eslintrc.js rename to .eslintrc.cjs index e88fad1..b6af495 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -19,7 +19,9 @@ module.exports = { "no-param-reassign": "off", "no-alert": "off", "no-console": "off", + "no-shadow": "off", "func-names": "off", + "default-param-last": "off", "dot-notation": ["error", { allowPattern: "^[A-Z][a-z]+$" }], "@typescript-eslint/ban-ts-comment": [ "error", @@ -27,5 +29,7 @@ module.exports = { "ts-expect-error": "allow-with-description", }, ], + "@typescript-eslint/no-shadow": ["error"], + "@typescript-eslint/default-param-last": ["error"], }, }; diff --git a/.gitignore b/.gitignore index 14eec95..3f41e3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ node_modules dist .cache -yarn-error.log \ No newline at end of file +.parcel-cache +yarn-error.log +*.ts.js \ No newline at end of file diff --git a/LICENSE b/LICENSE index 8790cc3..0af4141 100644 --- a/LICENSE +++ b/LICENSE @@ -1,23 +1,5 @@ -This code is license under ISC, full copy below: +Copyright 2020, Alessandro Gatti - Copyright 2020, Alessandro Gatti +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -This code uses idb-keyval, licensed under Apache 2: - - Copyright 2016, Jake Archibald - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md index a7c256a..98f5f67 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ -# /tg/ handbook +# /tg/station handbook -[![Build Status](https://drone.zyg.ovh/api/badges/Hamcha/tghandbook/status.svg)](https://drone.zyg.ovh/Hamcha/tghandbook) +A fancier way to browse the /tg/ wiki. This handbook is a single page application that downloads 20+ pages from the /tg/station wiki (currently using a CORS proxy), adds some fancy filtering and Nanotrasen styling. -## Building - -`yarn build` +It adapts the pages layout to be narrow as it's meant to be used in a small window, much like a PDA or an in-game book. ## Development -`yarn dev` +Start hot-reloading server with `npm start` + +Build with `npm run build` + +## License + +The project is licensed under ISC (SPDX identifier). Please see the LICENSE file for details. diff --git a/build.js b/build.js deleted file mode 100644 index 7c449e7..0000000 --- a/build.js +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable */ -const Bundler = require("parcel-bundler"); -const Path = require("path"); - -const entryFiles = Path.join(__dirname, "./index.html"); - -// Bundler options -const options = { - outDir: process.env.OUTDIR || "./dist", - outFile: "index.html", - publicUrl: process.env.SUBPATH || "/", - watch: false, - contentHash: false, - scopeHoist: false, - target: "browser", - logLevel: 3, // 5 = save everything to a file, 4 = like 3, but with timestamps and additionally log http requests to dev server, 3 = log info, warnings & errors, 2 = log warnings & errors, 1 = log errors, 0 = log nothing - sourceMaps: true, // Enable or disable sourcemaps, defaults to enabled (minified builds currently always create sourcemaps) - autoInstall: true, // Enable or disable auto install of missing dependencies found during bundling -}; - -(async () => { - const bundler = new Bundler(entryFiles, options); - await bundler.bundle(); -})(); diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..d07d65a --- /dev/null +++ b/env.d.ts @@ -0,0 +1,10 @@ +/// + +interface ImportMetaEnv { + readonly VITE_SUBDIR: string; + readonly VITE_APP_REVISION: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/index.html b/index.html index 3b4ee44..079e898 100644 --- a/index.html +++ b/index.html @@ -14,31 +14,31 @@ - - + + - - - - + + + + /tg/station Handbook @@ -52,8 +52,8 @@
- - + +

@@ -79,9 +79,7 @@