Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/next-js #492

Open
wants to merge 39 commits into
base: feat/v6.4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1415c0b
feat: bun
RPDeshaies Sep 11, 2023
f24ebfc
fix: build
RPDeshaies Sep 11, 2023
2614507
feat: test
RPDeshaies Sep 11, 2023
0617d87
feat: add vitest
RPDeshaies Sep 11, 2023
45f7124
feat: terser
RPDeshaies Sep 11, 2023
648501c
tsc
RPDeshaies Sep 11, 2023
dcea66f
fix: vitest
RPDeshaies Sep 11, 2023
4069579
go
RPDeshaies Sep 11, 2023
6d2a9d3
fix: deploy
RPDeshaies Sep 11, 2023
a305abf
int
RPDeshaies Sep 11, 2023
10750ae
int with npm
RPDeshaies Sep 11, 2023
a990de9
bun
RPDeshaies Sep 11, 2023
d1dd5c8
engine
RPDeshaies Sep 11, 2023
539c5ff
fix loc?
RPDeshaies Sep 11, 2023
cad08b5
lock
RPDeshaies Sep 11, 2023
fe0d8b8
fix: bun
RPDeshaies Sep 11, 2023
3855f3c
feat: first batch of work
RPDeshaies Sep 11, 2023
f012671
feat: lint
RPDeshaies Sep 11, 2023
a3214ee
fix lint + build
RPDeshaies Sep 11, 2023
d4b7e32
fix: build + lint + progress for liveblocks
RPDeshaies Sep 11, 2023
320bb5a
feat: more routesand pages
RPDeshaies Sep 11, 2023
ada0847
feat: character template
RPDeshaies Sep 11, 2023
a43d6ab
feat: characters
RPDeshaies Sep 12, 2023
4df0b24
lighthouse
RPDeshaies Sep 12, 2023
edcbcec
lighthouse
RPDeshaies Sep 12, 2023
1619ee8
Merge branch 'feat/v6.4.0' of https://github.com/farirpgs/fari-app in…
RPDeshaies Sep 12, 2023
1f126d1
fix: storybook + tests
RPDeshaies Sep 12, 2023
fed12b0
fix storybook and tsc
RPDeshaies Sep 12, 2023
b85e288
tsc
RPDeshaies Sep 12, 2023
d9d8ea0
fix: defaults
RPDeshaies Sep 12, 2023
d5724c4
fix: templates
RPDeshaies Sep 12, 2023
28f56ff
lint
RPDeshaies Sep 12, 2023
be8a553
fix deploy
RPDeshaies Sep 12, 2023
3c48bd4
fix dist
RPDeshaies Sep 12, 2023
cec8d4a
fix start
RPDeshaies Sep 12, 2023
e60ccec
go
RPDeshaies Oct 3, 2023
1629b04
fix
RPDeshaies Dec 11, 2023
d3596de
no lock
RPDeshaies Dec 11, 2023
2ae0080
revert
RPDeshaies Dec 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 20 additions & 23 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
"VARIANT": "16"
}
},
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
"VARIANT": "16"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {},
// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": ["dbaeumer.vscode-eslint"],

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [1234],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
102 changes: 54 additions & 48 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
{
"root": true,
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["react", "@typescript-eslint", "react-hooks"],
"env": {
"browser": true,
"es6": true,
"node": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": "next",
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn"],
"no-restricted-imports": [
"error",

{ "name": "lodash", "message": "Use lodash/myFunction instead" }
],
"react/prop-types": 0,
"react-hooks/rules-of-hooks": "error",
"react/display-name": 0,
// "react-hooks/exhaustive-deps": "warn",
"prefer-template": "error",
"react/self-closing-comp": [
"warn",
{
"component": true,
"html": true
}
]
},
"settings": {
"react": {
"version": "detect"
}
"react-hooks/exhaustive-deps": "off",
"@next/next/no-img-element": "off",
"@next/next/no-page-custom-font": "off"
}
// "root": true,
// "extends": [
// "plugin:react/recommended",
// "plugin:@typescript-eslint/eslint-recommended",
// "prettier"
// ],
// "parser": "@typescript-eslint/parser",
// "plugins": ["react", "@typescript-eslint", "react-hooks"],
// "env": {
// "browser": true,
// "es6": true,
// "node": true
// },
// "globals": {
// "Atomics": "readonly",
// "SharedArrayBuffer": "readonly"
// },
// "parserOptions": {
// "ecmaFeatures": {
// "jsx": true
// },
// "ecmaVersion": 2018,
// "sourceType": "module"
// },
// "rules": {
// "no-unused-vars": "off",
// "@typescript-eslint/no-unused-vars": ["warn"],
// "no-restricted-imports": [
// "error",

// { "name": "lodash", "message": "Use lodash/myFunction instead" }
// ],
// "react/prop-types": 0,
// "react-hooks/rules-of-hooks": "error",
// "react/display-name": 0,
// // "react-hooks/exhaustive-deps": "warn",
// "prefer-template": "error",
// "react/self-closing-comp": [
// "warn",
// {
// "component": true,
// "html": true
// }
// ]
// },
// "settings": {
// "react": {
// "version": "detect"
// }
// }
}
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
run: |
CONTEXT=production bun run build
env:
VITE_GITHUB_RUN_NUMBER: ${{github.run_number}}
VITE_GITHUB_SHA: ${{github.sha}}
NEXT_PUBLIC__GITHUB_RUN_NUMBER: ${{github.run_number}}
NEXT_PUBLIC__GITHUB_SHA: ${{github.sha}}
# Validate
- name: Validate
run: bun run validate
Expand All @@ -38,8 +38,8 @@ jobs:
uses: actions/upload-artifact@v1
if: always()
with:
name: dist
path: dist
name: .next
path: .next
deploy-preview:
needs: [build]
runs-on: ubuntu-latest
Expand All @@ -63,8 +63,8 @@ jobs:
- name: Download Artifacts
uses: actions/download-artifact@master
with:
name: dist
path: dist
name: .next
path: .next
# Deploy Preview
- name: Deploy Preview
run: bun run deploy:preview -- --auth ${{secrets.NETLIFY_AUTH_TOKEN}} --alias $GITHUB_RUN_ID
Expand All @@ -90,8 +90,8 @@ jobs:
- name: Download Artifacts
uses: actions/download-artifact@master
with:
name: dist
path: dist
name: .next
path: .next
# Deploy Production
- name: Deploy Production
run: bun run deploy:prod -- --auth ${{secrets.NETLIFY_AUTH_TOKEN}}
2 changes: 1 addition & 1 deletion .github/workflows/int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Cypress run
uses: cypress-io/github-action@v5
with:
start: npm run serve:build
start: npm start
- name: Upload Cypress Videos
uses: actions/upload-artifact@v3
if: always()
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ _site

