pmq20/node-packer

Possibility to exclude files

TheNoim opened this issue · 10 comments

I wish there would be a option to exclude directory's and files.

@TheNoim thanks for the suggestion. May I ask a concrete example where this would be useful?

I can only think of excluding tests/ and other assets in order to reduce the binary size, but unless your project has images or other heavy assets I don't think it would be much different.

This is exactly the reason why I want this feature. If you have things like a demo gif in your repo or useless md files or anything else what only is important while developing. Or even file which a still in developing but already in the src root. I think it is such a basic feature.

@lexor90 It's also useful when you use preprocessors like Stylus. In packaged version, it's possible to include just the generated CSS files and exclude Stylus files.

pmq20 commented

Just excluded some common files by default; need to make this configurable: 945cedc

i would like some files to be excluded for a different reason: configuration files.
right now I am able to compile an exe with config files included in the exe. But this means i can't modify the configuration during run-time without re-compiling. And I find that if I remove the config file from compilation, I can't access that file as the compiled exe seems only try to look for the file from the built-in file system (/enclose_io_memfs/ ...), even tho that file is placed in the same folder as the exe.

Basically, is there a way to allow the compiled exe to access external files (outside of the exe) ?

pmq20 commented

@ledmirage Yes there is a way. It is currently only possible on the C level, but I am planning to make it to the upper level via a special environment variable. If you search for "mkdir_workdir" in the libsquash project you will find related logic.

default

That variable mkdir_workdir serves as the outside temporary location when it receives mkdir requests inside the work dir. Therefore you could mkdir a config directory and write a file to it inside the memfs, and it will be written to the outside location mkdir_workdir. If we can control mkdir_workdir via a env. var. we can let the user select a place to write the config file to, e.g. . (current dir.).

Please note that we need to both read from and write to external files.
This is the ONLY blocker for me. This library is awesome in so many ways that it broke my heart when I can't use it...

Is this thread/repo dead or what?