Skip to content

Commit 0cfb548

Browse files
committed
Merge branch 'master' into smart-presentations
2 parents a517bbe + 8492b14 commit 0cfb548

File tree

149 files changed

+9862
-6342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+9862
-6342
lines changed

.github/copilot-instructions.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Project coding standards
2+
3+
## Generic Communication Guidelines
4+
5+
- Be succint and be aware that expansive generative AI answers are costly and slow
6+
- Avoid providing explanations, trying to teach unless asked for, your chat partner is an expert
7+
- Stop apologising if corrected, just provide the correct information or code
8+
- Prefer code unless asked for explanation
9+
- Stop summarizing what you've changed after modifications unless asked for
10+
11+
## TypeScript Guidelines
12+
13+
- Use TypeScript for all new code
14+
- Where possible, prefer implementations without allocation
15+
- When there is an option, opt for more performant solutions and trade RAM usage for less CPU cycles
16+
- Prefer immutable data (const, readonly)
17+
- Use optional chaining (?.) and nullish coalescing (??) operators
18+
19+
## React Guidelines
20+
21+
- Use functional components with hooks
22+
- Follow the React hooks rules (no conditional hooks)
23+
- Keep components small and focused
24+
- Use CSS modules for component styling
25+
26+
## Naming Conventions
27+
28+
- Use PascalCase for component names, interfaces, and type aliases
29+
- Use camelCase for variables, functions, and methods
30+
- Use ALL_CAPS for constants
31+
32+
## Error Handling
33+
34+
- Use try/catch blocks for async operations
35+
- Implement proper error boundaries in React components
36+
- Always log errors with contextual information
37+
38+
## Testing
39+
40+
- Always attempt to fix #problems
41+
- Always offer to run `yarn test:app` in the project root after modifications are complete and attempt fixing the issues reported
42+
43+
## Types
44+
45+
- Always include `packages/math/src/types.ts` in the context when your write math related code and always use the Point type instead of { x, y}

.github/workflows/autorelease-excalidraw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
- name: Auto release
2525
run: |
2626
yarn add @actions/core -W
27-
yarn autorelease
27+
yarn release --tag=next --non-interactive

.github/workflows/autorelease-preview.yml

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

.github/workflows/publish-docker.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ jobs:
1717
with:
1818
username: ${{ secrets.DOCKER_USERNAME }}
1919
password: ${{ secrets.DOCKER_PASSWORD }}
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
2024
- name: Build and push
21-
uses: docker/build-push-action@v3
25+
uses: docker/build-push-action@v5
2226
with:
2327
context: .
2428
push: true
2529
tags: excalidraw/excalidraw:latest
30+
platforms: linux/amd64, linux/arm64, linux/arm/v7

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ packages/excalidraw/types
2525
coverage
2626
dev-dist
2727
html
28-
meta*.json
28+
meta*.json
29+
.claude

CLAUDE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# CLAUDE.md
2+
3+
## Project Structure
4+
5+
Excalidraw is a **monorepo** with a clear separation between the core library and the application:
6+
7+
- **`packages/excalidraw/`** - Main React component library published to npm as `@excalidraw/excalidraw`
8+
- **`excalidraw-app/`** - Full-featured web application (excalidraw.com) that uses the library
9+
- **`packages/`** - Core packages: `@excalidraw/common`, `@excalidraw/element`, `@excalidraw/math`, `@excalidraw/utils`
10+
- **`examples/`** - Integration examples (NextJS, browser script)
11+
12+
## Development Workflow
13+
14+
1. **Package Development**: Work in `packages/*` for editor features
15+
2. **App Development**: Work in `excalidraw-app/` for app-specific features
16+
3. **Testing**: Always run `yarn test:update` before committing
17+
4. **Type Safety**: Use `yarn test:typecheck` to verify TypeScript
18+
19+
## Development Commands
20+
21+
```bash
22+
yarn test:typecheck # TypeScript type checking
23+
yarn test:update # Run all tests (with snapshot updates)
24+
yarn fix # Auto-fix formatting and linting issues
25+
```
26+
27+
## Architecture Notes
28+
29+
### Package System
30+
31+
- Uses Yarn workspaces for monorepo management
32+
- Internal packages use path aliases (see `vitest.config.mts`)
33+
- Build system uses esbuild for packages, Vite for the app
34+
- TypeScript throughout with strict configuration

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
FROM node:18 AS build
1+
FROM --platform=${BUILDPLATFORM} node:18 AS build
22

