ember-cli-update icon indicating copy to clipboard operation
ember-cli-update copied to clipboard

How to update in-repo addons and in-repo engines

Open Duder-onomy opened this issue 7 years ago • 7 comments

Just wondering how to update in-repo engines and add-ons, specifically the codemods.

It does not traverse the lib dir running from the parent app. If I cd into the in-repo addon, and run ember-cli-update --run-codemods. I get: Ember CLI blueprint version could not be determined In-repo engines yield the same result.


If you are submitting a bug report, please run your command with the debug flag:

  • Unix (global): DEBUG=ember-cli-update,git-diff-apply ember-cli-update ...
  • Windows (global): set DEBUG=ember-cli-update,git-diff-apply && ember-cli-update ...
  • Unix (command): DEBUG=ember-cli-update,git-diff-apply ember update ...
  • Windows (command): set DEBUG=ember-cli-update,git-diff-apply && ember update ...

and post the console output in the block below:

Ember CLI blueprint version could not be determined

Duder-onomy avatar Aug 02 '18 17:08 Duder-onomy

I had originally assumed you could do the following for this:

cd lib/addon-name
ember-cli-update --run-codemods --from v2.18.0

I'm surprised you can't...

rwjblue avatar Aug 02 '18 18:08 rwjblue

We might be able to continually findUp until we find a package.json that gives us the info we need.

kellyselden avatar Aug 02 '18 19:08 kellyselden

Hmm, what info do we need? the --run-codemods should only need --from and maybe --to, right?

rwjblue avatar Aug 02 '18 19:08 rwjblue

It tries to determine if you are an ember app, addon, or glimmer app based on stuff in the package.json.

kellyselden avatar Aug 02 '18 19:08 kellyselden

But we could introduce a new option --type for you to override where to look for the output repo. That would have worked around this issue.

kellyselden avatar Aug 02 '18 19:08 kellyselden

Ok, I am digging deeper. It seems that in order for this to run on in-repo addons we assume:

  • the string 'ember-addon' in the addons package.json keywords array
  • a valid ember-cli version in the devDependencies of the in-repo addon

^ adding both of those and running: Running ./node_modules/.bin/ember-cli-update --run-codemods --from 3.1

It ran some codemods, but it did not seem to traverse the ./addon directory. Specifically, I was expecting to see the es5-getter-ember-codemod making a big diff, but nothing changed. I can confirm that it wanted to run the the es5-getter-ember-codemod as I slammed a console.log in here However, the MODULE_REPORT did report some unknown globals from the addon dir... so something did in fact traverse it?

Running: ./node_modules/.bin/ember-cli-update --to 3.1.0

Resulted in the following changes:

  • Created a config/ember-try.js in the in-repo addon
  • added .eslintrc to the in-repo addon
  • removed the 'peerDependencies' key from the package.json

Still digging.

Duder-onomy avatar Aug 03 '18 14:08 Duder-onomy

Actually, it seems like the es5-getter-ember-codemod is not intended to traverse the /addon dir. https://rawgit.com/ember-cli/ember-cli-update-codemods-manifest/v2/manifest.json ^ looking at its 'command' it only runs in the /app dir as designed.

If I change that ./app on that codemod command with ./addon I get the diff I wanted.

EDIT: Same thing in the in-repo ember-engine

Duder-onomy avatar Aug 03 '18 14:08 Duder-onomy