name: framapiaf
base: core18
version: '0.1'
summary: Pouet on Mastodon with Framapiaf
description: |
Framapiaf is a Mastodon instance
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
parts:
electron-app:
source: app/
plugin: nodejs
stage-packages:
- libnotify4
- libappindicator1
- libxtst6
- libnss3
- libxss1
- fontconfig-config
- gconf2
- libasound2
- pulseaudio
after:
- desktop-gtk2
build: node_modules/.bin/electron-builder
install: |
mkdir $SNAPCRAFT_PART_INSTALL/app
mv dist/linux-unpacked/* $SNAPCRAFT_PART_INSTALL/app
prime:
- -node_modules
apps:
framapiaf:
command: env TMPDIR=$XDG_RUNTIME_DIR desktop-launch $SNAP/app/framapiaf
plugs:
- home
- x11
- unity7
- browser-support
- network
- gsettings
- pulseaudio
- opengl
and this is the error message:
snapcraft build
The snap/ directory is meant specifically for snapcraft, but it contains the following non-snapcraft-related paths, which is unsupported and will cause unexpected behavior:
- .snapcraft.yaml.swp
If you must store these files within the snap/ directory, move them to snap/local/, which is ignored by snapcraft.
Launching a VM.
The snap/ directory is meant specifically for snapcraft, but it contains the following non-snapcraft-related paths, which is unsupported and will cause unexpected behavior:
- .snapcraft.yaml.swp
If you must store these files within the snap/ directory, move them to snap/local/, which is ignored by snapcraft.
Failed to load plugin: properties failed to load for electron-app: Additional properties are not allowed ('build', 'install' were unexpected)
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft build' with 'multipass': returned exit code 2.
According to the tutorial:
Build and post-build instructions
Then we need to provide the following information:
The command (or commands) to build the app:
Since we are using electron-builder, simply calling electron-builder in the project will pick up details from our package.json file and generate an executable.
What to do with the result of our build:
The result of running electron-builder is a app/dist/linux-unpacked/, this is what we want in the snap, in a dedicated app/ directory for consistency.
What to package (and in our case, what not to package):
To ensure the snap package doesn’t contain unnecessary files, we tell snapcraft to trim what it pulls into the snap and exclude app/node_modules/, which only contains build dependencies.
So can you help me to understand what I’m doing wrnog ?
you have a vim swap file in the source dir, remove it (save and close all open vim instances in which you have snapcraft.yaml open, then rm .snapcraft.yaml.swp (if it still exists), then try calling snapcraft again)
The .snapcraft.yml.swp is not the cause of the issue. The issue is looged with the last three lines.
I run snapcraft build command this time with the snapcraft.yml closed:
Launching a VM.
2019-01-14T06:01:02Z INFO Waiting for restart...
core 16-2.36.3 from Canonical✓ installed
snapcraft 3.0.1 from Canonical✓ installed
core18 18 from Canonical✓ installed
Failed to load plugin: properties failed to load for electron-app: Additional properties are not allowed ('build', 'install' were unexpected)
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft build' with 'multipass': returned exit code 2.
As you see, it failed to load plugins, saying the properties build and install are not allowed for the electron-app part, but the tutorial talk about it
The tutorial was based on Ubuntu 16.04 LTS and use cleanbuild command to build snap, that launches a LXC container.
But now with Ubuntu 18.04 LTS, it seems that we can use a base keyword, with is set to core18 in my snapcraft.yml and the build is done with multipass.
So maybe I have to adapt things to be able to build my snap ?
as popey said, the “build” and “install” snippets have been renamed (well, install has actually been removed completely) … instead of build: you want to do something like:
override-build:
# script stuff to run before the build
snapcraftctl build
# script stuff to run after the build (i.e. install stuff)
I would propose we remove that tutorial because it’s now completely different from how I’d recommend making an electron app these days. Aside from the questionable value in making an electron app wrapper of a website in the first place.
These days I’d just use electron-builder and have it build a snap electron-builder -l snap rather than call snapcraft at all. electron-builder knows how to build snaps without being given a snapcraft.yaml at all.
Thx for your answer. I’ll try with this process then.
For the questionable value in making an electron app wrapper of a website, it’s very simple. Having my professional tools (bitbucket, rocketchat, jenkins, etc) working as apps I can tile (and remove decoration), that I can summon as an App or having them into my Menu.