jsoverson / shift-refactor

A suite of utilities to query and modify JavaScript source
Apache License 2.0
131 stars 17 forks source link

What happened to convertComputedToStatic? #19

Open poison opened 4 years ago

poison commented 4 years ago

Hi Jarrod,

I don't see to find any reference to convertComputedToStatic() in the code anymore, while it's still in the README. Did you rename the method?

BTW: awesome video's you've recorded (just discovered them), trying to figure out the difference between the new chainable API and the methods used in the video.

Best regards, Nicolas

ghost commented 4 years ago

I am wondering the same thing, I was able to find: https://www.npmjs.com/package/refactor-plugin-common

It seems like Jarrod moved it into a separate plugin package however attempting to plug it into the refactor-session-chainable gives this error:

Object.assign(this, plugin(this)); ^ TypeError: plugin is not a function

With this code:

const { RefactorSession, refactor } = require("shift-refactor"); const commonMethods = require('refactor-plugin-common');

const $script = refactor(fileContents, commonMethods);

crossworth commented 3 years ago

const commonMethods = require('refactor-plugin-common'); returns an object with a function.

Changing to const { commonMethods } = require('refactor-plugin-common'); seems to work.