-
-
Notifications
You must be signed in to change notification settings - Fork 93
Replace Next with Vite #3220
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
Replace Next with Vite #3220
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a922f0c
remove old
AndreasArvidsson e791308
update
AndreasArvidsson 167c9f1
fix
AndreasArvidsson e901658
Use @svgr
AndreasArvidsson ad32a16
Cleanup#
AndreasArvidsson a76c90d
fix
AndreasArvidsson 0e8a312
fix
AndreasArvidsson 382e7fe
Fix background color
AndreasArvidsson cb60504
Format warning log messages
AndreasArvidsson 797a23f
lint
AndreasArvidsson 11a53a3
Add public
AndreasArvidsson 22adedc
Move forbid-todo.yml to test.yml
AndreasArvidsson 5036757
Move seo parameters to index.html and add plugin to replace them
AndreasArvidsson c3611f9
Fix forbid to do
AndreasArvidsson bd76d9b
Update router
AndreasArvidsson e2e9f98
Added redirect rules
AndreasArvidsson 7ff1765
Try directs file
AndreasArvidsson 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| # Netlify configuration file for building and deploying the Cursorless website. | ||
| # Read by Netlify GitHub app. | ||
|
|
||
| [build] | ||
| command = "./scripts/build-and-assemble-website.sh" | ||
| publish = "dist/cursorless-org" |
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @import "tailwindcss"; | ||
|
|
||
| @config "../../tailwind.config.mjs"; |
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 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 |
|---|---|---|
|
|
@@ -15,6 +15,9 @@ | |
| "references": [ | ||
| { | ||
| "path": "../cheatsheet" | ||
| }, | ||
| { | ||
| "path": "../common" | ||
| } | ||
| ], | ||
| "include": [ | ||
|
|
||
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,37 +1,21 @@ | ||
| import { | ||
| cheatsheetBodyClasses, | ||
| fakeCheatsheetInfo, | ||
| } from "@cursorless/cheatsheet"; | ||
| import { fakeCheatsheetInfo } from "@cursorless/cheatsheet"; | ||
| import { viteHtmlParams } from "@cursorless/common"; | ||
| import react from "@vitejs/plugin-react"; | ||
| import { defineConfig, type PluginOption } from "vite"; | ||
| import { defineConfig } from "vite"; | ||
| import { viteSingleFile } from "vite-plugin-singlefile"; | ||
|
|
||
| export default defineConfig(() => { | ||
| return { | ||
| build: { | ||
| outDir: "dist", | ||
|
|
||
| rollupOptions: { | ||
| input: { | ||
| index: "./index.html", | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| plugins: [react(), viteSingleFile(), injectCheatsheetTemplateData()], | ||
| plugins: [ | ||
| react(), | ||
| viteSingleFile(), | ||
| viteHtmlParams({ | ||
| FAKE_CHEATSHEET_INFO: JSON.stringify(fakeCheatsheetInfo), | ||
| }), | ||
| ], | ||
| }; | ||
| }); | ||
|
|
||
| function injectCheatsheetTemplateData(): PluginOption { | ||
| return { | ||
| name: "inject-cheatsheet-template-data", | ||
| transformIndexHtml(html) { | ||
| return html | ||
| .replaceAll("__BODY_CLASSES__", cheatsheetBodyClasses) | ||
| .replaceAll( | ||
| "__FAKE_CHEATSHEET_INFO__", | ||
| JSON.stringify(fakeCheatsheetInfo), | ||
| ); | ||
| }, | ||
| }; | ||
| } |
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,6 +1,4 @@ | ||
| export * from "./lib/cheatsheet"; | ||
| export * from "./lib/cheatsheetBodyClasses"; | ||
| export * from "./lib/CheatsheetPage"; | ||
| export * from "./lib/CheatsheetInfo"; | ||
| export * from "./lib/fakeCheatsheetInfo"; | ||
| import defaultCheatsheetInfo from "./lib/sampleSpokenFormInfos/defaults.json"; | ||
| export { defaultCheatsheetInfo }; | ||
| export { default as defaultCheatsheetInfo } from "./lib/sampleSpokenFormInfos/defaults.json"; |
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export function viteHtmlParams(params: Record<string, string>) { | ||
| return { | ||
| name: "vite-html-params", | ||
| enforce: "post", | ||
|
|
||
| transformIndexHtml(html: string): string { | ||
| for (const [key, value] of Object.entries(params)) { | ||
| const pattern = `__${key}__`; | ||
| if (!html.includes(pattern)) { | ||
| throw new Error(`Expected index.html to contain pattern ${pattern}`); | ||
| } | ||
| html = html.replaceAll(pattern, value); | ||
| } | ||
| return html; | ||
| }, | ||
| }; | ||
| } |
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,40 +1,10 @@ | ||
| import { fixupPluginRules } from "@eslint/compat"; | ||
| import type { ConfigWithExtends } from "@eslint/config-helpers"; | ||
| import nextVitals from "eslint-config-next/core-web-vitals"; | ||
| import tsEslint from "typescript-eslint"; | ||
|
|
||
| const nextVitalsCompat = nextVitals.map((config) => { | ||
| if (config.plugins == null) { | ||
| return config; | ||
| } | ||
|
|
||
| const plugins = { ...config.plugins }; | ||
|
|
||
| // The Next.js ESLint config includes the `react` plugin which is not compatible with eslint 10. | ||
| if (plugins.react != null) { | ||
| plugins.react = fixupPluginRules(plugins.react); | ||
| } | ||
|
|
||
| // The Next.js ESLint config includes the `import` plugin, which conflicts with our own import plugin in the root configuration. | ||
| if (plugins.import != null) { | ||
| delete plugins.import; | ||
| } | ||
|
|
||
| return { ...config, plugins }; | ||
| }); | ||
|
|
||
| export const cursorlessOrgConfig: ConfigWithExtends = { | ||
| files: ["packages/cursorless-org/**/*"], | ||
|
|
||
| extends: nextVitalsCompat, | ||
|
|
||
| languageOptions: { | ||
| parser: tsEslint.parser, | ||
| }, | ||
|
|
||
| settings: { | ||
| next: { | ||
| rootDir: "packages/cursorless-org", | ||
| }, | ||
| }, | ||
| }; |
Oops, something went wrong.
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.