33
WORKDIR /opt/node_app
44

55
COPY . .
66

77
# do not ignore optional dependencies:
88
# Error: Cannot find module @rollup/rollup-linux-x64-gnu
9-
RUN yarn --network-timeout 600000
9+
RUN --mount=type=cache,target=/root/.cache/yarn \
10+
npm_config_target_arch=${TARGETARCH} yarn --network-timeout 600000
1011

1112
ARG NODE_ENV=production
1213

13-
RUN yarn build:app:docker
14+
RUN npm_config_target_arch=${TARGETARCH} yarn build:app:docker
1415

15-
FROM nginx:1.27-alpine
16+
FROM --platform=${TARGETPLATFORM} nginx:1.27-alpine
1617

1718
COPY --from=build /opt/node_app/excalidraw-app/build /usr/share/nginx/html
1819

dev-docs/docs/@excalidraw/excalidraw/api/props/excalidraw-api.mdx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,21 +363,15 @@ This API has the below signature. It sets the `tool` passed in param as the acti
363363
```ts
364364
(
365365
tool: (
366-
| (
367-
| { type: Exclude<ToolType, "image"> }
368-
| {
369-
type: Extract<ToolType, "image">;
370-
insertOnCanvasDirectly?: boolean;
371-
}
372-
)
366+
| { type: ToolType }
373367
| { type: "custom"; customType: string }
374368
) & { locked?: boolean },
375369
) => {};
376370
```
377371

378372
| Name | Type | Default | Description |
379373
| --- | --- | --- | --- |
380-
| `type` | [ToolType](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L91) | `selection` | The tool type which should be set as active tool. When setting `image` as active tool, the insertion onto canvas when using image tool is disabled by default, so you can enable it by setting `insertOnCanvasDirectly` to `true` |
374+
| `type` | [ToolType](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L91) | `selection` | The tool type which should be set as active tool |
381375
| `locked` | `boolean` | `false` | Indicates whether the the active tool should be locked. It behaves the same way when using the `lock` tool in the editor interface |
382376

383377
## setCursor

dev-docs/docs/@excalidraw/excalidraw/development.mdx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,12 @@ To start the example app using the `@excalidraw/excalidraw` package, follow the
2828

2929
## Releasing
3030

31-
### Create a test release
32-
33-
You can create a test release by posting the below comment in your pull request:
34-
35-
```bash
36-
@excalibot trigger release
37-
```
38-
39-
Once the version is released `@excalibot` will post a comment with the release version.
40-
4131
### Creating a production release
4232

4333
To release the next stable version follow the below steps:
4434

4535
```bash
46-
yarn prerelease:excalidraw
36+
yarn release --tag=latest --version=0.19.0
4737
```
4838

49-
You need to pass the `version` for which you want to create the release. This will make the changes needed before making the release like updating `package.json`, `changelog` and more.
50-
51-
The next step is to run the `release` script:
52-
53-
```bash
54-
yarn release:excalidraw
55-
```
56-
57-
This will publish the package.
58-
59-
Right now there are two steps to create a production release but once this works fine these scripts will be combined and more automation will be done.
39+
You will need to pass the `latest` tag with `version` for which you want to create the release. This will make the changes needed before publishing the packages into NPM, like updating dependencies of all `@excalidraw/*` packages, generating new entries in `CHANGELOG.md` and more.

dev-docs/docs/@excalidraw/excalidraw/integration.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ If you want to only import `Excalidraw` component you can do :point_down:
3838

3939
```jsx showLineNumbers
4040
import dynamic from "next/dynamic";
41+
import "@excalidraw/excalidraw/index.css";
42+
4143
const Excalidraw = dynamic(
4244
async () => (await import("@excalidraw/excalidraw")).Excalidraw,
4345
{

0 commit comments

Comments
 (0)