A jscodeshift transform that helps migrating GNOME Shell extensions to 3.32.
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()
andnew GObject.Class()
with the ES6class
syntax.- If the old class is a GObject class, wrap the new class with
GObject.registerClass()
.
- If the old class is a GObject class, wrap the new class with
- Replace
_init()
withconstructor
, if the old class is not a GObject class. - Replace
this.parent()
withsuper.methodName()
, orsuper()
if it's instead theconstructor
. - Add import for
GObject
if any old class was a GObject class, and remove import forLang
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.
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
.