Skip to content

Commit 92d2632

Browse files
authored
Add Flatpak Deno generator
1 parent 44d9b40 commit 92d2632

File tree

13 files changed

+872
-0
lines changed

13 files changed

+872
-0
lines changed

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ dotnet:
1010
- changed-files:
1111
- any-glob-to-any-file: dotnet/**
1212

13+
deno:
14+
- changed-files:
15+
- any-glob-to-any-file: deno/**
16+
1317
dub:
1418
- changed-files:
1519
- any-glob-to-any-file: dub/**

.github/workflows/deno.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
paths:
6+
- deno/**
7+
branches:
8+
- master
9+
pull_request:
10+
paths:
11+
- deno/**
12+
branches:
13+
- master
14+
15+
defaults:
16+
run:
17+
working-directory: deno
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
deno:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Setup repo
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Deno
31+
uses: denoland/setup-deno@v2
32+
33+
- name: Verify formatting
34+
run: deno fmt --check
35+
36+
- name: Run linter
37+
run: deno lint
38+
39+
- name: Run type check
40+
run: deno check .
41+
42+
- name: Run tests
43+
run: deno test -A

.github/workflows/publish-jsr.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish
2+
on:
3+
push:
4+
paths:
5+
- deno/**
6+
branches:
7+
- master
8+
9+
defaults:
10+
run:
11+
working-directory: deno
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
id-token: write
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup Deno
25+
uses: denoland/setup-deno@v2
26+
27+
- name: Publish package
28+
run: deno publish

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
deno/coverage

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
/spm/ @david-swift
55
/gradle/ @hadess
6+
/deno/ @sigmasd

deno/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

deno/deno.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@flatpak-contrib/flatpak-deno-generator",
3+
"version": "1.3.0",
4+
"exports": "./src/main.ts",
5+
"license": "MIT"
6+
}

deno/deno.lock

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)