|
| 1 | +# Flatpak Deno Generator |
| 2 | + |
| 3 | +Run from jsr |
| 4 | + |
| 5 | +``` |
| 6 | +deno -RN -W=. jsr:@flatpak-contrib/flatpak-deno-generator deno.lock |
| 7 | +``` |
| 8 | + |
| 9 | +or locally from this repo |
| 10 | + |
| 11 | +``` |
| 12 | +deno -RN -W=. src/main.ts deno.lock --output sources.json |
| 13 | +``` |
| 14 | + |
| 15 | +This will create a `deno-sources.json` (or the name specified with --output) |
| 16 | +that can be used in flatpak build files. The sources files provides these 2 |
| 17 | +directories: |
| 18 | + |
| 19 | +- it creates and populates `./deno_dir` with npm dependencies |
| 20 | +- it creates and populates `./vendor` with jsr + http dependencies |
| 21 | + |
| 22 | +## Usage: |
| 23 | + |
| 24 | +- Use the sources file as a source, example: |
| 25 | + |
| 26 | +```yml |
| 27 | +sources: |
| 28 | + - deno-sources.json |
| 29 | +``` |
| 30 | +
|
| 31 | +- To use `deno_dir` (when your project have npm dependencies) point `DENO_DIR` |
| 32 | + env variable to it, like so: |
| 33 | + |
| 34 | +```yml |
| 35 | +- name: someModule |
| 36 | + buildsystem: simple |
| 37 | + build-options: |
| 38 | + env: |
| 39 | + # sources provides deno_dir directory |
| 40 | + DENO_DIR: deno_dir |
| 41 | +``` |
| 42 | + |
| 43 | +- To use `vendor` (when your project have http or jsr dependencies) move it next |
| 44 | + to your `deno.json` file and make sure to compile or run with `--vendor` flag, |
| 45 | + exmaple: |
| 46 | + |
| 47 | +```yml |
| 48 | +- # sources provides vendor directory |
| 49 | +- # src is where my deno project at as in deno.json is under src directory, so I'm moving vendor next to it |
| 50 | +- mv ./vendor src/ |
| 51 | +- DENORT_BIN=$PWD/denort ./deno compile --vendor --no-check --output virtaudio-bin --cached-only |
| 52 | + --allow-all --include ./src/gui.slint --include ./src/client.html ./src/gui.ts |
| 53 | +``` |
| 54 | + |
| 55 | +## Notes |
| 56 | + |
| 57 | +Currently this only supports lockfile V5 (available since deno version 2.3) |
| 58 | + |
| 59 | +## License |
| 60 | + |
| 61 | +MIT |
| 62 | + |
| 63 | +## Example |
| 64 | + |
| 65 | +- checkout https://github.com/flathub/io.github.sigmasd.VirtAudio/ |
| 66 | + |
| 67 | +## Technical Info |
| 68 | + |
| 69 | +Theoretically it would've been better to put all the dependencies in `DENO_DIR` |
| 70 | +but currently thats not possible because jsr and https dependencies have some |
| 71 | +special metadata checks made by deno, more info here |
| 72 | +https://github.com/denoland/deno/issues/29212 |
0 commit comments