Pkg: Have pkg ignore files or directories (.pkgignore?)

Created on 8 May 2017  Â·  5Comments  Â·  Source: vercel/pkg

Hello!

I was wondering if there was a way to ignore a specific missing file.
Summary:
pkg tries to resolve all path.join calls and we can be punished for a missing file that might not be important. A .pkgignore file might make sense for this?

Long version:
Here's my use case because maybe there's another/cleaner way of fixing this.
When I try to build my binaries I get this error:

> Error! Cannot stat, ENOENT
  /Users/zmarouf/my_module/node_modules/tabtab/.completions/cache.json
  The file was required from '/Users/zmarouf/my_module/node_modules/tabtab/src/cache.js'

This is the problematic code:

var cachefile = path.join(__dirname, '../.completions/cache.json');
...
this._cache = exists(cachefile) ? require(cachefile) : { timestamp: Date.now(), cache: {} };

My hacky way of fixing this right now is to just touch the missing file but that's—well— ugly and not very practical.

What do you think? What are your suggestions on this? :)
I did a quick search in the issues for a similar problem but it didn't yield anything.
If there's already an open/closed discussion about this then could you please direct me to it?

Thank you in advance for your time!

Most helpful comment

What do you think follow a similar approach than up?https://up.docs.apex.sh/#configuration.ignoring_files

Just with a list of git ignore pattern matches at .pkgignore could simplify it.

All 5 comments

Please upgrade to [email protected] and try again

Works great. 'So happy to be able to ditch the ugly intermediate touch command.
Thanks! :)

I've seen this problem with another dependency (and another file name):

Error! Cannot stat, ENOENT
/home/tasso/project/node_modules/strong-globalize/lib/local-credentials.json
The file was required from '/home/tasso/project/node_modules/strong-globalize/lib/translate.js'

What do you think follow a similar approach than up?https://up.docs.apex.sh/#configuration.ignoring_files

Just with a list of git ignore pattern matches at .pkgignore could simplify it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gpip picture gpip  Â·  3Comments

serzhiio picture serzhiio  Â·  3Comments

ndrantotiana picture ndrantotiana  Â·  4Comments

hellower picture hellower  Â·  3Comments

ydubois-fr picture ydubois-fr  Â·  4Comments