Best practice to keep certain files

Hi, I’m building a nodejs snap and am looking for a way to have certain files available in the snap (for example a default config file).

The solution that works for me, is to add a 2nd part like:

parts:
  my-part:
    plugin: nodejs
    ...

  content:
    source: config
    source-type: local
    plugin: dump

Is this the normal way of doing this, or is there a better way?

I also tried adding: prime: default.conf to the nodejs part, but that didn’t work.

Either could work. If the config is in the source: pointed to by my-part, then I’d use that part. In that case, maybe you just need to add an override-build scriptlet and install it to $SNAPCRAFT_PART_INSTALL/<target>.

If the config(s) are separate from my-part's source, adding another part is a good idea.