Skip to content

Commit 821d5e3

Browse files
committed
Squashed commit of the following:
commit cda8140 Author: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> Date: Wed Apr 9 10:40:24 2025 +1200 Update base commit 897bcc7 Author: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> Date: Wed Apr 9 10:18:42 2025 +1200 Version script commit d1ad970 Author: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> Date: Wed Apr 9 10:09:19 2025 +1200 Update start script commit dbf5a39 Author: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> Date: Wed Apr 9 10:02:11 2025 +1200 Set output folder commit 126994a Author: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> Date: Wed Apr 9 00:44:00 2025 +1200 Setup Vite
1 parent 9ccc1b7 commit 821d5e3

File tree

11 files changed

+712
-8342
lines changed

11 files changed

+712
-8342
lines changed

demo/public/index.html renamed to demo/index.html

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@
1313

1414

1515
<!-- Standard favicon -->
16-
<link rel="icon" type="image/x-icon" href="%PUBLIC_URL%/favicon.ico">
16+
<link rel="icon" type="image/x-icon" href="/favicon.ico">
1717

1818
<!-- PNG favicons for modern browsers -->
19-
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/image/favicon_16.png">
20-
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/image/favicon_32.png">
21-
<link rel="icon" type="image/png" sizes="96x96" href="%PUBLIC_URL%/image/favicon_96.png">
19+
<link rel="icon" type="image/png" sizes="16x16" href="/image/favicon_16.png">
20+
<link rel="icon" type="image/png" sizes="32x32" href="/image/favicon_32.png">
21+
<link rel="icon" type="image/png" sizes="96x96" href="/image/favicon_96.png">
2222

2323
<!-- Apple Touch Icons -->
24-
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/image/apple-touch-icon.png">
24+
<link rel="apple-touch-icon" sizes="180x180" href="/image/apple-touch-icon.png">
2525

2626
<!-- Android/Chrome -->
27-
<link rel="icon" type="image/png" sizes="192x192" href="%PUBLIC_URL%/image/icon_192.png">
28-
<link rel="icon" type="image/png" sizes="512x512" href="%PUBLIC_URL%/image/icon_512.png">
27+
<link rel="icon" type="image/png" sizes="192x192" href="/image/icon_192.png">
28+
<link rel="icon" type="image/png" sizes="512x512" href="/image/icon_512.png">
2929

3030

31-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
31+
<link rel="apple-touch-icon" href="/logo192.png" />
3232

3333
<!-- Open Graph Tags -->
3434
<meta property="og:title" content="JSON•Edit•React">
@@ -87,32 +87,14 @@
8787
manifest.json provides metadata used when your web app is installed on a
8888
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
8989
-->
90-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
91-
<!--
92-
Notice the use of %PUBLIC_URL% in the tags above.
93-
It will be replaced with the URL of the `public` folder during the build.
94-
Only files inside the `public` folder can be referenced from the HTML.
95-
96-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
97-
work correctly both with client-side routing and a non-root public URL.
98-
Learn how to configure a non-root public URL by running `npm run build`.
99-
-->
90+
<link rel="manifest" href="/manifest.json" />
10091
<script async data-id="%REACT_APP_CLICKY_ID%" src="//static.getclicky.com/js"></script>
10192
</head>
10293

10394
<body>
10495
<noscript>You need to enable JavaScript to run this app.</noscript>
10596
<div id="root"></div>
106-
<!--
107-
This HTML file is a template.
108-
If you open it directly in the browser, you will see an empty page.
109-
110-
You can add webfonts, meta tags, or analytics to this file.
111-
The build step will place the bundled scripts into the <body> tag.
112-
113-
To begin the development, run `npm start` or `yarn start`.
114-
To create a production bundle, use `npm run build` or `yarn build`.
115-
-->
97+
<script type="module" src="/src/index.tsx"></script>
11698
</body>
11799

118100
</html>

