Skip to content

Commit

Permalink
fix(ui): improve UI lib hot reloading (#1883)
Browse files Browse the repository at this point in the history
* fix(ui): fix UI package hot reloading

* fix(ui): improve hot reloading
  • Loading branch information
VanishMax authored Oct 30, 2024
1 parent e3778eb commit 7c1d4e7
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 193 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-steaks-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@penumbra-zone/ui': patch
---

Improve hot reloading
3 changes: 2 additions & 1 deletion packages/getters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"devDependencies": {
"@bufbuild/protobuf": "^1.10.0",
"@penumbra-zone/bech32m": "workspace:*",
"@penumbra-zone/protobuf": "workspace:*"
"@penumbra-zone/protobuf": "workspace:*",
"typescript": "5.5.3"
},
"peerDependencies": {
"@bufbuild/protobuf": "^1.10.0",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"@types/styled-components": "^5.1.34",
"@types/tinycolor2": "^1.4.6",
"@types/ua-parser-js": "^0.7.39",
"execa": "^9.5.1",
"prop-types": "^15.8.1",
"storybook": "^8.1.1",
"vite": "^5.2.11",
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { defineConfig } from 'vite';
import { resolve, join } from 'path';
import { readdirSync, existsSync } from 'fs';
import dts from 'vite-plugin-dts';
import { exec } from 'child_process';
import * as path from 'node:path';
import { execa } from 'execa';

/**
* Returns an object with keys as resulting component build paths and values as
Expand Down Expand Up @@ -68,8 +68,9 @@ export default defineConfig({
closeBundle: () => {
const isWatch = process.env.VITE_WATCH === 'true';
if (isWatch) {
const cmd = exec('$npm_execpath pack');
cmd.unref();
execa({ preferLocal: true })`pnpm pack`.then(() => {
console.info(`@penumbra-zone/ui library is built and packed!`);
});
}
},
},
Expand Down
Loading

0 comments on commit 7c1d4e7

Please sign in to comment.