mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-28 16:19:32 +03:00
69 files changed
+25241
-19542
No files matched your search
@@ -3,3 +3,8 @@ FROM node:24-bullseye
|
||||
# Vite wants to open the browser using `open`, so we
|
||||
# need to install those utils.
|
||||
RUN apt update -y && apt install -y xdg-utils
|
||||
|
||||
# pnpm is provided by corepack, at the version pinned by "packageManager" in
|
||||
# package.json
|
||||
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
RUN corepack enable
|
||||
@@ -3,7 +3,7 @@
|
||||
"setupTasks": [
|
||||
{
|
||||
"name": "Install Dependencies",
|
||||
"command": "yarn install"
|
||||
"command": "pnpm install"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -11,22 +11,22 @@
|
||||
"tasks": {
|
||||
"build": {
|
||||
"name": "Build",
|
||||
"command": "yarn build",
|
||||
"command": "pnpm build",
|
||||
"runAtStart": false
|
||||
},
|
||||
"fix": {
|
||||
"name": "Fix",
|
||||
"command": "yarn fix",
|
||||
"command": "pnpm fix",
|
||||
"runAtStart": false
|
||||
},
|
||||
"prettier": {
|
||||
"name": "Prettify",
|
||||
"command": "yarn prettier",
|
||||
"command": "pnpm prettier",
|
||||
"runAtStart": false
|
||||
},
|
||||
"start": {
|
||||
"name": "Start Excalidraw",
|
||||
"command": "yarn start",
|
||||
"command": "pnpm start",
|
||||
"runAtStart": true,
|
||||
"preview": {
|
||||
"port": 3000
|
||||
@@ -34,14 +34,14 @@
|
||||
},
|
||||
"test": {
|
||||
"name": "Run Tests",
|
||||
"command": "yarn test",
|
||||
"command": "pnpm test",
|
||||
"runAtStart": false
|
||||
},
|
||||
"install-deps": {
|
||||
"name": "Install Dependencies",
|
||||
"command": "yarn install",
|
||||
"command": "pnpm install",
|
||||
"restartOn": {
|
||||
"files": ["yarn.lock"],
|
||||
"files": ["pnpm-lock.yaml"],
|
||||
"branch": false,
|
||||
"resume": false
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,11 +6,12 @@
|
||||
!.prettierrc
|
||||
!excalidraw-app/
|
||||
!package.json
|
||||
!pnpm-lock.yaml
|
||||
!pnpm-workspace.yaml
|
||||
!public/
|
||||
!packages/
|
||||
!scripts/
|
||||
!tsconfig.json
|
||||
!yarn.lock
|
||||
|
||||
# keep (sub)sub directories at the end to exclude from explicit included
|
||||
# e.g. ./packages/excalidraw/{dist,node_modules}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
# When "true", testing-library failures (waitFor / getBy*) include the full
|
||||
# serialized DOM in the error message. It's off by default because it's noisy.
|
||||
#
|
||||
# Flip it to "true" (or use `VITE_DEBUG_DOM=true yarn test`) when you need to
|
||||
# Flip it to "true" (or use `VITE_DEBUG_DOM=true pnpm test`) when you need to
|
||||
# inspect the DOM of a failing test.
|
||||
VITE_DEBUG_DOM=false
|
||||
@@ -38,7 +38,7 @@
|
||||
## Testing
|
||||
|
||||
- Always attempt to fix #problems
|
||||
- Always offer to run `yarn test:app` in the project root after modifications are complete and attempt fixing the issues reported
|
||||
- Always offer to run `pnpm test:app` in the project root after modifications are complete and attempt fixing the issues reported
|
||||
|
||||
## Types
|
||||
|
||||
|
||||
@@ -12,10 +12,13 @@ jobs:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
- name: Set up publish access
|
||||
run: |
|
||||
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
|
||||
@@ -23,5 +26,5 @@ jobs:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- name: Auto release
|
||||
run: |
|
||||
yarn add @actions/core -W
|
||||
yarn release --tag=next --non-interactive
|
||||
pnpm add -w @actions/core
|
||||
pnpm release --tag=next --non-interactive
|
||||
@@ -9,14 +9,17 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
|
||||
- name: Install and lint
|
||||
run: |
|
||||
yarn install
|
||||
yarn test:other
|
||||
yarn test:code
|
||||
yarn test:typecheck
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm test:other
|
||||
pnpm test:code
|
||||
pnpm test:typecheck
|
||||
@@ -14,6 +14,8 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
@@ -21,7 +23,7 @@ jobs:
|
||||
|
||||
- name: Create report file
|
||||
run: |
|
||||
yarn locales-coverage
|
||||
pnpm locales-coverage
|
||||
FILE_CHANGED=$(git diff packages/excalidraw/locales/percentages.json)
|
||||
if [ ! -z "${FILE_CHANGED}" ]; then
|
||||
git config --global user.name 'Excalidraw Bot'
|
||||
@@ -33,7 +35,7 @@ jobs:
|
||||
- name: Construct comment body
|
||||
id: getCommentBody
|
||||
run: |
|
||||
body=$(npm run locales-coverage:description | grep '^[^>]')
|
||||
body=$(pnpm --silent locales-coverage:description | grep '^[^>]')
|
||||
body="${body//'%'/'%25'}"
|
||||
body="${body//$'\n'/'%0A'}"
|
||||
body="${body//$'\r'/'%0D'}"
|
||||
|
||||
@@ -10,14 +10,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
- name: Install and build
|
||||
run: |
|
||||
yarn --frozen-lockfile
|
||||
yarn build:app
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build:app
|
||||
env:
|
||||
CI: true
|
||||
- name: Install Sentry
|
||||
|
||||
@@ -11,12 +11,15 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
- name: Install in packages/excalidraw
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
working-directory: packages/excalidraw
|
||||
env:
|
||||
CI: true
|
||||
|
||||
@@ -22,14 +22,17 @@ jobs:
|
||||
environment: stats
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
- name: Install
|
||||
run: yarn install --frozen-lockfile
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: Build with bundle stats
|
||||
run: yarn stats:bundle
|
||||
run: pnpm stats:bundle
|
||||
env:
|
||||
VITE_APP_GIT_SHA: ${{ github.sha }}
|
||||
VITE_APP_ENABLE_ESLINT: "false"
|
||||
@@ -55,16 +58,19 @@ jobs:
|
||||
- name: Fetch the commit before the push
|
||||
if: env.BEFORE
|
||||
run: git fetch --no-tags --depth=1 origin "$BEFORE"
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
- name: Install
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
npx playwright install --with-deps chromium
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm exec playwright install --with-deps chromium
|
||||
- name: Measure this commit and the one before it
|
||||
run: yarn stats:compare --base "${BEFORE:-HEAD^}" --iterations 6 --out perf.json
|
||||
run: pnpm stats:compare --base "${BEFORE:-HEAD^}" --iterations 6 --out perf.json
|
||||
- name: Post to the Excalidraw+ admin
|
||||
run: node scripts/stats/post.mjs perf perf.json
|
||||
env:
|
||||
|
||||
@@ -11,14 +11,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: "Install Node"
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
cache: pnpm
|
||||
- name: "Install Deps"
|
||||
run: yarn install
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: "Test Coverage"
|
||||
run: yarn test:coverage
|
||||
run: pnpm test:coverage
|
||||
- name: "Report Coverage"
|
||||
if: always() # Also generate the report if tests are failing
|
||||
uses: davelosert/vitest-coverage-report-action@2500dafcee7dd64f85ab689c0b83798a8359770e # v2
|
||||
|
||||
@@ -9,11 +9,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: pnpm
|
||||
- name: Install and test
|
||||
run: |
|
||||
yarn install
|
||||
yarn test:app
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm test:app
|
||||
+1
-3
@@ -9,7 +9,6 @@
|
||||
.idea
|
||||
.vercel
|
||||
.vscode
|
||||
.yarn
|
||||
*.log
|
||||
*.tgz
|
||||
build
|
||||
@@ -19,8 +18,7 @@ logs
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
package-lock.json
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
packages/excalidraw/types
|
||||
coverage
|
||||
dev-dist
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
# yarn lint-staged
|
||||
# pnpm lint-staged
|
||||
@@ -13,22 +13,22 @@ Excalidraw is a **monorepo** with a clear separation between the core library an
|
||||
|
||||
1. **Package Development**: Work in `packages/*` for editor features
|
||||
2. **App Development**: Work in `excalidraw-app/` for app-specific features
|
||||
3. **Testing**: Always run `yarn test:update` before committing
|
||||
4. **Type Safety**: Use `yarn test:typecheck` to verify TypeScript
|
||||
3. **Testing**: Always run `pnpm test:update` before committing
|
||||
4. **Type Safety**: Use `pnpm test:typecheck` to verify TypeScript
|
||||
|
||||
## Development Commands
|
||||
|
||||
```bash
|
||||
yarn test:typecheck # TypeScript type checking
|
||||
yarn test:update # Run all tests (with snapshot updates)
|
||||
yarn fix # Auto-fix formatting and linting issues
|
||||
pnpm test:typecheck # TypeScript type checking
|
||||
pnpm test:update # Run all tests (with snapshot updates)
|
||||
pnpm fix # Auto-fix formatting and linting issues
|
||||
```
|
||||
|
||||
## Architecture Notes
|
||||
|
||||
### Package System
|
||||
|
||||
- Uses Yarn workspaces for monorepo management
|
||||
- Uses pnpm workspaces for monorepo management
|
||||
- Internal packages use path aliases (see `vitest.config.mts`)
|
||||
- Build system uses esbuild for packages, Vite for the app
|
||||
- TypeScript throughout with strict configuration
|
||||
+13
-3
@@ -2,16 +2,26 @@ FROM --platform=${BUILDPLATFORM} node:24@sha256:8530f76a96d88820d288761f022e3189
|
||||
|
||||
WORKDIR /opt/node_app
|
||||
|
||||
# pnpm is provided by corepack, at the version pinned by "packageManager" in
|
||||
# package.json
|
||||
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
RUN corepack enable
|
||||
|
||||
COPY . .
|
||||
|
||||
# do not ignore optional dependencies:
|
||||
# Error: Cannot find module @rollup/rollup-linux-x64-gnu
|
||||
RUN --mount=type=cache,target=/root/.cache/yarn \
|
||||
npm_config_target_arch=${TARGETARCH} yarn --frozen-lockfile --network-timeout 600000
|
||||
#
|
||||
# the pnpm store lives in a cache mount, so packages are copied (not linked)
|
||||
# into node_modules
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
|
||||
npm_config_target_arch=${TARGETARCH} pnpm install --frozen-lockfile \
|
||||
--store-dir /pnpm/store --package-import-method copy \
|
||||
--config.fetch-timeout=600000
|
||||
|
||||
ARG NODE_ENV=production
|
||||
|
||||
RUN npm_config_target_arch=${TARGETARCH} yarn build:app:docker
|
||||
RUN npm_config_target_arch=${TARGETARCH} pnpm build:app:docker
|
||||
|
||||
FROM nginx:stable-alpine-slim@sha256:2c605dbeab79a6b2a63340474fe58119d0ef95bdc4b1f41df0aa689659b3d13b
|
||||
|
||||
|
||||
@@ -84,12 +84,14 @@ We'll be adding these features as drop-in plugins for the npm package in the fut
|
||||
|
||||
**Note:** following instructions are for installing the Excalidraw [npm package](https://www.npmjs.com/package/@excalidraw/excalidraw) when integrating Excalidraw into your own app. To run the repository locally for development, please refer to our [Development Guide](https://docs.excalidraw.com/docs/introduction/development).
|
||||
|
||||
Use `npm` or `yarn` to install the package.
|
||||
Use `npm`, `yarn` or `pnpm` to install the package.
|
||||
|
||||
```bash
|
||||
npm install react react-dom @excalidraw/excalidraw
|
||||
# or
|
||||
yarn add react react-dom @excalidraw/excalidraw
|
||||
# or
|
||||
pnpm add react react-dom @excalidraw/excalidraw
|
||||
```
|
||||
|
||||
Check out our [documentation](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/installation) for more details!
|
||||
|
||||
+1
-2
@@ -16,5 +16,4 @@
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
+5
-5
@@ -7,13 +7,13 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern sta
|
||||
### Installation
|
||||
|
||||
```
|
||||
$ yarn
|
||||
$ pnpm install
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
$ yarn start
|
||||
$ pnpm start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
@@ -21,7 +21,7 @@ This command starts a local development server and opens up a browser window. Mo
|
||||
### Build
|
||||
|
||||
```
|
||||
$ yarn build
|
||||
$ pnpm build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
@@ -31,13 +31,13 @@ This command generates static content into the `build` directory and can be serv
|
||||
Using SSH:
|
||||
|
||||
```
|
||||
$ USE_SSH=true yarn deploy
|
||||
$ USE_SSH=true pnpm run deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
$ GIT_USER=<Your GitHub username> pnpm run deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
@@ -13,13 +13,13 @@ To start the example app using the `@excalidraw/excalidraw` package, follow the
|
||||
1. Install the dependencies
|
||||
|
||||
```bash
|
||||
yarn
|
||||
pnpm install
|
||||
```
|
||||
|
||||
2. Start the example app
|
||||
|
||||
```bash
|
||||
yarn start:example
|
||||
pnpm start:example
|
||||
```
|
||||
|
||||
[http://localhost:3001](http://localhost:3001) will open in your default browser.
|
||||
@@ -33,7 +33,7 @@ To start the example app using the `@excalidraw/excalidraw` package, follow the
|
||||
To release the next stable version follow the below steps:
|
||||
|
||||
```bash
|
||||
yarn release --tag=latest --version=0.19.0
|
||||
pnpm release --tag=latest --version=0.19.0
|
||||
```
|
||||
|
||||
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.
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
**Excalidraw** is exported as a component to be directly embedded in your project.
|
||||
|
||||
Use `npm` or `yarn` to install the package.
|
||||
Use `npm`, `yarn` or `pnpm` to install the package.
|
||||
|
||||
```bash
|
||||
npm install react react-dom @excalidraw/excalidraw
|
||||
# or
|
||||
yarn add react react-dom @excalidraw/excalidraw
|
||||
# or
|
||||
pnpm add react react-dom @excalidraw/excalidraw
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
@@ -29,6 +29,12 @@ Using `yarn`
|
||||
yarn add @excalidraw/mermaid-to-excalidraw
|
||||
```
|
||||
|
||||
Using `pnpm`
|
||||
|
||||
```bash
|
||||
pnpm add @excalidraw/mermaid-to-excalidraw
|
||||
```
|
||||
|
||||
### Run the playground server
|
||||
|
||||
```bash
|
||||
|
||||
@@ -14,6 +14,12 @@ Using `yarn`
|
||||
yarn add @excalidraw/mermaid-to-excalidraw
|
||||
```
|
||||
|
||||
Using `pnpm`
|
||||
|
||||
```bash
|
||||
pnpm add @excalidraw/mermaid-to-excalidraw
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Once the library is installed, its ready to use.
|
||||
|
||||
@@ -10,7 +10,7 @@ In case you want to pick up something from the roadmap, comment on that issue an
|
||||
## Setup
|
||||
|
||||
1. Fork and clone the repo
|
||||
1. Run `yarn` to install dependencies
|
||||
1. Run `pnpm install` to install dependencies
|
||||
1. Create a branch for your PR with `git checkout -b your-branch-name`
|
||||
|
||||
> To keep `master` branch pointing to remote repository and make pull requests from branches on your fork, run:
|
||||
|
||||
@@ -7,7 +7,7 @@ These instructions will get you a copy of the project up and running on your loc
|
||||
### Requirements
|
||||
|
||||
- [Node.js](https://nodejs.org/en/)
|
||||
- [Yarn](https://yarnpkg.com/getting-started/install) (v1 or v2.4.2+)
|
||||
- [pnpm](https://pnpm.io/installation): run `corepack enable` (Corepack ships with Node.js) to use the version pinned in `package.json`
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
### Clone the repo
|
||||
@@ -19,13 +19,13 @@ git clone https://github.com/excalidraw/excalidraw.git
|
||||
### Install the dependencies
|
||||
|
||||
```bash
|
||||
yarn
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### Start the server
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
pnpm start
|
||||
```
|
||||
|
||||
Now you can open [http://localhost:3000](http://localhost:3000) and start coding in your favorite code editor.
|
||||
@@ -39,37 +39,37 @@ For collaboration, you will need to set up [collab server](https://github.com/ex
|
||||
### Install the dependencies
|
||||
|
||||
```bash
|
||||
yarn
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### Run the project
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
pnpm start
|
||||
```
|
||||
|
||||
### Reformat all files with Prettier
|
||||
|
||||
```bash
|
||||
yarn fix
|
||||
pnpm fix
|
||||
```
|
||||
|
||||
### Run tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
pnpm test
|
||||
```
|
||||
|
||||
### Update test snapshots
|
||||
|
||||
```bash
|
||||
yarn test:update
|
||||
pnpm test:update
|
||||
```
|
||||
|
||||
### Test for formatting with Prettier
|
||||
|
||||
```bash
|
||||
yarn test:code
|
||||
pnpm test:code
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "docs",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@10.34.9",
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start --port 3003",
|
||||
@@ -17,6 +18,7 @@
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.2.0",
|
||||
"@docusaurus/preset-classic": "2.2.0",
|
||||
"@docusaurus/theme-common": "2.2.0",
|
||||
"@docusaurus/theme-live-codeblock": "2.2.0",
|
||||
"@excalidraw/excalidraw": "0.18.0",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
@@ -25,7 +27,8 @@
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"sass": "1.57.1"
|
||||
"sass": "1.57.1",
|
||||
"sass-loader": "10.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-rc.1",
|
||||
|
||||
Generated
+11546
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
||||
# standalone project: keeps pnpm from treating dev-docs as part of the
|
||||
# repo-root workspace (it is not listed there)
|
||||
packages:
|
||||
- "."
|
||||
|
||||
# core-js postinstall only prints a funding banner
|
||||
ignoredBuiltDependencies:
|
||||
- core-js
|
||||
- core-js-pure
|
||||
@@ -6,7 +6,7 @@
|
||||
}
|
||||
},
|
||||
"outputDirectory": "build",
|
||||
"installCommand": "yarn install",
|
||||
"installCommand": "pnpm install",
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/docs/introduction/development",
|
||||
|
||||
-9279
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -16,7 +16,8 @@ services:
|
||||
volumes:
|
||||
- ./:/opt/node_app/app:delegated
|
||||
- ./package.json:/opt/node_app/package.json
|
||||
- ./yarn.lock:/opt/node_app/yarn.lock
|
||||
- ./pnpm-lock.yaml:/opt/node_app/pnpm-lock.yaml
|
||||
- ./pnpm-workspace.yaml:/opt/node_app/pnpm-workspace.yaml
|
||||
- notused:/opt/node_app/app/node_modules
|
||||
|
||||
volumes:
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.yarn/install-state.gz
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
@@ -22,8 +19,7 @@
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
@@ -5,13 +5,7 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3005) with your browser to see the result.
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build:packages": "yarn --cwd ../../ build:packages",
|
||||
"build:workspace": "yarn build:packages && yarn copy:assets",
|
||||
"build:packages": "pnpm --dir ../../ build:packages",
|
||||
"build:workspace": "pnpm build:packages && pnpm copy:assets",
|
||||
"copy:assets": "cp -r ../../packages/excalidraw/dist/prod/fonts ./public",
|
||||
"dev": "yarn build:workspace && next dev -p 3005",
|
||||
"build": "yarn build:workspace && next build",
|
||||
"dev": "pnpm build:workspace && next dev -p 3005",
|
||||
"build": "pnpm build:workspace && next build",
|
||||
"start": "next start -p 3006",
|
||||
"lint": "next lint"
|
||||
},
|
||||
|
||||
@@ -3,3 +3,8 @@ FROM node:18-bullseye
|
||||
# Vite wants to open the browser using `open`, so we
|
||||
# need to install those utils.
|
||||
RUN apt update -y && apt install -y xdg-utils
|
||||
|
||||
# pnpm is provided by corepack, at the version pinned by "packageManager" in
|
||||
# package.json
|
||||
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
RUN corepack enable
|
||||
@@ -3,7 +3,7 @@
|
||||
"setupTasks": [
|
||||
{
|
||||
"name": "Install Dependencies",
|
||||
"command": "yarn install"
|
||||
"command": "pnpm install"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
"tasks": {
|
||||
"build": {
|
||||
"name": "Build",
|
||||
"command": "yarn build",
|
||||
"command": "pnpm build",
|
||||
"runAtStart": false
|
||||
},
|
||||
"start": {
|
||||
"name": "Start Example",
|
||||
"command": "yarn start",
|
||||
"command": "pnpm start",
|
||||
"runAtStart": true,
|
||||
"preview": {
|
||||
"port": 3001
|
||||
@@ -24,9 +24,9 @@
|
||||
},
|
||||
"install-deps": {
|
||||
"name": "Install Dependencies",
|
||||
"command": "yarn install",
|
||||
"command": "pnpm install",
|
||||
"restartOn": {
|
||||
"files": ["yarn.lock"],
|
||||
"files": ["pnpm-lock.yaml"],
|
||||
"branch": false,
|
||||
"resume": false
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@excalidraw/excalidraw": "*",
|
||||
"@excalidraw/excalidraw": "workspace:*",
|
||||
"browser-fs-access": "0.38.0",
|
||||
"nanoid": "3.3.8",
|
||||
"react": "19.0.0",
|
||||
@@ -17,7 +17,7 @@
|
||||
"start": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview --port 5002",
|
||||
"build:preview": "yarn build && yarn preview",
|
||||
"build:packages": "yarn --cwd ../../ build:packages"
|
||||
"build:preview": "pnpm build && pnpm preview",
|
||||
"build:packages": "pnpm --dir ../../ build:packages"
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
}
|
||||
},
|
||||
"outputDirectory": "dist",
|
||||
"installCommand": "yarn install",
|
||||
"buildCommand": "yarn build:packages && yarn build"
|
||||
"installCommand": "pnpm install",
|
||||
"buildCommand": "pnpm build:packages && pnpm build"
|
||||
}
|
||||
@@ -47,13 +47,16 @@
|
||||
"build:app:docker": "cross-env VITE_APP_DISABLE_SENTRY=true vite build",
|
||||
"build:app": "cross-env VITE_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA cross-env VITE_APP_ENABLE_TRACKING=true vite build",
|
||||
"build:version": "node ../scripts/build-version.js",
|
||||
"build": "yarn build:app && yarn build:version",
|
||||
"start": "yarn && vite",
|
||||
"start:production": "yarn build && yarn serve",
|
||||
"serve": "npx http-server build -a localhost -p 5001 -o",
|
||||
"build:preview": "yarn build && vite preview --port 5000"
|
||||
"build": "pnpm build:app && pnpm build:version",
|
||||
"start": "pnpm install && vite",
|
||||
"start:production": "pnpm build && pnpm serve",
|
||||
"serve": "pnpm exec http-server build -a localhost -p 5001 -o",
|
||||
"build:preview": "pnpm build && vite preview --port 5000"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite-plugin-sitemap": "0.7.1"
|
||||
"cross-env": "7.0.3",
|
||||
"vite": "5.0.12",
|
||||
"vite-plugin-sitemap": "0.7.1",
|
||||
"workbox-window": "7.3.0"
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,7 @@
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
firebase-debug.log*
|
||||
firebase-debug.*.log*
|
||||
|
||||
@@ -59,8 +58,5 @@ node_modules/
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
+27
-34
@@ -1,12 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "excalidraw-monorepo",
|
||||
"packageManager": "yarn@1.22.22",
|
||||
"workspaces": [
|
||||
"excalidraw-app",
|
||||
"packages/*",
|
||||
"examples/*"
|
||||
],
|
||||
"packageManager": "pnpm@10.34.9",
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "7.26.9",
|
||||
"@excalidraw/eslint-config": "1.0.3",
|
||||
@@ -17,6 +12,7 @@
|
||||
"@types/chai": "4.3.0",
|
||||
"@types/jest": "27.4.0",
|
||||
"@types/lodash.throttle": "4.1.7",
|
||||
"@types/node": "22.13.10",
|
||||
"@types/react": "19.0.10",
|
||||
"@types/react-dom": "19.0.4",
|
||||
"@types/socket.io-client": "3.0.0",
|
||||
@@ -61,37 +57,37 @@
|
||||
"homepage": ".",
|
||||
"prettier": "@excalidraw/prettier-config",
|
||||
"scripts": {
|
||||
"build:app:docker": "yarn --cwd ./excalidraw-app build:app:docker",
|
||||
"build:app": "yarn --cwd ./excalidraw-app build:app",
|
||||
"build:common": "yarn --cwd ./packages/common build:esm",
|
||||
"build:element": "yarn --cwd ./packages/element build:esm",
|
||||
"build:excalidraw": "yarn --cwd ./packages/excalidraw build:esm",
|
||||
"build:math": "yarn --cwd ./packages/math build:esm",
|
||||
"build:fractional-indexing": "yarn --cwd ./packages/fractional-indexing build:esm",
|
||||
"build:laser-pointer": "yarn --cwd ./packages/laser-pointer build:esm",
|
||||
"build:packages": "yarn build:common && yarn build:fractional-indexing && yarn build:laser-pointer && yarn build:math && yarn build:element && yarn build:excalidraw",
|
||||
"build:version": "yarn --cwd ./excalidraw-app build:version",
|
||||
"stats:bundle": "yarn --cwd ./excalidraw-app cross-env VITE_APP_ENABLE_TRACKING=true vite build --config ../scripts/stats/vite.config.mts",
|
||||
"build:app:docker": "pnpm --dir excalidraw-app build:app:docker",
|
||||
"build:app": "pnpm --dir excalidraw-app build:app",
|
||||
"build:common": "pnpm --dir packages/common build:esm",
|
||||
"build:element": "pnpm --dir packages/element build:esm",
|
||||
"build:excalidraw": "pnpm --dir packages/excalidraw build:esm",
|
||||
"build:math": "pnpm --dir packages/math build:esm",
|
||||
"build:fractional-indexing": "pnpm --dir packages/fractional-indexing build:esm",
|
||||
"build:laser-pointer": "pnpm --dir packages/laser-pointer build:esm",
|
||||
"build:packages": "pnpm build:common && pnpm build:fractional-indexing && pnpm build:laser-pointer && pnpm build:math && pnpm build:element && pnpm build:excalidraw",
|
||||
"build:version": "pnpm --dir excalidraw-app build:version",
|
||||
"stats:bundle": "pnpm --dir excalidraw-app exec cross-env VITE_APP_ENABLE_TRACKING=true vite build --config ../scripts/stats/vite.config.mts",
|
||||
"stats:perf": "node ./scripts/stats/perf.mjs",
|
||||
"stats:compare": "node ./scripts/stats/perf.mjs --compare",
|
||||
"build": "yarn --cwd ./excalidraw-app build",
|
||||
"build:preview": "yarn --cwd ./excalidraw-app build:preview",
|
||||
"start": "yarn --cwd ./excalidraw-app start",
|
||||
"start:production": "yarn --cwd ./excalidraw-app start:production",
|
||||
"start:example": "yarn build:packages && yarn --cwd ./examples/with-script-in-browser start",
|
||||
"test:all": "yarn test:typecheck && yarn test:code && yarn test:other && yarn test:app --watch=false",
|
||||
"build": "pnpm --dir excalidraw-app build",
|
||||
"build:preview": "pnpm --dir excalidraw-app build:preview",
|
||||
"start": "pnpm --dir excalidraw-app start",
|
||||
"start:production": "pnpm --dir excalidraw-app start:production",
|
||||
"start:example": "pnpm build:packages && pnpm --dir examples/with-script-in-browser start",
|
||||
"test:all": "pnpm test:typecheck && pnpm test:code && pnpm test:other && pnpm test:app --watch=false",
|
||||
"test:app": "vitest",
|
||||
"test:code": "eslint --max-warnings=0 --ext .js,.ts,.tsx .",
|
||||
"test:other": "yarn prettier --list-different",
|
||||
"test:other": "pnpm prettier --list-different",
|
||||
"test:typecheck": "tsc",
|
||||
"test:update": "yarn test:app --update --watch=false",
|
||||
"test": "yarn test:app",
|
||||
"test:update": "pnpm test:app --update --watch=false",
|
||||
"test": "pnpm test:app",
|
||||
"test:coverage": "vitest --coverage",
|
||||
"test:coverage:watch": "vitest --coverage --watch",
|
||||
"test:ui": "yarn test --ui --coverage.enabled=true",
|
||||
"fix:code": "yarn test:code --fix",
|
||||
"fix:other": "yarn prettier --write",
|
||||
"fix": "yarn fix:other && yarn fix:code",
|
||||
"test:ui": "pnpm test --ui --coverage.enabled=true",
|
||||
"fix:code": "pnpm test:code --fix",
|
||||
"fix:other": "pnpm prettier --write",
|
||||
"fix": "pnpm fix:other && pnpm fix:code",
|
||||
"locales-coverage": "node scripts/build-locales-coverage.js",
|
||||
"locales-coverage:description": "node scripts/locales-coverage-description.js",
|
||||
"prepare": "husky install",
|
||||
@@ -102,9 +98,6 @@
|
||||
"release:latest": "node scripts/release.js --tag=latest",
|
||||
"rm:build": "rimraf --glob excalidraw-app/build excalidraw-app/dist excalidraw-app/dev-dist packages/*/dist packages/*/build examples/*/build examples/*/dist",
|
||||
"rm:node_modules": "rimraf --glob node_modules excalidraw-app/node_modules packages/*/node_modules",
|
||||
"clean-install": "yarn rm:node_modules && yarn install"
|
||||
},
|
||||
"resolutions": {
|
||||
"strip-ansi": "6.0.1"
|
||||
"clean-install": "pnpm rm:node_modules && pnpm install"
|
||||
}
|
||||
}
|
||||
@@ -54,10 +54,11 @@
|
||||
"repository": "https://github.com/excalidraw/excalidraw",
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && pnpm gen:types"
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.2",
|
||||
"@excalidraw/math": "workspace:*",
|
||||
"es6-promise-pool": "2.5.0",
|
||||
"nanoid": "3.3.8",
|
||||
"roughjs": "4.6.4",
|
||||
|
||||
@@ -60,12 +60,12 @@
|
||||
"repository": "https://github.com/excalidraw/excalidraw",
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && pnpm gen:types"
|
||||
},
|
||||
"dependencies": {
|
||||
"@excalidraw/common": "0.18.0",
|
||||
"@excalidraw/math": "0.18.0",
|
||||
"@excalidraw/fractional-indexing": "3.3.0",
|
||||
"@excalidraw/common": "workspace:*",
|
||||
"@excalidraw/math": "workspace:*",
|
||||
"@excalidraw/fractional-indexing": "workspace:*",
|
||||
"lodash.throttle": "4.1.1",
|
||||
"perfect-freehand": "1.2.0",
|
||||
"points-on-curve": "0.2.0",
|
||||
|
||||
@@ -8,19 +8,6 @@ import {
|
||||
isTestEnv,
|
||||
toArray,
|
||||
} from "@excalidraw/common";
|
||||
import { isNonDeletedElement } from "@excalidraw/element";
|
||||
import { isFrameLikeElement } from "@excalidraw/element";
|
||||
import { getElementsInGroup } from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
syncMovedIndices,
|
||||
validateFractionalIndices,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import { getSelectedElements } from "@excalidraw/element";
|
||||
|
||||
import { mutateElement, type ElementUpdate } from "@excalidraw/element";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
@@ -40,6 +27,21 @@ import type {
|
||||
SameType,
|
||||
} from "@excalidraw/common/utility-types";
|
||||
|
||||
import { isFrameLikeElement } from "./typeChecks";
|
||||
import { getElementsInGroup } from "./groups";
|
||||
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
syncMovedIndices,
|
||||
validateFractionalIndices,
|
||||
} from "./fractionalIndex";
|
||||
|
||||
import { getSelectedElements } from "./selection";
|
||||
|
||||
import { mutateElement, type ElementUpdate } from "./mutateElement";
|
||||
|
||||
import { isNonDeletedElement } from "./index";
|
||||
|
||||
import type { AppState } from "../../excalidraw/types";
|
||||
|
||||
type SceneStateCallback = () => void;
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
import {
|
||||
getBoundsFromPoints,
|
||||
getElementAbsoluteCoords,
|
||||
} from "@excalidraw/element/bounds";
|
||||
import {
|
||||
newArrowElement,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
} from "@excalidraw/element/newElement";
|
||||
import {
|
||||
ELEMENT_PENDING_DRAW_SHAPE_OPACITY,
|
||||
getStrokeWidthByKey,
|
||||
@@ -45,6 +36,9 @@ import type {
|
||||
ExcalidrawLineElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { newArrowElement, newElement, newLinearElement } from "./newElement";
|
||||
import { getBoundsFromPoints, getElementAbsoluteCoords } from "./bounds";
|
||||
|
||||
import { getFrameLikeElements } from "./frame";
|
||||
import {
|
||||
isLinearElement,
|
||||
|
||||
@@ -30,18 +30,6 @@ import {
|
||||
getFeatureFlag,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
deconstructLinearOrFreeDrawElement,
|
||||
getSnapOutlineMidPoint,
|
||||
isPathALoop,
|
||||
moveArrowAboveBindable,
|
||||
projectFixedPointOntoDiagonal,
|
||||
type Store,
|
||||
getLinearElementPathSegments,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import type { LinearPathSegment } from "@excalidraw/element";
|
||||
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
@@ -54,6 +42,15 @@ import type {
|
||||
} from "@excalidraw/excalidraw/types";
|
||||
import type { Bounds } from "@excalidraw/common";
|
||||
|
||||
import { moveArrowAboveBindable } from "./zindex";
|
||||
import {
|
||||
deconstructLinearOrFreeDrawElement,
|
||||
getSnapOutlineMidPoint,
|
||||
isPathALoop,
|
||||
projectFixedPointOntoDiagonal,
|
||||
getLinearElementPathSegments,
|
||||
} from "./utils";
|
||||
|
||||
import {
|
||||
calculateFixedPointForNonElbowArrowBinding,
|
||||
getBindingStrategyForDraggingBindingElementEndpoints,
|
||||
@@ -77,6 +74,9 @@ import { getLockedLinearCursorAlignSize } from "./sizeHelpers";
|
||||
|
||||
import { isLineElement } from "./typeChecks";
|
||||
|
||||
import type { Store } from "./store";
|
||||
import type { LinearPathSegment } from "./utils";
|
||||
|
||||
import type { Scene } from "./Scene";
|
||||
|
||||
import type {
|
||||
|
||||
@@ -8,17 +8,16 @@ import {
|
||||
type LineSegment,
|
||||
} from "@excalidraw/math";
|
||||
import { type Bounds, isBounds } from "@excalidraw/common";
|
||||
import {
|
||||
getElementBounds,
|
||||
intersectElementWithLineSegment,
|
||||
isFreeDrawElement,
|
||||
isLinearElement,
|
||||
isPathALoop,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { Curve } from "@excalidraw/math";
|
||||
|
||||
import { getElementBounds } from "./bounds";
|
||||
import { intersectElementWithLineSegment } from "./collision";
|
||||
import { isFreeDrawElement, isLinearElement } from "./typeChecks";
|
||||
import { isPathALoop } from "./utils";
|
||||
|
||||
// The global data holder to collect the debug operations
|
||||
declare global {
|
||||
interface Window {
|
||||
|
||||
@@ -10,6 +10,8 @@ Install the package together with its React peer dependencies.
|
||||
npm install react react-dom @excalidraw/excalidraw
|
||||
# or
|
||||
yarn add react react-dom @excalidraw/excalidraw
|
||||
# or
|
||||
pnpm add react react-dom @excalidraw/excalidraw
|
||||
```
|
||||
|
||||
> **Note**: If you want to try unreleased changes, use `@excalidraw/excalidraw@next`.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { FONT_FAMILY, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { Excalidraw } from "../..";
|
||||
import { Excalidraw } from "../../index";
|
||||
import { API } from "../../tests/helpers/api";
|
||||
import { Keyboard } from "../../tests/helpers/ui";
|
||||
import { act, fireEvent, render, waitFor } from "../../tests/test-utils";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
|
||||
import { Excalidraw } from "../..";
|
||||
import { Excalidraw } from "../../index";
|
||||
import {
|
||||
GlobalTestState,
|
||||
queryByTestId,
|
||||
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { Excalidraw, getCommonBounds } from "../..";
|
||||
import { Excalidraw, getCommonBounds } from "../../index";
|
||||
import { actionGroup } from "../../actions";
|
||||
import { t } from "../../i18n";
|
||||
import * as StaticScene from "../../renderer/staticScene";
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"homepage": "https://github.com/excalidraw/excalidraw/tree/master/packages/excalidraw",
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildPackage.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildPackage.js && pnpm gen:types"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^17.0.2 || ^18.2.0 || ^19.0.0",
|
||||
@@ -83,12 +83,13 @@
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@excalidraw/common": "0.18.0",
|
||||
"@excalidraw/element": "0.18.0",
|
||||
"@excalidraw/laser-pointer": "1.3.1",
|
||||
"@excalidraw/math": "0.18.0",
|
||||
"@excalidraw/common": "workspace:*",
|
||||
"@excalidraw/element": "workspace:*",
|
||||
"@excalidraw/fractional-indexing": "workspace:*",
|
||||
"@excalidraw/laser-pointer": "workspace:*",
|
||||
"@excalidraw/math": "workspace:*",
|
||||
"@excalidraw/mermaid-to-excalidraw": "3.6.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"browser-fs-access": "0.38.0",
|
||||
"canvas-roundrect-polyfill": "0.0.1",
|
||||
"clsx": "1.1.1",
|
||||
@@ -136,6 +137,7 @@
|
||||
"jest-diff": "29.7.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"size-limit": "9.0.0",
|
||||
"typescript": "5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && pnpm gen:types"
|
||||
},
|
||||
"keywords": [
|
||||
"fractional",
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
},
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && pnpm gen:types"
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,9 @@
|
||||
"repository": "https://github.com/excalidraw/excalidraw",
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && pnpm gen:types"
|
||||
},
|
||||
"dependencies": {
|
||||
"@excalidraw/common": "0.18.0"
|
||||
"@excalidraw/common": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,12 @@ If you prefer Yarn over npm, use this command to install the Excalidraw utils pa
|
||||
yarn add @excalidraw/utils
|
||||
```
|
||||
|
||||
With PNPM, similarly install the package with this command:
|
||||
|
||||
```bash
|
||||
pnpm add @excalidraw/utils
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `serializeAsJSON`
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.2",
|
||||
"@excalidraw/laser-pointer": "1.3.1",
|
||||
"@excalidraw/laser-pointer": "workspace:*",
|
||||
"browser-fs-access": "0.38.0",
|
||||
"pako": "2.0.3",
|
||||
"perfect-freehand": "1.2.0",
|
||||
@@ -70,6 +70,6 @@
|
||||
"repository": "https://github.com/excalidraw/excalidraw",
|
||||
"scripts": {
|
||||
"gen:types": "rimraf types && tsc",
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildUtils.js && yarn gen:types"
|
||||
"build:esm": "rimraf dist && node ../../scripts/buildUtils.js && pnpm gen:types"
|
||||
}
|
||||
}
|
||||
Generated
+13378
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,14 @@
|
||||
packages:
|
||||
- excalidraw-app
|
||||
- packages/*
|
||||
- examples/*
|
||||
|
||||
overrides:
|
||||
strip-ansi: 6.0.1
|
||||
|
||||
# dependencies allowed to run install scripts (pnpm 10 blocks them by default)
|
||||
onlyBuiltDependencies:
|
||||
- "@parcel/watcher"
|
||||
- core-js
|
||||
- esbuild
|
||||
- protobufjs
|
||||
@@ -2,6 +2,9 @@ const path = require("path");
|
||||
|
||||
const { build } = require("esbuild");
|
||||
|
||||
// the package being built (scripts run from the package directory)
|
||||
const { name: packageName } = require(path.resolve("package.json"));
|
||||
|
||||
// contains all dependencies bundled inside
|
||||
const getConfig = (outdir) => ({
|
||||
outdir,
|
||||
@@ -12,13 +15,17 @@ const getConfig = (outdir) => ({
|
||||
assetNames: "[dir]/[name]",
|
||||
alias: {
|
||||
"@excalidraw/utils": path.resolve(__dirname, "../packages/utils/src"),
|
||||
// bundled sources (e.g. utils) may import the package being built by
|
||||
// name: resolve those to its own sources instead of a self-import, which
|
||||
// doesn't resolve from inside the package with an isolated node_modules
|
||||
[packageName]: path.resolve("src"),
|
||||
},
|
||||
external: [
|
||||
"@excalidraw/common",
|
||||
"@excalidraw/element",
|
||||
"@excalidraw/math",
|
||||
"@excalidraw/fractional-indexing",
|
||||
],
|
||||
].filter((name) => name !== packageName),
|
||||
});
|
||||
|
||||
function buildDev(config) {
|
||||
|
||||
+20
-26
@@ -19,12 +19,12 @@ const PACKAGES_DIR = path.resolve(__dirname, "../packages");
|
||||
* Returns the arguments for the release script.
|
||||
*
|
||||
* Usage examples:
|
||||
* - yarn release --help -> prints this help message
|
||||
* - yarn release -> publishes `@excalidraw` packages with "test" tag and "-[hash]" version suffix
|
||||
* - yarn release --tag=test -> same as above
|
||||
* - yarn release --tag=next -> publishes `@excalidraw` packages with "next" tag and version "-[hash]" suffix
|
||||
* - yarn release --tag=next --non-interactive -> skips interactive prompts (runs on CI/CD), otherwise same as above
|
||||
* - yarn release --tag=latest --version=0.19.0 -> publishes `@excalidraw` packages with "latest" tag and version "0.19.0" & prepares changelog for the release
|
||||
* - pnpm release --help -> prints this help message
|
||||
* - pnpm release -> publishes `@excalidraw` packages with "test" tag and "-[hash]" version suffix
|
||||
* - pnpm release --tag=test -> same as above
|
||||
* - pnpm release --tag=next -> publishes `@excalidraw` packages with "next" tag and version "-[hash]" suffix
|
||||
* - pnpm release --tag=next --non-interactive -> skips interactive prompts (runs on CI/CD), otherwise same as above
|
||||
* - pnpm release --tag=latest --version=0.19.0 -> publishes `@excalidraw` packages with "latest" tag and version "0.19.0" & prepares changelog for the release
|
||||
*
|
||||
* @returns [tag, version, nonInteractive]
|
||||
*/
|
||||
@@ -41,11 +41,11 @@ const getArguments = () => {
|
||||
--non-interactive -> (optional) disables interactive prompts`);
|
||||
|
||||
console.info(`\nUsage examples:
|
||||
- yarn release -> publishes \`@excalidraw\` packages with "test" tag and "-[hash]" version suffix
|
||||
- yarn release --tag=test -> same as above
|
||||
- yarn release --tag=next -> publishes \`@excalidraw\` packages with "next" tag and version "-[hash]" suffix
|
||||
- yarn release --tag=next --non-interactive -> skips interactive prompts (runs on CI/CD), otherwise same as above
|
||||
- yarn release --tag=latest --version=0.19.0 -> publishes \`@excalidraw\` packages with "latest" tag and version "0.19.0" & prepares changelog for the release`);
|
||||
- pnpm release -> publishes \`@excalidraw\` packages with "test" tag and "-[hash]" version suffix
|
||||
- pnpm release --tag=test -> same as above
|
||||
- pnpm release --tag=next -> publishes \`@excalidraw\` packages with "next" tag and version "-[hash]" suffix
|
||||
- pnpm release --tag=next --non-interactive -> skips interactive prompts (runs on CI/CD), otherwise same as above
|
||||
- pnpm release --tag=latest --version=0.19.0 -> publishes \`@excalidraw\` packages with "latest" tag and version "0.19.0" & prepares changelog for the release`);
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -112,18 +112,10 @@ const updatePackageJsons = (nextVersion) => {
|
||||
for (const packageName of PACKAGES) {
|
||||
const pkg = require(getPackageJsonPath(packageName));
|
||||
|
||||
// internal dependencies use the `workspace:*` protocol, which
|
||||
// `pnpm publish` replaces with the version bumped here
|
||||
pkg.version = nextVersion;
|
||||
|
||||
if (pkg.dependencies) {
|
||||
for (const dependencyName of PACKAGES) {
|
||||
if (!pkg.dependencies[`@excalidraw/${dependencyName}`]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pkg.dependencies[`@excalidraw/${dependencyName}`] = nextVersion;
|
||||
}
|
||||
}
|
||||
|
||||
packageJsons.set(packageName, `${JSON.stringify(pkg, null, 2)}\n`);
|
||||
}
|
||||
|
||||
@@ -172,15 +164,15 @@ const askToCommit = (tag, nextVersion) => {
|
||||
};
|
||||
|
||||
const buildPackages = () => {
|
||||
console.info("Running yarn install...");
|
||||
execSync(`yarn --frozen-lockfile`, { stdio: "inherit" });
|
||||
console.info("Running pnpm install...");
|
||||
execSync(`pnpm install --frozen-lockfile`, { stdio: "inherit" });
|
||||
|
||||
console.info("Removing existing build artifacts...");
|
||||
execSync(`yarn rm:build`, { stdio: "inherit" });
|
||||
execSync(`pnpm rm:build`, { stdio: "inherit" });
|
||||
|
||||
for (const packageName of PACKAGES) {
|
||||
console.info(`Building "@excalidraw/${packageName}"...`);
|
||||
execSync(`yarn run build:esm`, {
|
||||
execSync(`pnpm run build:esm`, {
|
||||
cwd: path.resolve(PACKAGES_DIR, packageName),
|
||||
stdio: "inherit",
|
||||
});
|
||||
@@ -213,7 +205,9 @@ const askToPublish = (tag, version) => {
|
||||
|
||||
const publishPackages = (tag, version) => {
|
||||
for (const packageName of PACKAGES) {
|
||||
execSync(`yarn publish --tag ${tag}`, {
|
||||
// --no-git-checks: the version bumps above stay uncommitted for "test"
|
||||
// and "next" releases, which pnpm's clean-tree check would reject
|
||||
execSync(`pnpm publish --tag ${tag} --no-git-checks`, {
|
||||
cwd: path.resolve(PACKAGES_DIR, packageName),
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
+10
-6
@@ -7,7 +7,7 @@
|
||||
* context (cold HTTP cache) on a throttled fast-desktop connection — the
|
||||
* conditions of Excalidraw+'s own runs, so the apps' numbers compare.
|
||||
*
|
||||
* `--compare` (`yarn stats:compare`) measures two builds on this machine,
|
||||
* `--compare` (`pnpm stats:compare`) measures two builds on this machine,
|
||||
* alternating them, and prints a table of their differences: this checkout's
|
||||
* production build — built and served locally — or `--url`, against `--base`,
|
||||
* a url (staging by default) or a commit, checked out and built the same way.
|
||||
@@ -17,9 +17,9 @@
|
||||
*
|
||||
* node scripts/stats/perf.mjs --url http://localhost:3000 --iterations 3
|
||||
* node scripts/stats/perf.mjs --scenario oss-pan-zoom --iterations 1
|
||||
* yarn stats:compare [--iterations 10] [--out diff.csv]
|
||||
* yarn stats:compare --base master --out perf.json
|
||||
* yarn stats:compare --url http://localhost:3000 --base https://excalidraw.com
|
||||
* pnpm stats:compare [--iterations 10] [--out diff.csv]
|
||||
* pnpm stats:compare --base master --out perf.json
|
||||
* pnpm stats:compare --url http://localhost:3000 --base https://excalidraw.com
|
||||
*/
|
||||
|
||||
import { execFileSync, spawn } from "node:child_process";
|
||||
@@ -624,8 +624,12 @@ function checkOut(revision) {
|
||||
fs.rmSync(tmpDir, { recursive: true, force: true });
|
||||
});
|
||||
git("worktree", "add", "--quiet", "--detach", dir, sha);
|
||||
// revisions from before the move to pnpm only have a yarn.lock
|
||||
const packageManager = fs.existsSync(path.join(dir, "pnpm-lock.yaml"))
|
||||
? "pnpm"
|
||||
: "yarn";
|
||||
runQuietly(
|
||||
"yarn",
|
||||
packageManager,
|
||||
["install", "--frozen-lockfile", "--prefer-offline"],
|
||||
// no git hooks for the worktree
|
||||
{ cwd: dir, env: { ...process.env, HUSKY: "0" } },
|
||||
@@ -657,7 +661,7 @@ async function serveLocalBuild({ dir, sha, label }) {
|
||||
VITE_APP_ENABLE_ESLINT: "false",
|
||||
},
|
||||
},
|
||||
`Building ${label} failed (\`yarn build:app\` shows why)`,
|
||||
`Building ${label} failed (\`pnpm build:app\` shows why)`,
|
||||
);
|
||||
|
||||
const port = await getFreePort();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Posts a performance run — a commit's build and the commit before's, measured
|
||||
* side by side (`perf.mjs --compare --base <commit> --out perf.json`) — or a
|
||||
* build's bundle stats (`yarn stats:bundle` →
|
||||
* build's bundle stats (`pnpm stats:bundle` →
|
||||
* `excalidraw-app/build/bundle-stats.json`) to the Excalidraw+ api, which
|
||||
* stores it for the admin's Performance and Bundle size pages. Needs
|
||||
* `OSS_STATS_TOKEN`; the commit is `--commit`, `GITHUB_SHA` or HEAD, read from
|
||||
|
||||
@@ -5,7 +5,7 @@ import appConfig from "../../excalidraw-app/vite.config.mts";
|
||||
import { bundleStatsPlugin } from "./bundle-stats-plugin.mts";
|
||||
|
||||
/**
|
||||
* The app's production build plus `bundle-stats.json` (`yarn stats:bundle`,
|
||||
* The app's production build plus `bundle-stats.json` (`pnpm stats:bundle`,
|
||||
* run from `excalidraw-app/` like the app's own build). The stats aren't part
|
||||
* of the deployed builds, so they only cost CI the extra compression.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ PolyfillLocalStorage();
|
||||
// By default testing-library dumps the entire serialized DOM into the error
|
||||
// message whenever a `waitFor`/`getBy*` fails, which floods the test output
|
||||
// (often hundreds of lines of HTML per failure). Strip it out unless
|
||||
// VITE_DEBUG_DOM is enabled (see .env.test), e.g. `VITE_DEBUG_DOM=true yarn test`.
|
||||
// VITE_DEBUG_DOM is enabled (see .env.test), e.g. `VITE_DEBUG_DOM=true pnpm test`.
|
||||
const debugDom = ["true", "1"].includes(process.env.VITE_DEBUG_DOM ?? "");
|
||||
if (!debugDom) {
|
||||
configure({
|
||||
|
||||
+1
-1
@@ -65,5 +65,5 @@
|
||||
}
|
||||
],
|
||||
"outputDirectory": "excalidraw-app/build",
|
||||
"installCommand": "yarn install"
|
||||
"installCommand": "pnpm install"
|
||||
}
|
||||
Reference in new issue
Block a user