Skip to content

Commit

Permalink
Merge pull request #176 from gjsify/export-without-version
Browse files Browse the repository at this point in the history
Allow to toggle between package.json support + further cleanups from the gi.ts merge
  • Loading branch information
JumpLink authored Jul 19, 2024
2 parents 80cacc3 + c95701b commit 199bb13
Show file tree
Hide file tree
Showing 186 changed files with 46,335 additions and 46,374 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ examples/**/node_modules/
examples/**/dist/
examples/**/tsconfig.alias.json

# Locally generated types
@types/

tests/**/dist/

debug.txt
Expand Down
2 changes: 1 addition & 1 deletion .ts-for-gir.all.rc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
],
ignoreVersionConflicts: true,
promisify: true,
packageYarn: true,
workspace: true,
ignore: [
'*/Colorhug-1.0', // Duplicate of ColorHug-1.0
'*/GUPnP-DLNA-1.0', // Same namespace as GUPnP-1.0.gir, is this a bug or should we merge the type definitions?
Expand Down
4 changes: 3 additions & 1 deletion .ts-for-gir.packages-all.rc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ export default {
],
ignoreVersionConflicts: true,
promisify: true,
packageYarn: true,
workspace: true,
onlyVersionPrefix: false,
package: true,
}
6 changes: 3 additions & 3 deletions .ts-for-gir.packages-gtk4.rc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import allPackagesConfig from './.ts-for-gir.packages-all.rc.js';
import gtk4PackagesConfig from './.ts-for-gir.gtk4.rc.js';

export default {
...allPackagesConfig,
modules: ['Gtk-4.0', 'Adw-1.0']
...gtk4PackagesConfig,
package: true,
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"cSpell.words": [
"outdir"
]
}
49 changes: 16 additions & 33 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,19 @@ Install the dependencies and build:

```bash
yarn install
yarn run build
yarn build
```

Generate example type definitions:

```bash
yarn run test:girs:local:gtk4
yarn build:types:packages:gtk4
```

## Gir XML Format

See [gobject-introspection/docs/gir-1.2.rnc](https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/master/docs/gir-1.2.rnc) for type definitions.

## Debugging

