Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

A jscodeshift transform that helps migrating GNOME Shell extensions to 3.32

Notifications You must be signed in to change notification settings

zhanghai/gnome-shell-extension-es6-class-codemod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gnome-shell-extension-es6-class-codemod

A jscodeshift transform that helps migrating GNOME Shell extensions to 3.32.

What it does

In order to migrate to the new ES6 class based syntax in GNOME Shell 3.32, the following changes will be made by this transform:

  • Replace new Lang.Class() and new GObject.Class() with the ES6 class syntax.
    • If the old class is a GObject class, wrap the new class with GObject.registerClass().
  • Replace _init() with constructor, if the old class is not a GObject class.
  • Replace this.parent() with super.methodName(), or super() if it's instead the constructor.
  • Add import for GObject if any old class was a GObject class, and remove import for Lang if it become unused.

The transform tries its best to preserve comments and spacing. However in some cases, you might still need to adjust the spacing manually, which is a limitation of the underlying framework.

Usage

npm install
# This will modify the files in place.
npx jscodeshift --run-in-band path/to/your/extension

To see a example, run npm test.

About

A jscodeshift transform that helps migrating GNOME Shell extensions to 3.32

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published