diff --git a/README.md b/README.md index 2fe3793..e7aaaeb 100644 --- a/README.md +++ b/README.md @@ -434,15 +434,19 @@ export function App() { ## Local Development -- Run `yarn` to install dependencies. - -- Run `yarn start` to start the development server for the package and for the example. +To start the development servers for the package and the advanced example: -- Open `localhost:5000` to view the example project. +- Run `yarn` to install dependencies. +- Run `yarn start`. +- Open `localhost:5420`. -- Run `yarn test` to execute unit tests via [Jest](https://jestjs.io). +You can also run: -- Run `yarn docs` to build the docs via [ts-doc](https://typedoc.org/). +- `start:advanced` to start development servers for the package and the advanced example. +- `start:simple` to start development servers for the package and the simple example. +- `test` to execute unit tests via [Jest](https://jestjs.io). +- `docs` to build the docs via [ts-doc](https://typedoc.org/). +- `build` to build the package. ## Example diff --git a/example-advanced/README.md b/example-advanced/README.md index ba9d93b..96d36fb 100644 --- a/example-advanced/README.md +++ b/example-advanced/README.md @@ -1,6 +1,8 @@ -# @tldraw/core-example-advanced +# @tldraw/core Advanced Example -An advanced example project with a very fast dev server. +An advanced example project for `@tldraw/core`. -You probably do not need to start the server here: it is started as -part of `yarn start` in the root directory. +To start this project: + +- run `yarn start` in the root directory +- open `http://localhost:5420` in your browser diff --git a/example-advanced/package.json b/example-advanced/package.json index 98496be..1671b23 100644 --- a/example-advanced/package.json +++ b/example-advanced/package.json @@ -10,7 +10,7 @@ "license": "MIT", "private": true, "scripts": { - "start": "node scripts/dev.mjs -w", + "start:advanced": "node scripts/dev.mjs -w", "build": "node scripts/build.mjs" }, "files": [], diff --git a/example-advanced/scripts/build.mjs b/example-advanced/scripts/build.mjs index 4ea513f..2838da7 100644 --- a/example-advanced/scripts/build.mjs +++ b/example-advanced/scripts/build.mjs @@ -18,7 +18,7 @@ async function main() { esbuild.buildSync({ entryPoints: ['./src/index.tsx'], outdir: 'dist', - minify: true, + minify: false, bundle: true, format: 'cjs', target: 'es6', diff --git a/example-advanced/scripts/dev.mjs b/example-advanced/scripts/dev.mjs index 84b0115..c92e48d 100644 --- a/example-advanced/scripts/dev.mjs +++ b/example-advanced/scripts/dev.mjs @@ -15,8 +15,8 @@ async function main() { await esbuildServe( { entryPoints: ['src/index.tsx'], + outfile: 'dist/index.js', bundle: true, - outfile: 'dist/bundle.js', minify: false, sourcemap: true, incremental: true, @@ -26,13 +26,12 @@ async function main() { }, watch: { onRebuild(err) { - serve.update() err ? error('❌ Failed') : log('✅ Updated') }, }, }, { - port: 5000, + port: 5420, root: './dist', live: true, } diff --git a/example-advanced/src/index.html b/example-advanced/src/index.html index 1da2d34..362929e 100644 --- a/example-advanced/src/index.html +++ b/example-advanced/src/index.html @@ -10,15 +10,5 @@
- diff --git a/example-simple/README.md b/example-simple/README.md index d580b44..d621bfc 100644 --- a/example-simple/README.md +++ b/example-simple/README.md @@ -1,6 +1,8 @@ -# @tldraw/core-example-simple +# @tldraw/core Simple Example A (relatively) simple example project with a very fast dev server. -You probably do not need to start the server here: it is started as -part of `yarn start:simple` in the root directory. +To start this project: + +- run `yarn start:simple` in the root directory +- open `http://localhost:5420` in your browser diff --git a/example-simple/package.json b/example-simple/package.json index 5aff277..9a3473b 100644 --- a/example-simple/package.json +++ b/example-simple/package.json @@ -10,11 +10,10 @@ "license": "MIT", "private": true, "scripts": { - "start": "node scripts/dev.mjs -w", + "start:simple": "node scripts/dev.mjs -w", "build": "node scripts/build.mjs" }, "files": [], - "sideEffects": false, "devDependencies": { "@tldraw/core": "^0.1.18", "@tldraw/vec": "^0.0.130", diff --git a/example-simple/scripts/build.mjs b/example-simple/scripts/build.mjs index 4ea513f..2838da7 100644 --- a/example-simple/scripts/build.mjs +++ b/example-simple/scripts/build.mjs @@ -18,7 +18,7 @@ async function main() { esbuild.buildSync({ entryPoints: ['./src/index.tsx'], outdir: 'dist', - minify: true, + minify: false, bundle: true, format: 'cjs', target: 'es6', diff --git a/example-simple/scripts/dev.mjs b/example-simple/scripts/dev.mjs index 84b0115..481f77b 100644 --- a/example-simple/scripts/dev.mjs +++ b/example-simple/scripts/dev.mjs @@ -15,8 +15,8 @@ async function main() { await esbuildServe( { entryPoints: ['src/index.tsx'], - bundle: true, outfile: 'dist/bundle.js', + bundle: true, minify: false, sourcemap: true, incremental: true, @@ -26,13 +26,12 @@ async function main() { }, watch: { onRebuild(err) { - serve.update() err ? error('❌ Failed') : log('✅ Updated') }, }, }, { - port: 5000, + port: 5420, root: './dist', live: true, } diff --git a/example-simple/src/index.html b/example-simple/src/index.html index c7ceedf..27acf7a 100644 --- a/example-simple/src/index.html +++ b/example-simple/src/index.html @@ -10,15 +10,5 @@
- diff --git a/package.json b/package.json index f0cbe95..358983a 100644 --- a/package.json +++ b/package.json @@ -21,16 +21,16 @@ "example-advanced" ], "scripts": { - "test": "jest", - "test:watch": "jest --watchAll", - "lerna": "lerna", + "start": "yarn start:advanced", + "start:simple": "lerna run start:simple --stream --parallel", + "start:advanced": "lerna run start:advanced --stream --parallel", "build": "lerna run build && lerna run docs", - "start": "cd packages/core && yarn start & cd example-advanced && yarn start", - "start:simple": "cd packages/core && yarn start & cd example-simple && yarn start", - "start:all": "lerna run start --stream --parallel", "publish:patch": "yarn test && yarn build && lerna publish patch", "docs": "lerna run docs", - "docs:watch": "lerna run docs:watch" + "docs:watch": "lerna run docs:watch", + "test": "jest", + "test:watch": "jest --watchAll", + "lerna": "lerna" }, "devDependencies": { "@swc-node/jest": "^1.3.3", diff --git a/packages/core/package.json b/packages/core/package.json index 56c6b30..0309ef2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -22,6 +22,8 @@ "module": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", "scripts": { + "start:simple": "yarn start", + "start:advanced": "yarn start", "start": "node scripts/dev & yarn types:dev", "build": "node scripts/build && yarn types:build && node scripts/copy-readme", "types:dev": "tsc -w --p tsconfig.build.json", @@ -48,4 +50,4 @@ "@types/react": "^17.0.33", "@types/react-dom": "^17.0.10" } -} +} \ No newline at end of file