# storybook
storybook-static

# next
out
.next
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"bierner.comment-tagged-templates",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"yzhang.markdown-all-in-one",
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"search.exclude": {
"**/node_modules/**": true,
"**/dist/**": true,
"**/out/**": true,
"**/.cache/**": true,
"yarn.lock": true
},
Expand All @@ -37,5 +38,8 @@
],
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
}
16 changes: 1 addition & 15 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,7 @@
"label": "TSC & Lint & Tests",
"problemMatcher": ["$tsc", "$eslint-stylish"]
},
{
"type": "npm",
"script": "tsc-and-lint",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": true
},
"group": "build",
"label": "TSC & Lint",
"problemMatcher": ["$tsc", "$eslint-stylish"]
},

{
"type": "npm",
"script": "i18n",
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# TODO

- [ ] templates
- [ ] not found route
- [ ] page meta checks
- [ ] full test suit

# [Fari](https://fari.app) - The Free and Open-Source Virtual Tabletop

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
Expand Down Expand Up @@ -50,7 +55,7 @@ If you want to run Fari on your machine, simply run:
bun run dev
```

This will start and bundle the app using [ViteJS](https://vitejs.dev/) and make it available on http://localhost:1234
This will start and bundle the app using [ViteJS](https://vitejs.dev/) and make it available on http://localhost:3000

ViteJS will also update your browser's content (using React Refresh) anytime you do save a file on the disk.

Expand Down
75 changes: 75 additions & 0 deletions app/ThemeRegistry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"use client";
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
import CssBaseline from "@mui/material/CssBaseline";
import { ThemeProvider } from "@mui/material/styles";
import { useServerInsertedHTML } from "next/navigation";
import React, { useContext } from "react";
import { SettingsContext } from "../lib/contexts/SettingsContext/SettingsContext";
import { AppDarkTheme, AppLightTheme } from "../lib/theme";

// This implementation is from emotion-js
// https://github.com/emotion-js/emotion/issues/2928#issuecomment-1319747902
export default function ThemeRegistry(props: {
options: Parameters<typeof createCache>[0];
children: React.ReactNode;
}) {
const settingsManager = useContext(SettingsContext);

const { options, children } = props;

const [{ cache, flush }] = React.useState(() => {
const cache = createCache(options);
cache.compat = true;
const prevInsert = cache.insert;
let inserted: string[] = [];
cache.insert = (...args) => {
const serialized = args[1];
if (cache.inserted[serialized.name] === undefined) {
inserted.push(serialized.name);
}
return prevInsert(...args);
};
const flush = () => {
const prevInserted = inserted;
inserted = [];
return prevInserted;
};
return { cache, flush };
});

useServerInsertedHTML(() => {
const names = flush();
if (names.length === 0) {
return null;
}
let styles = "";
for (const name of names) {
styles += cache.inserted[name];
}
return (
<style
key={cache.key}
data-emotion={`${cache.key} ${names.join(" ")}`}
dangerouslySetInnerHTML={{
__html: styles,
}}
/>
);
});

return (
<CacheProvider value={cache}>
<ThemeProvider
theme={
settingsManager.state.themeMode === "dark"
? AppDarkTheme
: AppLightTheme
}
>
<CssBaseline />
{children}
</ThemeProvider>
</CacheProvider>
);
}
13 changes: 13 additions & 0 deletions app/bugs/[...slugs]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { BugsRoute } from "../../../lib/routes/Bugs/BugsRoute";
import { t } from "../../i18n";

export async function generateMetadata() {
return {
title: t("bugs-route.meta.title"),
description: t("bugs-route.meta.description"),
};
}

export default function BugsPage() {
return <BugsRoute></BugsRoute>;
}
13 changes: 13 additions & 0 deletions app/cards/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { CardCollectionRoute } from "../../../lib/routes/CardCollection/CardCollectionRoute";
import { t } from "../../i18n";

export async function generateMetadata() {
return {
title: t("card-collection-route.meta.title"),
description: t("card-collection-route.meta.description"),
};
}

export default function CardCollectionPage() {
return <CardCollectionRoute></CardCollectionRoute>;
}
Loading
Loading