Packaging nodejs apps

Didier Roche didrocks at ubuntu.com
Mon Nov 14 11:24:52 UTC 2016


Le 14/11/2016 à 12:19, Stephen Stewart a écrit :
> On Mon, Nov 14, 2016 at 10:34 AM Didier Roche <didrocks at ubuntu.com
> <mailto:didrocks at ubuntu.com>> wrote:
>
>     Le 14/11/2016 à 10:55, Stephen Stewart a écrit :
>     > Hi,
>     >
>     > While looking into a nodejs/yarn plugin I wondered if I could make a
>     > yarn snap (not plugin), and simply define nodejs and yarn as parts,
>     > use dump plugin and be done, no plugin required:
>     >
>     > "Parts 'yarn' and 'node' have the following file paths in common
>     which
>     > have different contents:"
>     >
>     > https://pastebin.canonical.com/170573/
>     >
>     > So I am wondering why doesn't this just work?
>
>     Hey Stephen,
>
>
> Hi Didier,
>  
>
>
>     It doesn't work simply because snapcraft doesn't know which file from
>     which part to ship. You have common files between parts with different
>     contents (as the error message underline). Which one of yarn's or
>     node's
>     README.md should be included for instance?
>
>
> Fair enough, but ...
>  
>
>     >
>     > It seems like name collisions in parts might be a common enough
>     thing,
>     > and I couldn't quite understand the help docs around filesets and
>     > organise to see a nice way to make this work for me across projects.
>
>     I guess http://snapcraft.io/docs/build-snaps/advanced-features
>     will be a
>     better example.
>     Basically, you define in one parts a fileset with:
>     filesets:
>       exclude:
>         - -README.md
>         - - LICENSE
>         - -lib/constants.js
>     (note the - to say to exclude those 3 files).
>
>
> ... sure, but both parts need `lib/constants.js`; I can't exclude
> lib/constants for one part and hope that my snap will work, can I?
>
> I feel like I'm missing something really obvious here :(

Ah, in that case, it means that you need to install both nodejs and yarn
(I don't know the latter) in different install path, and have wrappers
so that they know how to find each other IMHO.

You can use organize to rename a directory in the stage and prime
directory, that would be a good way to install in different path with
the dump plugin.
However, you will need to provide those wrappers scripts/glue code so
that one can know about the other.

Cheers,
Didier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161114/5287a52c/attachment.html>


More information about the Snapcraft mailing list