Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/good-ghosts-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/web': minor
---

Determining `node_modules` location via `require.resolve` for the `copy-assets` command. Fixes use cases where `node_modules` location might differ such as in a monorepo.
4 changes: 3 additions & 1 deletion packages/web/bin/powersync.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ program
.description('Copy assets to the specified output directory')
.option('-o, --output <directory>', 'output directory for assets', 'public')
.action(async (options) => {
const resolvedPath = require.resolve('@powersync/web/umd');
const outputDir = options.output;

console.log(`Resolved input path: ${resolvedPath}`);
console.log(`Target directory: ${outputDir}`);

const cwd = process.cwd();
const source = path.join(cwd, 'node_modules', '@powersync', 'web', 'dist');
const source = path.join(path.dirname(resolvedPath));
const destination = path.join(cwd, outputDir, '@powersync');

await fsPromise.rm(destination, { recursive: true, force: true }); // Clear old assets
Expand Down