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

If !shouldIncludeStyleguide, exclude the instance initializer #27

Merged
merged 3 commits into from
May 23, 2018

Conversation

aaxelb
Copy link
Contributor

@aaxelb aaxelb commented May 18, 2018

I tried using this addon in an engine, and the instance initializer's import Router from '../router'; would error because there is no router there.

I'm not sure the best way to make this fully support engines, but best I could tell the instance initializer is only relevant when the styleguide is enabled. This PR excludes the instance initializer from the app tree if shouldIncludeStyleguide is false, which means it can be used in engines, at least.

Copy link
Contributor

@samselikoff samselikoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this!

Would you be able to update import-files-test.js to assert that the initializer is removed?

index.js Outdated
return new Funnel(appTree, {
exclude: ['**/instance-initializers/ember-cli-tailwind.js'],
});
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to have early returns, could we change the style to

treeForApp(tree) {
  let appTree = this._super(tree);
  
  if (!this._shouldIncludeStyleguide()) {
    appTree =  new Funnel(appTree, {
      exclude: ['**/instance-initializers/ember-cli-tailwind.js'],
    });
  } 

  return appTree;
}

@aaxelb
Copy link
Contributor Author

aaxelb commented May 21, 2018

@samselikoff Done 👍

@jrowlingson
Copy link
Contributor

It looks like this change supports item no 2 #17

@samselikoff samselikoff merged commit 091c6e6 into embermap:master May 23, 2018
@samselikoff
Copy link
Contributor

Thank you!

@jrowlingson
Copy link
Contributor

This change is needed for projects with module unification enabled.

@samselikoff
Copy link
Contributor

@jrowlingson it's been released in 0.6.0

@aaxelb aaxelb deleted the no-styleguide branch September 5, 2018 16:02
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.

3 participants