Skip to content

Commit bcc5c50

Browse files
committed
Using require.resolve instead.
1 parent 3c1c253 commit bcc5c50

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

.changeset/good-ghosts-rush.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@powersync/web': minor
33
---
44

5-
Added input flag option to copy assets command, allows you to specify a path to the node_modules directory - useful in cases like a monorepo.
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ program.name('powersync-web').description('CLI for PowerSync Web SDK utilities')
1111
program
1212
.command('copy-assets')
1313
.description('Copy assets to the specified output directory')
14-
.option('-i, --input <directory>', 'node modules dependency directory', 'node_modules')
1514
.option('-o, --output <directory>', 'output directory for assets', 'public')
1615
.action(async (options) => {
17-
const inputDir = options.input;
16+
const resolvedPath = require.resolve('@powersync/web/umd');
1817
const outputDir = options.output;
1918

20-
console.log(`Input directory: ${inputDir}`);
19+
console.log(`Resolved input path: ${resolvedPath}`);
2120
console.log(`Target directory: ${outputDir}`);
2221

2322
const cwd = process.cwd();
24-
const source = path.join(cwd, inputDir, '@powersync', 'web', 'dist');
23+
const source = path.join(path.dirname(resolvedPath));
2524
const destination = path.join(cwd, outputDir, '@powersync');
2625

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

0 commit comments

Comments
 (0)