Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build all types without errors + migrate to ESM + type definition improvements #44

Merged
merged 104 commits into from
Jan 16, 2022
Merged

Conversation

JumpLink
Copy link
Collaborator

@JumpLink JumpLink commented Jan 7, 2022

  • All types in vala-gir can now be built and validated without errors, this can be tested with npm run test:girs:all, this test is now also executed with github actions
  • Switch to ESM for ts-for-gir itself
  • Replaced oclif with yargs for CLI parsing (yargs has ESM Support, oclif not)
  • Improved @realh's Gjs ESM support
  • Improved types based on gobject-introspection/docs/gir-1.2.rnc and gi.ts/parser/src/xml.ts
  • Changed examples/Gjs/builder example to use the Gjs ESM feature using gi:// imports
  • Version conflicts in Gir modules fixed, now multiple versions of the same module name can be generated
  • Made the source code more readable in some places, this mainly affects places where an array was returned, here a more meaningful tuple / object is now returned
  • Dependencies updated
  • It is now possible to build all gir modules from the vala-girs repository.
  • Some older girs are missing in the vala-girs repository, they are now included in this repository
  • Added some new examples

Most of my changes were some time ago, so I had to fix some merge conflicts, I hope I didn't break any of @realh's changes. But the ESM feature works as you can see in the examples/Gjs/browser example.

Breaking Changes

  • Node.js minimum version is now 16 for ESM support
  • The config files must now also be in ESM format, if they are not in json format:

Before:

module.exports = {
    modules: ['Gtk-3.0', 'Soup-2.4', 'GtkSource-3.0', 'WebKit2-4.0', 'AppIndicator3-0.1', 'Gda-5.0', 'Notify-0.7'],
    ignoreConflicts: true,
    prettify: true,
    ignore: []
}

After:

export default {
    modules: ['Gtk-3.0', 'Soup-2.4', 'GtkSource-3.0', 'WebKit2-4.0', 'AppIndicator3-0.1', 'Gda-5.0', 'Notify-0.7'],
    ignoreConflicts: true,
    prettify: true,
    ignore: []
}

@realh can you test my changes to make sure nothing of your improvements are broken?

@JumpLink JumpLink changed the title Improved ESM Support and many other improvements Migrate to ESM and type improvements Jan 10, 2022
@JumpLink JumpLink changed the title Migrate to ESM and type improvements Build all types without errors + migrate to ESM + type definition improvements Jan 11, 2022
@JumpLink
Copy link
Collaborator Author

@sammydre I did commit some improvements after creating the PR. But now the whole thing is ready for the merge if nothing speaks against it on your part or on the part of @realh 🚀

@sammydre
Copy link
Collaborator

Great work @JumpLink . I've started reading through it, but there is quite a lot here!

Will look to get it merged by the weekend

@JumpLink
Copy link
Collaborator Author

JumpLink commented Jan 13, 2022

@sammydre Yes I should get out of the habit of these big PR's. Sorry that happened to me again.

I think it makes the most sense if you just look at the src/gir-module.ts from my branch, this is where the most happened.

The change from oclif to yargs has mainly happened in the following files:

  • src/commands/generate.ts
  • src/commands/list.ts
  • src/config.ts
  • src/start.ts

And the new types are those that start with gir-* in the src/types folder.

In the ava tests, I had to add lines like these:

mod.symTable.set(mod.dependencies, 'Test.MyType', emptyConstruct)

Since the symTable is normally populated by the GirModule, but this is not the case in the tests.

I had to touch almost all other files, because I had to adjust the imports to make them work with ESM.

@sammydre sammydre merged commit 3ad88f9 into gjsify:master Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants