Skip to content

Commit

Permalink
Port over base project from deepsight.gg
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiriVulpes committed Feb 29, 2024
1 parent b641847 commit 0caa3ce
Show file tree
Hide file tree
Showing 99 changed files with 11,868 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = /** @type {import("eslint").Linter.BaseConfig & import("@typescript-eslint/utils").TSESLint.Linter.Config} */ ({
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
ignorePatterns: [".eslintrc.js"],
plugins: [
"@typescript-eslint",
"only-warn",
],
extends: [
// use all recommended rules as base
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
rules: {
// eslint
"comma-dangle": ["warn", "always-multiline"],
"quotes": ["warn", "double", { avoidEscape: true }],
"no-constant-condition": ["warn", { checkLoops: false }], // allows `while (true)`
"no-empty": ["warn", { allowEmptyCatch: true }],
"prefer-const": ["warn", { "destructuring": "all" }],
"no-inner-declarations": ["off"],
"no-unexpected-multiline": ["off"], // sometimes i want to do zero indexing on a new line
"semi": ["warn", "always"],

// typescript-eslint
"@typescript-eslint/no-unused-vars": ["off"], // literally just what typescript already has, no thanks
"@typescript-eslint/no-explicit-any": ["off"], // `any` is a useful type mostly for type arguments. It should be avoided by writing good, strongly-typed code, not warned in all uses
"@typescript-eslint/await-thenable": ["off"], // this has a warning built in to TS (the ... under the `await`)
"@typescript-eslint/no-non-null-assertion": ["off"], // listen, type guards are waaaay not good enough to go without language features like this
"@typescript-eslint/no-namespace": ["off"], // this is super useful to add stuff to classes and interfaces and enums and stuff
"@typescript-eslint/explicit-module-boundary-types": ["off"], // it would be so annoying to explicitly type all the methods that return `this`
// "@typescript-eslint/no-unsafe-member-access": ["off"],
"@typescript-eslint/ban-types": ["off"], // there's actually a lot of useful types in here, add more restrictions back later if need be
// "@typescript-eslint/no-misused-promises": ["warn", { "checksVoidReturn": false }], // this prevents hanging promises
// "@typescript-eslint/unbound-method": ["warn", { "ignoreStatic": true }],
"@typescript-eslint/unbound-method": ["off"], // we have @Bound for this purpose
"@typescript-eslint/no-empty-interface": ["off"], // not useful
"@typescript-eslint/no-empty-function": ["off"], // not useful
"@typescript-eslint/no-unsafe-return": ["off"], // i want this but it yells when an any value is returned in an any, not good for chaining callback functions

"@typescript-eslint/consistent-type-imports": ["warn"],
"@typescript-eslint/no-unsafe-declaration-merging": ["off"],
"@typescript-eslint/no-unsafe-enum-comparison": ["off"],
},
});
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
38 changes: 38 additions & 0 deletions .github/workflows/build-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build beta

on:
workflow_call:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-beta:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4

- name: Install dependencies
run: npm ci --force

- name: Build
env:
ENVIRONMENT: beta
URL_ORIGIN: https://fluff4.me/beta/
BUILD_NUMBER: ${{ github.run_number }}
BUILD_SHA: ${{ github.sha }}
run: npm run build

- name: Prepare for GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: build-beta
build_dir: docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
workflow_call:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4

- name: Install dependencies
run: npm ci --force

- name: Calculate Run Number
env:
NUM: ${{ github.run_number }}
run: echo "BUILD_NUMBER=$(($NUM+447))" >> "$GITHUB_ENV"

- name: Build
env:
URL_ORIGIN: https://fluff4.me/
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
BUILD_SHA: ${{ github.sha }}
run: npm run build

- name: Cleanup
run: rm -rf docs/testiny

- name: Prepare for GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v4
with:
fqdn: fluff4.me
target_branch: build
build_dir: docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy
concurrency:
group: deploy
cancel-in-progress: true

on:
workflow_call:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout build
uses: actions/checkout@v4
with:
ref: build

- name: Checkout build-beta
uses: actions/checkout@v4
with:
ref: build-beta
path: beta

- name: Clear .git folders (no submodules here!)
run: |
rm -rf .git
rm -rf beta/.git
- name: Prepare for GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: deploy
build_dir: "."
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/push-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Push beta

on:
push:
branches: [ beta ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-beta:
uses: ./.github/workflows/build-beta.yml
secrets: inherit

deploy:
needs: build-beta
uses: ./.github/workflows/deploy.yml
secrets: inherit
28 changes: 28 additions & 0 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Push main

on:
push:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
rebase:
uses: ./.github/workflows/rebase-beta.yml
secrets: inherit

build:
uses: ./.github/workflows/build.yml
secrets: inherit

build-beta:
needs: [rebase]
uses: ./.github/workflows/build-beta.yml
secrets: inherit

deploy:
needs: [build-beta, build]
if: always() && needs.build.result == 'success'
uses: ./.github/workflows/deploy.yml
secrets: inherit
27 changes: 27 additions & 0 deletions .github/workflows/rebase-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto-rebase beta onto main

on:
workflow_call:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
rebase:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: beta

- name: Rebase
run: |
git fetch
if ! git rebase origin/main; then
echo "Rebase failed due to conflicts."
git rebase --abort
exit 1
fi
git push -f origin beta
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
docs/
.env
static/js/vendor
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Watch",
"type": "shell",
"group": "build",
"isBackground": true,
"command": "npm run watch",
"problemMatcher": []
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Chiri Vulpes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# fluff4.me-issues
Bug reporting, improvements, and milestones for fluff4.me
# fluff4.me
The safe place for trans (and other queer friends) webnovels!
Loading

0 comments on commit 0caa3ce

Please sign in to comment.