Update flatpak build instructions to use npm

This commit is contained in:
FoxxMD
2023-03-21 16:54:23 -04:00
parent a5b5fe8d2a
commit e524077242
2 changed files with 8 additions and 26 deletions
+5 -21
View File
@@ -8,12 +8,6 @@ Install [Flatpak](https://flatpak.org/setup/)
Install [flatpak-builder](https://docs.flatpak.org/en/latest/first-build.html#building-your-first-flatpak)
## Yarn
```console
npm install -g yarn
```
## [flatpak-node-generator](https://github.com/flatpak/flatpak-builder-tools/tree/master/node)
Requires python 3.7+, [pip](https://pip.pypa.io/en/stable/)/[pipx](https://pypa.github.io/pipx/)
@@ -24,29 +18,19 @@ Requires python 3.7+, [pip](https://pip.pypa.io/en/stable/)/[pipx](https://pypa.
Set the `branch` `tag` or `commit` to use for MS in the `git` source in [`io.github.multiscrobbler.yml`](/flatpak/io.github.multiscrobbler.yml)
# 2. Use Yarn to generate lock file
# 2. Use `flatpak-node-generator` to generate sources
Currently [flatpak-node-generator](https://github.com/flatpak/flatpak-builder-tools/tree/master/node) does not like building from npm `package-lock.json` so we need to use yarn to create a lock file before using it. I also do not want to switch to yarn as of now because dockerfile and all docs use npm shrug.jpg
First, [make sure `node_modules` is deleted or empty.](https://github.com/flatpak/flatpak-builder-tools/issues/354#issuecomment-1478518442)
From the MS project root:
```console
yarn
```
Should generate a `yarn.lock` file
# 3. Use `flatpak-node-generator` to generate sources
From MS project root:
Then, from MS project root:
```
flatpak-node-generator yarn yarn.lock
flatpak-node-generator npm package-lock.json
```
Move `generated-sources.json` into [`/flatpak`](/flatpak)
# 4. Build flatpak
# 3. Build flatpak
From MS project root:
+3 -5
View File
@@ -21,10 +21,8 @@ modules:
npm_config_offline: 'true'
build-commands:
# Install npm dependencies
# reference https://github.com/flatpak/flatpak-builder-tools/issues/103
- HOME=$PWD yarn config --offline set yarn-offline-mirror $FLATPAK_BUILDER_BUILDDIR/flatpak-node/yarn-mirror
- yarn --offline
# makes node and npm available?
- npm install --offline
# makes node and npm available
- mkdir -p /app/bin /app/lib /app/lib/src
- cp -a /usr/lib/sdk/node18/bin/{node,npm} /app/bin
- cp -a /usr/lib/sdk/node18/lib/* /app/lib
@@ -42,7 +40,7 @@ modules:
# tag: 0.4.4
# dest: main
- type: dir
path: '.'
path: '..'
skip:
- '.flatpak-builder'
- 'node_modules'