From a5e89be4ac0baa3b372a1f0f5a55baaa45d25431 Mon Sep 17 00:00:00 2001 From: Pascal Garber Date: Sat, 2 Mar 2024 21:15:07 +0100 Subject: [PATCH] fix(examples): Fix missing dependencies --- examples/gjs/gio-2-cat/main.ts | 2 +- examples/gjs/gio-2-cat/package.json | 1 + examples/gjs/glib-2-spawn-command/main.ts | 15 +++++++++------ examples/gjs/glib-2-spawn-command/package.json | 4 ++++ examples/gjs/gtk-3-builder/main.ts | 3 ++- examples/gjs/gtk-3-builder/package.json | 1 + examples/gjs/gtk-3-calc/package.json | 1 + examples/gjs/gtk-4-application/package.json | 2 ++ examples/gjs/gtk-4-custom-widget/index.ts | 5 +++++ examples/gjs/gtk-4-custom-widget/package.json | 1 + examples/gjs/gtk-4-list-store/main.ts | 4 ++++ examples/gjs/gtk-4-list-store/package.json | 1 + examples/gjs/gtk-4-template/main.ts | 5 +++++ examples/gjs/gtk-4-template/package.json | 1 + examples/gjs/gtk-4-template/tsconfig.json | 2 +- examples/gjs/run-async/package.json | 6 +++++- examples/gjs/soup-3-http/http-client.ts | 4 ++++ examples/gjs/soup-3-http/http-server.ts | 6 +++++- examples/gjs/soup-3-http/package.json | 3 +++ examples/gjs/soup-3-websocket/client.ts | 5 ++++- examples/gjs/soup-3-websocket/package.json | 1 + examples/gjs/soup-3-websocket/tsconfig.json | 2 +- yarn.lock | 18 ++++++++++++++++++ 23 files changed, 80 insertions(+), 13 deletions(-) diff --git a/examples/gjs/gio-2-cat/main.ts b/examples/gjs/gio-2-cat/main.ts index 66c77b220..1d0771a3d 100644 --- a/examples/gjs/gio-2-cat/main.ts +++ b/examples/gjs/gio-2-cat/main.ts @@ -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'; diff --git a/examples/gjs/gio-2-cat/package.json b/examples/gjs/gio-2-cat/package.json index 06ac3fe2f..3f0f31553 100644 --- a/examples/gjs/gio-2-cat/package.json +++ b/examples/gjs/gio-2-cat/package.json @@ -25,6 +25,7 @@ }, "dependencies": { "@girs/gio-2.0": "workspace:^", + "@girs/gjs": "workspace:^", "@girs/glib-2.0": "workspace:^" } } diff --git a/examples/gjs/glib-2-spawn-command/main.ts b/examples/gjs/glib-2-spawn-command/main.ts index 6b9683d03..a74407807 100644 --- a/examples/gjs/glib-2-spawn-command/main.ts +++ b/examples/gjs/glib-2-spawn-command/main.ts @@ -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)); \ No newline at end of file diff --git a/examples/gjs/glib-2-spawn-command/package.json b/examples/gjs/glib-2-spawn-command/package.json index ef0701616..fb80ef81d 100644 --- a/examples/gjs/glib-2-spawn-command/package.json +++ b/examples/gjs/glib-2-spawn-command/package.json @@ -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:^" } } diff --git a/examples/gjs/gtk-3-builder/main.ts b/examples/gjs/gtk-3-builder/main.ts index 3fbd128f8..20635611d 100644 --- a/examples/gjs/gtk-3-builder/main.ts +++ b/examples/gjs/gtk-3-builder/main.ts @@ -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) diff --git a/examples/gjs/gtk-3-builder/package.json b/examples/gjs/gtk-3-builder/package.json index 9c16eb520..1c4ac83c4 100644 --- a/examples/gjs/gtk-3-builder/package.json +++ b/examples/gjs/gtk-3-builder/package.json @@ -29,6 +29,7 @@ "webpack-cli": "^5.1.4" }, "dependencies": { + "@girs/gjs": "workspace:^", "@girs/gtk-3.0": "workspace:^" } } diff --git a/examples/gjs/gtk-3-calc/package.json b/examples/gjs/gtk-3-calc/package.json index 07a7f6c38..4db6e6d3a 100644 --- a/examples/gjs/gtk-3-calc/package.json +++ b/examples/gjs/gtk-3-calc/package.json @@ -24,6 +24,7 @@ "typescript": "^5.2.2" }, "dependencies": { + "@girs/gjs": "workspace:^", "@girs/gtk-3.0": "workspace:^" } } diff --git a/examples/gjs/gtk-4-application/package.json b/examples/gjs/gtk-4-application/package.json index 4f0a0b44b..605f4a021 100644 --- a/examples/gjs/gtk-4-application/package.json +++ b/examples/gjs/gtk-4-application/package.json @@ -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:^" } } diff --git a/examples/gjs/gtk-4-custom-widget/index.ts b/examples/gjs/gtk-4-custom-widget/index.ts index f79ae9419..a7da510d1 100644 --- a/examples/gjs/gtk-4-custom-widget/index.ts +++ b/examples/gjs/gtk-4-custom-widget/index.ts @@ -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'; diff --git a/examples/gjs/gtk-4-custom-widget/package.json b/examples/gjs/gtk-4-custom-widget/package.json index ba69b8646..b23726e0d 100644 --- a/examples/gjs/gtk-4-custom-widget/package.json +++ b/examples/gjs/gtk-4-custom-widget/package.json @@ -25,6 +25,7 @@ "typescript": "^5.2.2" }, "dependencies": { + "@girs/gio-2.0": "workspace:^", "@girs/gjs": "workspace:^", "@girs/gtk-4.0": "workspace:^" } diff --git a/examples/gjs/gtk-4-list-store/main.ts b/examples/gjs/gtk-4-list-store/main.ts index 48b0617e7..3133a546f 100644 --- a/examples/gjs/gtk-4-list-store/main.ts +++ b/examples/gjs/gtk-4-list-store/main.ts @@ -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'; diff --git a/examples/gjs/gtk-4-list-store/package.json b/examples/gjs/gtk-4-list-store/package.json index 4d1eebc6f..142489c70 100644 --- a/examples/gjs/gtk-4-list-store/package.json +++ b/examples/gjs/gtk-4-list-store/package.json @@ -24,6 +24,7 @@ "typescript": "^5.2.2" }, "dependencies": { + "@girs/gio-2.0": "workspace:^", "@girs/gjs": "workspace:^", "@girs/gtk-4.0": "workspace:^" } diff --git a/examples/gjs/gtk-4-template/main.ts b/examples/gjs/gtk-4-template/main.ts index 2f9ec5c03..ab24ede69 100644 --- a/examples/gjs/gtk-4-template/main.ts +++ b/examples/gjs/gtk-4-template/main.ts @@ -3,6 +3,11 @@ // SPDX-FileCopyrightText: 2021 Andy Holmes // 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'; diff --git a/examples/gjs/gtk-4-template/package.json b/examples/gjs/gtk-4-template/package.json index e39f26ddd..4b9439247 100644 --- a/examples/gjs/gtk-4-template/package.json +++ b/examples/gjs/gtk-4-template/package.json @@ -25,6 +25,7 @@ "typescript": "^5.2.2" }, "dependencies": { + "@girs/gio-2.0": "workspace:^", "@girs/gjs": "workspace:^", "@girs/gtk-4.0": "workspace:^" } diff --git a/examples/gjs/gtk-4-template/tsconfig.json b/examples/gjs/gtk-4-template/tsconfig.json index 37a61a26f..d6f56a4fc 100644 --- a/examples/gjs/gtk-4-template/tsconfig.json +++ b/examples/gjs/gtk-4-template/tsconfig.json @@ -11,7 +11,7 @@ "noImplicitThis": true, "alwaysStrict": true, }, - "include": ["@girs/gjs"], + "include": [], "files": [ "main.ts", ] diff --git a/examples/gjs/run-async/package.json b/examples/gjs/run-async/package.json index df2b5ece0..b31fa7a22 100644 --- a/examples/gjs/run-async/package.json +++ b/examples/gjs/run-async/package.json @@ -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:^" } } diff --git a/examples/gjs/soup-3-http/http-client.ts b/examples/gjs/soup-3-http/http-client.ts index a845fd418..d166ba8a2 100644 --- a/examples/gjs/soup-3-http/http-client.ts +++ b/examples/gjs/soup-3-http/http-client.ts @@ -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'; diff --git a/examples/gjs/soup-3-http/http-server.ts b/examples/gjs/soup-3-http/http-server.ts index 86ef03f3e..be3be5de3 100644 --- a/examples/gjs/soup-3-http/http-server.ts +++ b/examples/gjs/soup-3-http/http-server.ts @@ -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'; @@ -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); diff --git a/examples/gjs/soup-3-http/package.json b/examples/gjs/soup-3-http/package.json index 4d245a40c..5018f2868 100644 --- a/examples/gjs/soup-3-http/package.json +++ b/examples/gjs/soup-3-http/package.json @@ -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:^" } } diff --git a/examples/gjs/soup-3-websocket/client.ts b/examples/gjs/soup-3-websocket/client.ts index fa0ccacf6..a6f8aa4d2 100644 --- a/examples/gjs/soup-3-websocket/client.ts +++ b/examples/gjs/soup-3-websocket/client.ts @@ -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'; diff --git a/examples/gjs/soup-3-websocket/package.json b/examples/gjs/soup-3-websocket/package.json index 9239f514b..b0b3f1be3 100644 --- a/examples/gjs/soup-3-websocket/package.json +++ b/examples/gjs/soup-3-websocket/package.json @@ -26,6 +26,7 @@ "dependencies": { "@girs/gio-2.0": "workspace:^", "@girs/gjs": "workspace:^", + "@girs/glib-2.0": "workspace:^", "@girs/soup-3.0": "workspace:^" } } diff --git a/examples/gjs/soup-3-websocket/tsconfig.json b/examples/gjs/soup-3-websocket/tsconfig.json index c96aba419..28b0e03f9 100644 --- a/examples/gjs/soup-3-websocket/tsconfig.json +++ b/examples/gjs/soup-3-websocket/tsconfig.json @@ -11,7 +11,7 @@ "noImplicitThis": true, "alwaysStrict": true, }, - "include": ["@girs/gjs", "@girs/gjs/dom"], + "include": [], "files": [ "client.ts", ] diff --git a/yarn.lock b/yarn.lock index ec937304b..5bfaa5184 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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:^" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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:^" @@ -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 @@ -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" @@ -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"