Skip to content

Commit

Permalink
fix(examples): Fix missing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Mar 2, 2024
1 parent 12f2112 commit a5e89be
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/gjs/gio-2-cat/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

import '@girs/gjs';
import '@girs/dom';
import '@girs/gjs/dom';
import GLib from '@girs/glib-2.0';
import Gio from '@girs/gio-2.0';

Expand Down
1 change: 1 addition & 0 deletions examples/gjs/gio-2-cat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^"
}
}
15 changes: 9 additions & 6 deletions examples/gjs/glib-2-spawn-command/main.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
// Example based on https://gist.github.com/buzztaiki/1487781/74ea93d3a30f20c7f094327db9cb263a6286f6d6
import * as GLib from './@types/glib-2.0.js';
import '@girs/gjs';
import '@girs/gjs/dom'

import GLib from '@girs/glib-2.0';
const textDecoder = new TextDecoder();

let [res, out, err, status] = GLib.spawn_command_line_sync('ls -la');
let [_res, out, _err, _status] = GLib.spawn_command_line_sync('ls -la');
if (out) print(textDecoder.decode(out));

[res, out] = GLib.spawn_command_line_sync('ls -la');
[_res, out] = GLib.spawn_command_line_sync('ls -la');
if (out) print(textDecoder.decode(out));

[res, out] = GLib.spawn_sync(null, ['/bin/ls', '-la'], null, 0, null);
[_res, out] = GLib.spawn_sync(null, ['/bin/ls', '-la'], null, 0, null);
if (out) print(textDecoder.decode(out));

[res, out] = GLib.spawn_sync(GLib.getenv('HOME'), ['/bin/ls', '-la'], null, 0, null);
[_res, out] = GLib.spawn_sync(GLib.getenv('HOME'), ['/bin/ls', '-la'], null, 0, null);
if (out) print(textDecoder.decode(out));

[res, out] = GLib.spawn_sync(null, ['ls', '-la'], null, GLib.SpawnFlags.SEARCH_PATH, null);
[_res, out] = GLib.spawn_sync(null, ['ls', '-la'], null, GLib.SpawnFlags.SEARCH_PATH, null);
if (out) print(textDecoder.decode(out));
4 changes: 4 additions & 0 deletions examples/gjs/glib-2-spawn-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@
"typescript": "^5.2.2",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^"
}
}
3 changes: 2 additions & 1 deletion examples/gjs/gtk-3-builder/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '@girs/gjs'
import '@girs/gjs/dom'
import gladeFile from './builderExample.glade'
import * as Gtk from '@girs/gtk-3.0'
import Gtk from '@girs/gtk-3.0'

Gtk.init(null)

Expand Down
1 change: 1 addition & 0 deletions examples/gjs/gtk-3-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@girs/gjs": "workspace:^",
"@girs/gtk-3.0": "workspace:^"
}
}
1 change: 1 addition & 0 deletions examples/gjs/gtk-3-calc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/gjs": "workspace:^",
"@girs/gtk-3.0": "workspace:^"
}
}
2 changes: 2 additions & 0 deletions examples/gjs/gtk-4-application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^",
"@girs/gtk-4.0": "workspace:^"
}
}
5 changes: 5 additions & 0 deletions examples/gjs/gtk-4-custom-widget/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// This example is based on https://github.com/romgrk/node-gtk/blob/master/examples/gtk-4-custom-widget.js

import '@girs/gjs';
import '@girs/gjs/dom';
import '@girs/gio-2.0';
import '@girs/gtk-4.0';

import GObject from 'gi://GObject?version=2.0';
import GLib from 'gi://GLib?version=2.0';
import Gtk from 'gi://Gtk?version=4.0';
Expand Down
1 change: 1 addition & 0 deletions examples/gjs/gtk-4-custom-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/gtk-4.0": "workspace:^"
}
Expand Down
4 changes: 4 additions & 0 deletions examples/gjs/gtk-4-list-store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* @source https://github.com/optimisme/gjs-examples/blob/master/egList.js
*/

import '@girs/gjs/dom';
import '@girs/gio-2.0';
import '@girs/gtk-4.0';

import imports from '@girs/gjs'
import GObject from 'gi://GObject?version=2.0';
import GLib from 'gi://GLib?version=2.0';
Expand Down
1 change: 1 addition & 0 deletions examples/gjs/gtk-4-list-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/gtk-4.0": "workspace:^"
}
Expand Down
5 changes: 5 additions & 0 deletions examples/gjs/gtk-4-template/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
// SPDX-FileCopyrightText: 2021 Andy Holmes <[email protected]>
// Based on https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/gtk4-template.js

import '@girs/gjs';
import '@girs/gjs/dom';
import '@girs/gio-2.0';
import '@girs/gtk-4.0';

import GObject from 'gi://GObject?version=2.0';
import Gio from 'gi://Gio?version=2.0';
import GLib from 'gi://GLib?version=2.0';
Expand Down
1 change: 1 addition & 0 deletions examples/gjs/gtk-4-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/gtk-4.0": "workspace:^"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gjs/gtk-4-template/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"noImplicitThis": true,
"alwaysStrict": true,
},
"include": ["@girs/gjs"],
"include": [],
"files": [
"main.ts",
]
Expand Down
6 changes: 5 additions & 1 deletion examples/gjs/run-async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/adw-1": "workspace:^"
"@girs/adw-1": "workspace:^",
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^",
"@girs/gtk-4.0": "workspace:^"
}
}
4 changes: 4 additions & 0 deletions examples/gjs/soup-3-http/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
// https://developer.gnome.org/libsoup/stable/libsoup-client-howto.html
// https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/http-client.js

