Skip to content

Commit 1d9f865

Browse files
authored
Cleaned up code (#32)
1 parent a965650 commit 1d9f865

24 files changed

+52
-27
lines changed

.github/workflows/example.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ jobs:
7474
'reponame=react-example'
7575
--data
7676
'description=React app example ⚛️'
77+
--data
78+
'paths=false'
7779
# Create archive to retain file permissions
7880
- name: Create archive
7981
run: >

copier.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ port:
3232
help: The port on which the app will listen
3333
default: 5173
3434

35+
paths:
36+
type: bool
37+
help: Whether you can use paths in the URL
38+
default: true
39+
40+
keyprefix:
41+
type: str
42+
help: The prefix for various keys used in the app (e.g. for storage)
43+
default: "{{ appname | lower | replace('_', '-') }}"
44+
3545
pages:
3646
type: str
3747
help: What you want to host on GitHub Pages

src/.envrc.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# reload when these files change
4-
watch_file flake.lock ./*.nix package.json package-lock.json Taskfile.dist.yaml {taskfile,Taskfile}.{yaml,yml}
4+
watch_file flake.lock ./*.nix
55

66
# activate the default development shell in the current shell
77
# --accept-flake-config will accept the nix configuration from the flake without prompting

src/.eslintrc.cjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
22
env: {
3-
// Set ES2022 environment
4-
es2022: true,
5-
63
// Support browser globals
74
browser: true,
85

6+
// Set ES2022 environment
7+
es2022: true,
8+
99
// Support node globals
1010
node: true,
1111
},
@@ -41,6 +41,12 @@ module.exports = {
4141
root: true,
4242

4343
rules: {
44+
// Allow anonymous default exports
45+
"import/no-anonymous-default-export": "off",
46+
47+
// Allow empty block statements
48+
"no-empty": "off",
49+
4450
// Allow empty destructuring patterns
4551
"no-empty-pattern": "off",
4652

src/Taskfile.dist.yaml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ tasks:
199199
desc: Build outputs
200200
internal: true
201201
sources:
202-
- src/**/*
203202
- public/**/*
203+
- src/**/*
204204
- flake.lock
205205
- "*.nix"
206206
- index.html

src/src/Router.tsx renamed to src/src/Router.tsx.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { RouterProvider, createHashRouter } from "react-router-dom";
1+
import { RouterProvider, {{ 'createBrowserRouter' if pages else 'createHashRouter' }} } from "react-router-dom";
22
import { ErrorPage, IndexPage, NotFoundPage, Root } from "./pages";
33

4-
const router = createHashRouter(
4+
const router = {{ 'createBrowserRouter' if pages else 'createHashRouter' }}(
55
[
66
{
77
path: "/",

src/src/config/constants.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/src/config/constants.ts.jinja

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const colorSchemeStorageKey = "{{ keyprefix }}-color-scheme";
2+
export const defaultColorScheme = "auto";
3+
export const stateStorageKey = "{{ keyprefix }}-state";

0 commit comments

Comments
 (0)