Snapping via electron-builder - How do I use yarn

I am learning a lot about snapcraft and snaps in general, and finished snapping up a text editor via the nodejs plugin.

I then watched This talk by @Wimpress, where he talks about snapping via the electron-builder.

Now, I am trying to re snap a text editor, and in order to use the electron builder, I would need yarn

Hence, I wrote up a part, to just make sure, I have yarn at build time.

parts:
  editor:
    plugin: nodejs
    node-engine: 6.11.2
    node-package-manager: yarn
    source: .
    stage-packages:[...]

Is there something more I should be doing to have yarn run at build time?

because, I then added a prepare block to check

 prepare: |
        yarn --version

and snapcraft says yarn is not recognized

Ugh! I rather feel a bit silly now, re watched the video, and One can either use snapcraft , or use electron-builder I suppose.

If you’re using electron-builder then you should just install yarn on your machine, install electron-builder from that, and then just run the electron-builder program ensuring that it spits out a .snap at the end of its build process? I’m not sure what the recommended method to install Electron apps is at the moment, @Wimpress would know.

2 Likes