I have several ember apps which use a common shared ember-cli addon. This addon has common code like models, navigation etc. I also want this addon to provide common test support code like test helpers, factories to the ember apps. However if I remove tests from .npmignore in the addon, then the test resources gets built with the ember app.
Is there a way to use the addon in an ember app, but strip the addon's tests folder on build? Or perhaps there is a better way of achieving this?
Common code can go to the addon's test-support folder. That folder would automatically get merged into the app's tests folder.
This is mentioned here - https://ember-cli.com/extending/#addon-project-structure
Related
I am trying to write an Ember component addon. After complete the template structure I think it would be nice to see the layout inside the dummy application as a sanity test.
Follow the instruction below,
The Ember CLI uses a dummy app in tests/dummy for testing. In tests/dummy/app/templates/application.hbs you can put calls to both the helper and component. Then, with ember serve, you can navigate to localhost:4200 to ensure that everything is working as expected.
http://johnotander.com/ember/2014/12/14/creating-an-emberjs-addon-with-the-ember-cli/
I generate application route using code below,
ember g route application --dummy
However when I use ember s it seems run the addon's app folder instead of tests/dummy. What should I do?
Update
I have also try to start ember s inside dummy app seems no effect. It keep show me the ember-welcome-screen instead.
The solution is simple DELETE ember-welcome-page from package.json file and then run npm install.
The reason is that ember-welcome-page only get disabled when it can find custom route defined inside your app directory.
We have an Ember app that does not use Ember-CLI. The guide says to use Ember-CLI for testing.
Can we write unit tests for parts of our application using Ember-CLI? Does this require moving to ES6 modules or can we use globals based source code for testing?
Currently I'm working on a project which uses Ember and requirejs. My plan is to migrate the project to ember-cli, but I'm facing some problems.
My app consists of multiple apps and one shared folder in which I put shared code of all other apps (like models, adapters, serializers, helpers, routes etc.). Not all of this code is used by every app, they only require what they need.
My plan is to create multiple ember apps of the apps mentioned above and move the shared code to an ember addon. Now I am wondering if it is possible to only include a part of this ember addon into the applications (only what they need). I did not find any relevant information in the docs for this use case.
Any ideas would be appreciated.
I ended up using the addon folder within my addon to share most of the files. This files can be imported from all apps and when building only the imported files are included into the final build file.
I have a simple Ember-CLI addon which provides a few helper Mixins. This addon is meant to be consumed by a set of addons which all want to do user-interface things (react to size changes, field validation, etc.).
So in essence there is a three step chain:
Ember CLI Application consumes UI Ember Addon
UI Addon consumes Mixin Addon to gain access to a common features library
Mixin Addon provides a set of Mixins to consumers
If I put the Mixins implementation into the /app/mixins directory than the UI Addon can import these mixins with an import to ../mixins/[mixin-name]. That works but when I try and move back to the actual Ember App it can no longer resolve the mixins.
I guess that's not surprising really and what I want to be able to do instead is reference the mixins directly, like so: ui-mixin-library/mixins/[mixin-name]. Unfortunately the resolver is not able to resolve this.
In order to help achieve this goal I have put all the mixins into the /addon/mixins directory -- and as the Ember-CLI page suggests -- I import and then export these in the corresponding /app/mixins folder. Doesn't seem to help. Not sure if maybe I need to run these mixins through app.import?
For reference purposes, the Mixin Addon can be found here: addon on github
Is it possible have multiple apps that share UI/CSS/libs etc. in one yeoman ember project with one Gruntfile.js?
I have tried using the Yeoman ember generator, and it is wonderful for 1 app environment at a time.
But my situation is that I have multiple ember apps (that are required to be separate because of work oriented restrictions) that all use the same UI (LESS/CSS, bower_components).
So, instead of having to initiate 5 different build environments (Yeoman ember generators) that duplicate the same UI elements, I would love to be able to have them all in one build environment instead. I have tried building the taxonomy and tweaking the grunt tasks but it seems that the Ember compiling logic for the 'generator-ember' only looks at the index.html in the root.
Any info/insight is welcome.