Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/forbid-todo.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/test-docs.yml

This file was deleted.

19 changes: 16 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand All @@ -31,6 +30,22 @@ jobs:
- name: Lint
run: pnpm --color lint

- name: Forbid TODO
run: ./scripts/forbid-todo.sh

build-website:
name: Build Website
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Node.js
uses: ./.github/actions/setup-node

- name: Build website
run: bash -x scripts/build-and-assemble-website.sh
Comment thread
AndreasArvidsson marked this conversation as resolved.

test-main:
name: Test
strategy:
Expand All @@ -46,7 +61,6 @@ jobs:
APP_VERSION: ${{ matrix.app_version }}
VSCODE_CRASH_DIR: ${{ github.workspace }}/artifacts/dumps
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs

steps:
- name: Git config
run: git config --global core.autocrlf false
Expand Down Expand Up @@ -139,7 +153,6 @@ jobs:
test-neovim:
name: Test Neovim
runs-on: ubuntu-latest

steps:
- name: Git config
run: git config --global core.autocrlf false
Expand Down
3 changes: 3 additions & 0 deletions netlify.toml
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"
2 changes: 1 addition & 1 deletion packages/cheatsheet-local/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
document.cheatsheetInfo = __FAKE_CHEATSHEET_INFO__;
</script>
</head>
<body class="__BODY_CLASSES__">
<body>
<div id="root"></div>
<script type="module" src="./src/index.tsx"></script>
</body>
Expand Down
1 change: 1 addition & 0 deletions packages/cheatsheet-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"dependencies": {
"@cursorless/cheatsheet": "workspace:*",
"@cursorless/common": "workspace:*",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"tslib": "^2.8.1"
Expand Down
3 changes: 1 addition & 2 deletions packages/cheatsheet-local/src/app/app.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { render } from "@testing-library/react";

import App from "./app";
import { App } from "./app";

describe("App", () => {
it("should render successfully", () => {
Expand Down
4 changes: 1 addition & 3 deletions packages/cheatsheet-local/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CheatsheetInfo } from "@cursorless/cheatsheet";
import { CheatsheetPage } from "@cursorless/cheatsheet";
import "../styles.css";
import "./styles.css";

declare global {
interface Document {
Expand All @@ -18,5 +18,3 @@ declare global {
export function App() {
return <CheatsheetPage cheatsheetInfo={document.cheatsheetInfo} />;
}

export default App;
3 changes: 3 additions & 0 deletions packages/cheatsheet-local/src/app/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import "tailwindcss";

@config "../../tailwind.config.mjs";
3 changes: 1 addition & 2 deletions packages/cheatsheet-local/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { StrictMode } from "react";
import * as ReactDOM from "react-dom/client";

import App from "./app/app";
import { App } from "./app/app";

const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement,
Expand Down
3 changes: 0 additions & 3 deletions packages/cheatsheet-local/src/styles.css

This file was deleted.

3 changes: 3 additions & 0 deletions packages/cheatsheet-local/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"references": [
{
"path": "../cheatsheet"
},
{
"path": "../common"
}
],
"include": [
Expand Down
36 changes: 10 additions & 26 deletions packages/cheatsheet-local/vite.config.ts
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),
);
},
};
}
6 changes: 2 additions & 4 deletions packages/cheatsheet/src/index.ts
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";
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ import CheatsheetNotesComponent from "./components/CheatsheetNotesComponent";
import SmartLink from "./components/SmartLink";
import type { CheatsheetInfo } from "./CheatsheetInfo";

type CheatsheetPageProps = {
type Props = {
cheatsheetInfo: CheatsheetInfo;
};

export const CheatsheetPage: React.FC<CheatsheetPageProps> = ({
cheatsheetInfo,
}) => {
export function CheatsheetPage({ cheatsheetInfo }: Props) {
return (
<main className="dark:text-stone-100">
<h1 className="mt-2 mb-1 text-center text-2xl md:text-3xl xl:mt-4">
<main className="min-h-screen bg-stone-50 pt-2 xl:pt-4 dark:bg-stone-800 dark:text-stone-100">
<h1 className="mb-1 text-center text-2xl md:text-3xl">
Cursorless Cheatsheet{" "}
<span className="inline-block align-middle text-sm">
<SmartLink to="#legend">
Expand All @@ -35,36 +33,36 @@ export const CheatsheetPage: React.FC<CheatsheetPageProps> = ({
<Cheatsheet cheatsheetInfo={cheatsheetInfo} />
</main>
);
};

type CheatsheetProps = {
cheatsheetInfo: CheatsheetInfo;
};
}

const Cheatsheet: React.FC<CheatsheetProps> = ({ cheatsheetInfo }) => (
<div className="columns-1 gap-2 p-2 md:columns-2 md:gap-3 md:p-3 xl:mx-auto xl:max-w-[1600px] xl:columns-3 xl:gap-4 xl:p-4">
{cheatsheetInfo.sections
.filter((section) => section.items.length > 0)
.map((section) => (
<CheatsheetSection key={section.id}>
<CheatsheetListComponent section={section} />
</CheatsheetSection>
))}
<CheatsheetSection>
<CheatsheetLegendComponent data={cheatsheetLegend} />
</CheatsheetSection>
<CheatsheetSection>
<CheatsheetNotesComponent />
</CheatsheetSection>
</div>
);
function Cheatsheet({ cheatsheetInfo }: Props) {
return (
<div className="columns-1 gap-2 p-2 md:columns-2 md:gap-3 md:p-3 xl:mx-auto xl:max-w-[1600px] xl:columns-3 xl:gap-4 xl:p-4">
{cheatsheetInfo.sections
.filter((section) => section.items.length > 0)
.map((section) => (
<CheatsheetSection key={section.id}>
<CheatsheetListComponent section={section} />
</CheatsheetSection>
))}
<CheatsheetSection>
<CheatsheetLegendComponent data={cheatsheetLegend} />
</CheatsheetSection>
<CheatsheetSection>
<CheatsheetNotesComponent />
</CheatsheetSection>
</div>
);
}

type CheatsheetSectionProps = {
children?: React.ReactNode;
};

const CheatsheetSection: React.FC<CheatsheetSectionProps> = ({ children }) => (
<section className="mb-5 break-inside-avoid last:mb-0 md:mb-3 xl:mb-4">
{children}
</section>
);
function CheatsheetSection({ children }: CheatsheetSectionProps) {
return (
<section className="mb-5 break-inside-avoid last:mb-0 md:mb-3 xl:mb-4">
{children}
</section>
);
}
3 changes: 1 addition & 2 deletions packages/cheatsheet/src/lib/cheatsheet.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { render } from "@testing-library/react";

import { CheatsheetPage } from "./cheatsheet";
import { CheatsheetPage } from "./CheatsheetPage";
import { fakeCheatsheetInfo } from "./fakeCheatsheetInfo";

describe("Cheatsheet", () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/cheatsheet/src/lib/cheatsheetBodyClasses.tsx

This file was deleted.

1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ export * from "./util/type";
export * from "./util/typeUtils";
export * from "./util/uniqWithHash";
export * from "./util/zipStrict";
export * from "./viteHtmlParamsPlugin";
17 changes: 17 additions & 0 deletions packages/common/src/viteHtmlParamsPlugin.ts
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;
},
};
}
30 changes: 0 additions & 30 deletions packages/cursorless-org/eslintConfig.ts
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",
},
},
};
Loading
Loading