diff --git a/.changeset/good-ghosts-rush.md b/.changeset/good-ghosts-rush.md new file mode 100644 index 000000000..6032f6f14 --- /dev/null +++ b/.changeset/good-ghosts-rush.md @@ -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. diff --git a/packages/web/bin/powersync.js b/packages/web/bin/powersync.js index 8f57486ef..60dec0ab9 100755 --- a/packages/web/bin/powersync.js +++ b/packages/web/bin/powersync.js @@ -13,12 +13,14 @@ program .description('Copy assets to the specified output directory') .option('-o, --output ', '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