Skip to content

Commit be18c65

Browse files
authored
chore: Resolving node_modules via require.resolve for copy-assets (#561)
1 parent fc90fba commit be18c65

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/good-ghosts-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/web': minor
3+
---
4+
5+
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.

packages/web/bin/powersync.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ program
1313
.description('Copy assets to the specified output directory')
1414
.option('-o, --output <directory>', 'output directory for assets', 'public')
1515
.action(async (options) => {
16+
const resolvedPath = require.resolve('@powersync/web/umd');
1617
const outputDir = options.output;
1718

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

2022
const cwd = process.cwd();
21-
const source = path.join(cwd, 'node_modules', '@powersync', 'web', 'dist');
23+
const source = path.join(path.dirname(resolvedPath));
2224
const destination = path.join(cwd, outputDir, '@powersync');
2325

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

0 commit comments

Comments
 (0)