It is strongly recommended to use the debugger. For Visual Studio Code there are some predefined launch configurations for it.
The VSCode launch.json configuration is intended that Node was installed via [NVM](https://github.com/nvm-sh/nvm) and yarn was installed globally using npm.

Take a look at the following video, to see how the debugging process looks like:

https://user-images.githubusercontent.com/1073989/150143112-1c0a2dab-3d4c-4472-818f-8404a620cc53.mp4

## Yarn

We are using [Yarn](https://yarnpkg.com/) and its [workspace feature](https://yarnpkg.com/features/workspaces).
Expand All @@ -100,30 +91,12 @@ We have created some of them for development.
npm install -g yarn
```

### Validate
## Validate

To validate all your generated type definition files in this project run

```bash
yarn run validate:types:local
```

To validate only your type definition files for GJS

```bash
yarn run validate:types:gjs
```

To validate only your type definition files for node-gtk

```bash
yarn run validate:types:node
```

You can also validate a single type definition file like this

```bash
yarn run validate -- ./@types/gobject-2.0.d.ts
yarn validate:types:packages
```

## Test
Expand All @@ -141,9 +114,19 @@ git submodule update --init
Now you can run the test with

```bash
yarn run test:girs:local
yarn test:girs:packages
```

## Update gir files

To update the gir files we have introduced a new cli command `copy`, you can run it with our default settings as follows:

```bash
yarn copy:girs
```

This copies the latest gir file found on your machine into this repository, so that we can ensure that all developers can use the same gir files and that we always use the latest versions if possible.

# FAQ

Problem: I get the following error:
Expand All @@ -156,7 +139,7 @@ Solution:

```bash
sudo sysctl -w vm.max_map_count=262144
NODE_OPTIONS=--max-old-space-size=25600 yarn run ...
NODE_OPTIONS=--max-old-space-size=25600 yarn ...
```

# Related Projects
Expand Down
4 changes: 2 additions & 2 deletions examples/adw-1-hello/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/adw-1-hello-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Typescript hello-world example using Libadwaita",
"type": "module",
"private": true,
Expand All @@ -19,7 +19,7 @@
"license": "MIT",
"devDependencies": {
"typescript": "^5.5.3",
"vite": "^5.3.3"
"vite": "^5.3.4"
},
"dependencies": {
"@girs/adw-1": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-cat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-cat-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 example app that shows how to use Gio-2.0 to read a file from the local file system",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-dbus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-dbus-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "GJS example showing how to build a DBus server/client",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-list-model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-list-model-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "An example of implementing the GListModel interface in GJS",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/glib-2-spawn-command/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/glib-2-spawn-command-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/glib-2-variant/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/glib-2-variant-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "ts-for-gir GVariant example based on https://gjs.guide/guides/glib/gvariant.html",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-browser-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-builder-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-calc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-calc-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 calculator example app",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-editor-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"type": "module",
"targets": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-gettext/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-gettext-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 example app that shows how you can translate strings with gettext",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-hello-2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-hello-2-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 example app to demonstrate how you can connect to Gtk signals",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-hello/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-hello-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-template/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-template-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 example app to demonstrate how you can use .ui template XML files",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-webkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-webkit-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 example app to demonstrate how you can use WebKit2",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-application/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-application-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use and extend Gtk.Application",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-custom-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gjs-gtk-4-custom-widget-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "This example shows the usage of custom widgets and virtual functions in GJS",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-list-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-list-store-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "It takes the hassle away from building Gtk4 application in Python So you can create a cool application, without all the boilerplate code",
"type": "module",
"private": true,
Expand Down
6 changes: 3 additions & 3 deletions examples/gtk-4-template-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ts-for-gir-example/gtk-4-template-vite",
"version": "4.0.0-beta.6",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use .ui template XML files over a bundler",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use .ui template XML files over the Vite bundler",
"type": "module",
"private": true,
"scripts": {
Expand All @@ -19,7 +19,7 @@
"license": "MIT",
"devDependencies": {
"typescript": "^5.5.3",
"vite": "^5.3.3"
"vite": "^5.3.4"
},
"dependencies": {
"@girs/gdk-4.0": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-template/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-template",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use .ui template XML files over GJS itself",
"type": "module",
"private": true,
Expand Down
6 changes: 0 additions & 6 deletions examples/run-async/.ts-for-girrc.json

This file was deleted.

33 changes: 0 additions & 33 deletions examples/run-async/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,7 @@
// SPDX-FileCopyrightText: 2009 Red Hat, Inc.
// Based on https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/gio-cat.js

/*
* Make sure you have a non english locale installed, for example fr_FR and run
* LANGUAGE=fr_FR gjs gettext.js
* the label should show a translation of 'Print help'
*/

// import Adw from "gi://Adw";
// import GLib from "gi://GLib";
import Gio from "gi://Gio";
// import Gtk from "gi://Gtk?version=4.0";

// const mainLoop = new GLib.MainLoop(null, false);
// mainLoop.runAsync().then(() => {
// log(`Exited main loop`);
// }).catch((error) => {
// logError(error);
// });

const gioApp = new Gio.Application();
gioApp.runAsync(ARGV).then((exitStatus: number) => {
Expand All @@ -27,23 +11,6 @@ gioApp.runAsync(ARGV).then((exitStatus: number) => {
logError(error);
});

// const gtkApp = new Gtk.Application();
// gtkApp.runAsync(ARGV).then((exitStatus: number) => {
// log(`Exited with status: ${exitStatus}`);
// }).catch((error) => {
// logError(error);
// });

// const adwApp = new Adw.Application();
// adwApp.runAsync(ARGV).then((exitStatus: number) => {
// log(`Exited with status: ${exitStatus}`);
// }).catch((error) => {
// logError(error);
// });

setTimeout(() => {
// mainLoop.quit();
gioApp.quit();
// gtkApp.quit();
// adwApp.quit();
}, 1000);
2 changes: 1 addition & 1 deletion examples/run-async/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/run-async-example",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Simple GJS Gtk 3 example app that shows how you can translate strings with gettext",
"type": "module",
"private": true,
Expand Down
4 changes: 2 additions & 2 deletions examples/run-async/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"lib": ["ESNext"],
"types": ["@girs/gjs", "@girs/gjs/dom", "@girs/gio-2.0"],
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitAny": true,
},
"files": [
Expand Down
Loading

0 comments on commit 199bb13

Please sign in to comment.