Packaging nodejs apps

Didier Roche didrocks at ubuntu.com
Mon Nov 14 10:34:17 UTC 2016


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,

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?
>
> 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).

then, in the same part you want to exclude those files:
stage: [$exclude]
snap: [$exclude]

And you should be done!
Didier





More information about the Snapcraft mailing list