File tree Expand file tree Collapse file tree
packages/imagekit-editor-dev Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,4 +20,6 @@ packages/imagekit-editor/*.tgz
2020builds
2121packages /imagekit-editor /README.md
2222.cursor
23- coverage
23+ coverage
24+ .yalc
25+ yalc.lock
Original file line number Diff line number Diff line change 1+ # Development
2+
3+ ## Prerequisites
4+
5+ - Node.js v20 (use ` nvm use ` )
6+ - Yarn 4 (via Corepack)
7+ - [ yalc] ( https://github.com/wclr/yalc ) (included as a devDependency)
8+
9+ ## Getting Started
10+
11+ ``` bash
12+ nvm use
13+ yarn install
14+ yarn dev
15+ ```
16+
17+ ` yarn dev ` runs vite in watch mode and ** automatically publishes ` @imagekit/editor ` to the local yalc store** on every rebuild.
18+
19+ ## Linking to External Projects
20+
21+ Use yalc to test ` @imagekit/editor ` in any project outside this monorepo:
22+
23+ ### 1. Start dev mode (this repo)
24+
25+ ``` bash
26+ yarn dev
27+ ```
28+
29+ This watches for source changes, rebuilds, and runs ` yalc publish --push ` automatically after each build.
30+
31+ ### 2. Install yalc globally (required for consuming projects)
32+
33+ ``` bash
34+ npm i -g yalc
35+ ```
36+
37+ ### 3. Link in your consuming project
38+
39+ ``` bash
40+ # In your external project directory
41+ yalc link @imagekit/editor
42+ ```
43+
44+ This creates a symlink to the yalc store. Every time the editor rebuilds, your project receives the update automatically via ` --push ` .
45+
46+ ### 4. Remove the link when done
47+
48+ ``` bash
49+ # In your external project directory
50+ yalc remove @imagekit/editor
51+ ```
52+
53+ ## Build
54+
55+ ``` bash
56+ yarn build
57+ ```
58+
59+ Produces the production bundle in ` packages/imagekit-editor/dist/ ` .
60+
61+ ## Package
62+
63+ ``` bash
64+ yarn package
65+ ```
66+
67+ Creates a ` .tgz ` tarball in ` builds/ ` for manual distribution or testing.
Original file line number Diff line number Diff line change 4040 "lint-staged" : " ^16.1.2" ,
4141 "shx" : " ^0.4.0" ,
4242 "turbo" : " ^2.0.1" ,
43- "vitest" : " ^2.1.9"
43+ "vitest" : " ^2.1.9" ,
44+ "yalc" : " ^1.0.0-pre.53"
4445 },
4546 "packageManager" : " yarn@4.9.2" ,
4647 "lint-staged" : {
Original file line number Diff line number Diff line change 1+ import { execSync } from "node:child_process"
12import * as path from "node:path"
23import react from "@vitejs/plugin-react"
3- import { defineConfig } from "vite"
4+ import { defineConfig , type Plugin } from "vite"
45import dts from "vite-plugin-dts"
56
7+ function yalcPublish ( ) : Plugin {
8+ const editorPkgDir = path . resolve ( __dirname , "../imagekit-editor" )
9+ return {
10+ name : "vite-plugin-yalc-publish" ,
11+ closeBundle ( ) {
12+ try {
13+ execSync ( "yalc publish --push --changed" , {
14+ cwd : editorPkgDir ,
15+ stdio : "inherit" ,
16+ } )
17+ } catch ( e ) {
18+ console . error ( "[yalc] publish failed:" , e )
19+ }
20+ } ,
21+ }
22+ }
23+
624// https://vitejs.dev/config/
725export default defineConfig ( {
826 plugins : [
@@ -15,6 +33,7 @@ export default defineConfig({
1533 exclude : [ "node_modules" , "lib" ] ,
1634 outDir : "../imagekit-editor/dist/types" ,
1735 } ) ,
36+ yalcPublish ( ) ,
1837 ] ,
1938 test : {
2039 globals : true ,
You can’t perform that action at this time.
0 commit comments