clkao / plv8x

Helpers for managing plv8 javascript modules
Other
67 stars 23 forks source link

plv8x -i qs:/path/to/qs/package.json - Does not work #24

Open bendiy opened 9 years ago

bendiy commented 9 years ago

The command in your example does not work as expected. I'm running this:

git clone git://github.com/clkao/plv8x.git
cd plv8x
sudo npm i -g .
npm install LiveScript
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -l
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -i LiveScript:node_modules/LiveScript/package.json
npm install qs
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -i qs:node_modules/qs/package.json
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -l

It causes #23 to happen.

I did not want to install these packages globally with the -g flag, so I just ran npm install qs and pointed to the package.js.

What does work is this:

git clone git://github.com/clkao/plv8x.git
cd plv8x
sudo npm i -g .
sudo npm i -g LiveScript
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -l
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -i LiveScript
sudo npm i -g qs
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -i qs
plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -l

But that requires a global install of the packages I want to load.

bendiy commented 9 years ago

I think I've found a work around for this issue. If I point to the full path, instead of the relative path, it loads the package correctly. So in the example above:

plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -i LiveScript:node_modules/LiveScript/package.json

needs to be:

plv8x -d postgresql://admin:admin@192.168.0.1:5432/testplv8x -i LiveScript:/home/my-user-here/some-path/node_modules/LiveScript/package.json

Can the README.md be changed to:

% npm i -g qs
% plv8x -i qs # same as: plv8x -i qs:/full/path/to/qs/package.json
% psql test

Or add support for relative paths?