import '@girs/gjs';
import '@girs/gjs/dom';
import '@girs/soup-3.0';

import Gio from 'gi://Gio?version=2.0';
import GLib from 'gi://GLib?version=2.0';
import Soup from 'gi://Soup?version=3.0';
Expand Down
6 changes: 5 additions & 1 deletion examples/gjs/soup-3-http/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// This is a simple example of a HTTP server in GJS using libsoup 3
// https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/http-server.js

import '@girs/gjs';
import '@girs/gjs/dom';
import '@girs/soup-3.0';

import GLib from 'gi://GLib?version=2.0';
import Soup from 'gi://Soup?version=3.0';

Expand Down Expand Up @@ -66,7 +70,7 @@ const helloHandler: Soup.ServerCallback = (server, msg, path, query) => {
}

function main() {
let server = new Soup.Server({});
let server = new Soup.Server();
server.add_handler('/', handler);
server.add_handler('/hello', helloHandler);
server.listen_local(1080, Soup.ServerListenOptions.IPV4_ONLY);
Expand Down
3 changes: 3 additions & 0 deletions examples/gjs/soup-3-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^",
"@girs/soup-3.0": "workspace:^"
}
}
5 changes: 4 additions & 1 deletion examples/gjs/soup-3-websocket/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

// Based on https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/websocket-client.js

import imports from '@girs/gjs';
import '@girs/gjs';
import '@girs/gjs/dom';
import '@girs/soup-3.0';

import GLib from 'gi://GLib?version=2.0';
import Soup from 'gi://Soup?version=3.0';
import Gio from 'gi://Gio?version=2.0';
Expand Down
1 change: 1 addition & 0 deletions examples/gjs/soup-3-websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^",
"@girs/soup-3.0": "workspace:^"
}
}
2 changes: 1 addition & 1 deletion examples/gjs/soup-3-websocket/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"noImplicitThis": true,
"alwaysStrict": true,
},
"include": ["@girs/gjs", "@girs/gjs/dom"],
"include": [],
"files": [
"client.ts",
]
Expand Down
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8135,6 +8135,7 @@ __metadata:
resolution: "@ts-for-gir-example/gio-2-cat-example@workspace:examples/gjs/gio-2-cat"
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/glib-2.0": "workspace:^"
esbuild: "npm:^0.20.1"
typescript: "npm:^5.2.2"
Expand Down Expand Up @@ -8164,6 +8165,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/gjs-gtk-4-custom-widget-example@workspace:examples/gjs/gtk-4-custom-widget"
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/gtk-4.0": "workspace:^"
"@ts-for-gir/cli": "workspace:^"
Expand All @@ -8176,6 +8178,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/glib-2-spawn-command-example@workspace:examples/gjs/glib-2-spawn-command"
dependencies:
"@girs/gjs": "workspace:^"
"@girs/glib-2.0": "workspace:^"
fork-ts-checker-webpack-plugin: "npm:^9.0.2"
ts-loader: "npm:^9.5.1"
typescript: "npm:^5.2.2"
Expand Down Expand Up @@ -8213,6 +8217,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/gtk-3-builder-example@workspace:examples/gjs/gtk-3-builder"
dependencies:
"@girs/gjs": "workspace:^"
"@girs/gtk-3.0": "workspace:^"
fork-ts-checker-webpack-plugin: "npm:^9.0.2"
raw-loader: "npm:^4.0.2"
Expand All @@ -8227,6 +8232,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/gtk-3-calc-example@workspace:examples/gjs/gtk-3-calc"
dependencies:
"@girs/gjs": "workspace:^"
"@girs/gtk-3.0": "workspace:^"
esbuild: "npm:^0.20.1"
typescript: "npm:^5.2.2"
Expand Down Expand Up @@ -8310,7 +8316,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/gtk-4-application-example@workspace:examples/gjs/gtk-4-application"
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/glib-2.0": "workspace:^"
"@girs/gtk-4.0": "workspace:^"
esbuild: "npm:^0.20.1"
typescript: "npm:^5.2.2"
Expand All @@ -8321,6 +8329,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/gtk-4-list-store-example@workspace:examples/gjs/gtk-4-list-store"
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/gtk-4.0": "workspace:^"
esbuild: "npm:^0.20.1"
Expand All @@ -8332,6 +8341,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/gtk-4-template-example@workspace:examples/gjs/gtk-4-template"
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/gtk-4.0": "workspace:^"
"@ts-for-gir/cli": "workspace:^"
Expand All @@ -8345,6 +8355,10 @@ __metadata:
resolution: "@ts-for-gir-example/run-async-example@workspace:examples/gjs/run-async"
dependencies:
"@girs/adw-1": "workspace:^"
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/glib-2.0": "workspace:^"
"@girs/gtk-4.0": "workspace:^"
esbuild: "npm:^0.20.1"
typescript: "npm:^5.2.2"
languageName: unknown
Expand All @@ -8354,6 +8368,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ts-for-gir-example/soup-3-http-example@workspace:examples/gjs/soup-3-http"
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/glib-2.0": "workspace:^"
"@girs/soup-3.0": "workspace:^"
esbuild: "npm:^0.20.1"
typescript: "npm:^5.2.2"
Expand All @@ -8366,6 +8383,7 @@ __metadata:
dependencies:
"@girs/gio-2.0": "workspace:^"
"@girs/gjs": "workspace:^"
"@girs/glib-2.0": "workspace:^"
"@girs/soup-3.0": "workspace:^"
esbuild: "npm:^0.20.1"
typescript: "npm:^5.2.2"
Expand Down

0 comments on commit a5e89be

Please sign in to comment.