demo/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"@testing-library/user-event": "^14.5.2",
1515
"@types/jest": "^29.5.11",
1616
"@types/node": "^20.11.6",
17-
"@types/react": "^18.2.48",
18-
"@types/react-dom": "^18.2.18",
17+
"@types/react": "^19.1.0",
18+
"@types/react-dom": "^19.1.1",
1919
"@uiw/codemirror-theme-console": "^4.23.7",
2020
"@uiw/codemirror-theme-github": "^4.23.7",
2121
"@uiw/codemirror-theme-monokai": "^4.23.7",
@@ -31,19 +31,17 @@
3131
"react-dom": "^18.2.0",
3232
"react-firebase-hooks": "^5.1.1",
3333
"react-icons": "^5.0.1",
34-
"react-scripts": "5.0.1",
35-
"typescript": "^5.3.3",
34+
"typescript": "^5.8.3",
3635
"use-undo": "^1.1.1",
3736
"web-vitals": "^3.5.2",
3837
"wouter": "^3.3.1"
3938
},
4039
"scripts": {
41-
"start": "rimraf ./src/json-edit-react && mkdir ./src/json-edit-react && mkdir ./src/json-edit-react/src && concurrently --kill-others-on-fail \"PORT=3008 react-scripts start\" \"nodemon watch.js\"",
42-
"build": "react-scripts build",
43-
"analyze": "source-map-explorer 'build/static/js/*.js'",
40+
"serve": "vite preview",
41+
"type-check": "tsc --noEmit",
42+
"start": "rimraf ./src/json-edit-react && mkdir ./src/json-edit-react && mkdir ./src/json-edit-react/src && concurrently --kill-others-on-fail \"vite\" \"nodemon watch.js\"",
43+
"build": "tsc && vite build",
4444
"prebuild": "node ./scripts/getVersion.js",
45-
"test": "react-scripts test",
46-
"eject": "react-scripts eject",
4745
"predeploy": "yarn build",
4846
"deploy": "gh-pages -d build"
4947
},
@@ -73,10 +71,12 @@
7371
]
7472
},
7573
"devDependencies": {
74+
"@vitejs/plugin-react": "^4.3.4",
7675
"concurrently": "^8.2.2",
7776
"gh-pages": "^6.1.1",
7877
"node-fetch": "^3.3.2",
7978
"nodemon": "^3.0.3",
80-
"source-map-explorer": "^2.5.3"
79+
"source-map-explorer": "^2.5.3",
80+
"vite": "^6.2.5"
8181
}
8282
}
File renamed without changes.
File renamed without changes.

demo/scripts/getVersion.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ const fs = require('fs')
44
const { version } = pkg
55

66
console.log('Writing version:', version)
7-
fs.writeFileSync('./src/version.ts', `export const version = '${version}'`)
7+
fs.writeFileSync(
8+
'./src/version.ts',
9+
`export const version = '${version}'\nexport const timestamp = '${new Date().toLocaleString(
10+
'en-NZ',
11+
{ timeZone: 'Pacific/Auckland' }
12+
)}'\n`
13+
)

demo/src/App.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ import { ArrowBackIcon, ArrowForwardIcon, InfoIcon } from '@chakra-ui/icons'
5454
import { demoDataDefinitions } from './demoData'
5555
import { useDatabase } from './useDatabase'
5656
import './style.css'
57-
import { version } from './version'
57+
import { timestamp, version } from './version'
5858

5959
const CodeEditor = lazy(() => import('./CodeEditor'))
6060

6161
interface AppState {
6262
rootName: string
6363
indent: number
64-
collapseLevel: number
64+
collapseLevel: number | FilterFunction
6565
collapseTime: number
6666
showCount: 'Yes' | 'No' | 'When closed'
6767
theme: Theme
@@ -87,6 +87,9 @@ const themes = [
8787
psychedelicTheme,
8888
]
8989

90+
console.log(`json-edit-react v${version}`)
91+
console.log('Site built:', timestamp)
92+
9093
function App() {
9194
const navigate = useLocation()[1]
9295
const searchString = useSearch()
@@ -119,7 +122,7 @@ function App() {
119122
// const [triggers, setTriggers] = useState<ExternalTriggers>()
120123

121124
const [isSaving, setIsSaving] = useState(false)
122-
const previousTheme = useRef<Theme>() // Used when resetting after theme editing
125+
const previousTheme = useRef<Theme>(null) // Used when resetting after theme editing
123126
const toast = useToast()
124127

125128
const [isSearchFocused, setIsSearchFocused] = useState(false)

demo/src/version.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const version = '1.25.0'
1+
export const version = '1.25.0'
2+
export const timestamp = '9/04/2025, 10:36:34 am'

demo/tsconfig.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
4-
"lib": ["dom", "dom.iterable", "esnext"],
3+
"target": "ESNext",
4+
"useDefineForClassFields": true,
5+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
56
"allowJs": true,
67
"skipLibCheck": true,
78
"esModuleInterop": true,
89
"allowSyntheticDefaultImports": true,
910
"strict": true,
1011
"forceConsistentCasingInFileNames": true,
11-
"noFallthroughCasesInSwitch": true,
12-
"module": "NodeNext",
13-
"moduleResolution": "NodeNext",
12+
"module": "ESNext",
13+
"moduleResolution": "Node",
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"noEmit": true,
17-
"jsx": "react-jsx"
17+
"jsx": "react-jsx",
18+
"baseUrl": "."
1819
},
19-
"include": ["demo/src"]
20+
"include": ["demo/src"],
21+
"references": [{ "path": "./tsconfig.node.json" }]
2022
}

demo/tsconfig.node.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"module": "ESNext",
5+
"moduleResolution": "Node",
6+
"allowSyntheticDefaultImports": true
7+
},
8+
"include": ["vite.config.ts"]
9+
}

demo/vite.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from 'vite'
2+
import react from '@vitejs/plugin-react'
3+
import path from 'path'
4+
5+
export default defineConfig({
6+
plugins: [react()],
7+
base: 'https://carlosnz.github.io/json-edit-react/',
8+
resolve: {
9+
alias: {
10+
'@': path.resolve(__dirname, './src'),
11+
},
12+
},
13+
server: {
14+
port: 5175,
15+
},
16+
build: {
17+
outDir: 'build',
18+
emptyOutDir: true,
19+
},
20+
})

0 commit comments

Comments
 (0)