-
Notifications
You must be signed in to change notification settings - Fork 905
refactor: Migrate from Next.js to pure webpack config #360
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
Merged
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
f87c03e
Remove nextJS as dependency
bryphe-coder d767aa8
Next js config -> webpack config
bryphe-coder e1dbec2
Migrate next/link -> react-router-dom Link
bryphe-coder 6f65f1b
Migrate routing to react-router-dom style; get webpack building
bryphe-coder 69010f8
Hook up workspaces route
bryphe-coder 7800a4e
First round of clean-up
bryphe-coder 7158d75
Get SignInForm tests green
bryphe-coder a58a29d
Get additional tests green
bryphe-coder bc83df6
Get tests green again
bryphe-coder 3c5895c
HMR / live reload updates from FE variety
bryphe-coder b657fe6
Remove export from Makefile temporarily
bryphe-coder 75a38d9
Remove export command
bryphe-coder e4fe1ed
Convert webpack config to typescript
bryphe-coder d9e9d2d
Split out dev vs prod webpack configs
bryphe-coder 02838a2
Remove nextrouter, port over some functionality to embed
bryphe-coder d8c983f
Implement content-addressable (and cache-friendly) bundle name
bryphe-coder 396be38
Start setting up new post-nextrouter routing strategy
bryphe-coder 87be7aa
Fix production webpack config
bryphe-coder 3e1d008
Remove _document
bryphe-coder d1566d3
Remove nested GITKEEP
bryphe-coder bdd966b
Copy static files over
bryphe-coder ac064ca
Fix up dependencies
bryphe-coder c0ca05c
Clean-up
bryphe-coder b85dcf1
Merge main
bryphe-coder 3a724e4
Merge main
bryphe-coder 40a4e69
Use same entry point as v1
bryphe-coder 7f10110
Initial lint fix
bryphe-coder a5a09d5
Move index.html -> html_templates
bryphe-coder 5af2c20
Merge branch 'main' into bryphe/experiment/nextjs-to-webpack
bryphe-coder 3898544
Implement 404 page
bryphe-coder cd07056
Add test case for caching
bryphe-coder 78051ff
Remove now-unused function
bryphe-coder cf8b4e0
Add plumbing to make CSRF token testable
bryphe-coder 8bd5804
Fix todos
bryphe-coder 427672b
Additional test cases
bryphe-coder 929a3b7
Remove now unnecessary test
bryphe-coder f822347
Add test + fix template parameters
bryphe-coder 6c00822
Fix up go lint cases
bryphe-coder 12b0e1d
Remove commented and now-unnecessary export step
bryphe-coder b348b70
Fix Handler -> DefaultHandler
bryphe-coder 07f52d5
Fix remaining lint issues
bryphe-coder 095bcfc
Add webpack-bundle-analyzer + command to run server
bryphe-coder 7b5e982
Better document the webpack files to match the work Grey is doing in v1
bryphe-coder a3f31c9
Update webpack configs
bryphe-coder 4134392
Port over fileoverview comments
bryphe-coder 90f04ab
Remove accidental addition of test collateral
bryphe-coder 6ffd38b
Use <Navigate> component from react-router-dom instead of custom <Red…
bryphe-coder 7a50bc1
Merge main
bryphe-coder b4a18e0
Fix lint issues
bryphe-coder 244e305
Remove build:dev to match v1 suite of webpack build commands
bryphe-coder e65f5af
Remove dev.ts and several references in jest/tsconfig
bryphe-coder 19509bc
Fix copy-paste error with the NotFoundPage
bryphe-coder f4f7cb3
Add descriptive comment for SWR fetching
bryphe-coder 37295ce
Remove unnecessary inline styles
bryphe-coder 02a8718
Remove custom title in HTMLWebpackPlugin
bryphe-coder 6e168a8
Use default settings for HtmlWebpackPlugin for script injection
bryphe-coder 1a600d1
Remove 'noEmit' flag from tsconfig
bryphe-coder cab30cd
Remove dev.ts from tsconfig.test.json
bryphe-coder b725cf8
Format jest file
bryphe-coder 71d076d
Use bundle name as-is for development
bryphe-coder 818fc74
Factor to v1 strategy; get tests passing
bryphe-coder b61d39e
Fix go lint issues
bryphe-coder 8b67328
Add missed meta tag
bryphe-coder 2a183ce
Port over publicPath, needed for the v1 embed strategy
bryphe-coder 037489f
Fix up formatting
bryphe-coder 0b81ab8
Fix compilation error
bryphe-coder 0839201
Update comment
bryphe-coder 685b8f1
Add progress to build:analyze command
bryphe-coder 807ac3b
Tweak comment
bryphe-coder 2d47d8c
Add more logs to playwright
bryphe-coder 861592a
Port over our playwright utilities for client-side nav
bryphe-coder c31f594
Merge branch 'main' into bryphe/experiment/nextjs-to-webpack
bryphe-coder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react" | ||
import ReactDOM from "react-dom" | ||
|
||
import { App } from "./app" | ||
|
||
// This is the entry point for the app - where everything start. | ||
// In the future, we'll likely bring in more bootstrapping logic - | ||
// like: https://github.com/coder/m/blob/50898bd4803df7639bd181e484c74ac5d84da474/product/coder/site/pages/_app.tsx#L32 | ||
const main = () => { | ||
const element = document.getElementById("root") | ||
ReactDOM.render(<App />, element) | ||
} | ||
|
||
main() | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from "react" | ||
import CssBaseline from "@material-ui/core/CssBaseline" | ||
import ThemeProvider from "@material-ui/styles/ThemeProvider" | ||
import { SWRConfig } from "swr" | ||
import { UserProvider } from "./contexts/UserContext" | ||
import { light } from "./theme" | ||
import { BrowserRouter as Router, Route, Routes } from "react-router-dom" | ||
|
||
import { CliAuthenticationPage } from "./pages/cli-auth" | ||
import { NotFoundPage } from "./pages/404" | ||
import { IndexPage } from "./pages/index" | ||
import { SignInPage } from "./pages/login" | ||
import { ProjectsPage } from "./pages/projects" | ||
import { ProjectPage } from "./pages/projects/[organization]/[project]" | ||
import { CreateWorkspacePage } from "./pages/projects/[organization]/[project]/create" | ||
import { WorkspacePage } from "./pages/workspaces/[workspace]" | ||
|
||
export const App: React.FC = () => { | ||
return ( | ||
<Router> | ||
<SWRConfig | ||
value={{ | ||
// This code came from the SWR documentation: | ||
// https://swr.vercel.app/docs/error-handling#status-code-and-error-object | ||
fetcher: async (url: string) => { | ||
const res = await fetch(url) | ||
|
||
// By default, `fetch` won't treat 4xx or 5xx response as errors. | ||
// However, we want SWR to treat these as errors - so if `res.ok` is false, | ||
// we want to throw an error to bubble that up to SWR. | ||
if (!res.ok) { | ||
const err = new Error((await res.json()).error?.message || res.statusText) | ||
throw err | ||
} | ||
return res.json() | ||
}, | ||
}} | ||
> | ||
<UserProvider> | ||
<ThemeProvider theme={light}> | ||
<CssBaseline /> | ||
|
||
<Routes> | ||
<Route path="/"> | ||
<Route index element={<IndexPage />} /> | ||
|
||
<Route path="login" element={<SignInPage />} /> | ||
<Route path="cli-auth" element={<CliAuthenticationPage />} /> | ||
|
||
<Route path="projects"> | ||
<Route index element={<ProjectsPage />} /> | ||
<Route path=":organization/:project"> | ||
bryphe-coder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Route index element={<ProjectPage />} /> | ||
<Route path="create" element={<CreateWorkspacePage />} /> | ||
</Route> | ||
</Route> | ||
|
||
<Route path="workspaces"> | ||
<Route path=":workspace" element={<WorkspacePage />} /> | ||
</Route> | ||
|
||
{/* Using path="*"" means "match anything", so this route | ||
acts like a catch-all for URLs that we don't have explicit | ||
routes for. */} | ||
<Route path="*" element={<NotFoundPage />} /> | ||
</Route> | ||
</Routes> | ||
</ThemeProvider> | ||
</UserProvider> | ||
</SWRConfig> | ||
</Router> | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from "./Button" | ||
export * from "./EmptyState" | ||
export * from "./Page" | ||
export * from "./Redirect" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.