You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
In order to have properly read the package.json, when the cli app is installed globally I have to reference the package.json this way. better solutions appreciated.
var path = require('path');
var cli = require('cli');
var theFolder = path.dirname(require.main.filename);
var theFile = path.resolve(theFolder + '/../package.json');
cli.setApp(theFile);
That said, that's only better in that it’s a one-liner.
This actually is also true if cli is installed as a local package. The documentation seems to imply that the default behavior of appname --version would return the appname's version. But in fact you get cli's version, not your appname. You end up explicitly defining the app's package as above.
@chriso Is this intended behavior? If so, an update to the docs to make this a little clearer would be useful.
Activity
Toddses commentedon May 26, 2015
One way is
That said, that's only better in that it’s a one-liner.
This actually is also true if cli is installed as a local package. The documentation seems to imply that the default behavior of
appname --versionwould return the appname's version. But in fact you get cli's version, not your appname. You end up explicitly defining the app's package as above.@chriso Is this intended behavior? If so, an update to the docs to make this a little clearer would be useful.
jollycic commentedon Nov 27, 2015
+1