How to enable forced listing with ember serve - ember.js

I need to enable forced es-linting with ember serve. When ever ember serve is run server should hold till all the es-lintings errors are fixed. I can do it with custom npm script, but want to look for ember-cli alternatives before writing my own scripts.

You can enable ESLint via the Ember CLI ESLint addon. And it will integrate with ember test (or testing via the browser interface). I don't know if it'll actually fail the build, but it will fail your tests if you setup the ESLint rules to be errors, not just warnings.

Related

Configure Ember CLI Mirage to support liverload for mirage configuration with Embroider

I have an Ember.js application, which uses Embroider and Ember CLI Mirage. Sadly live-reload is not working for Mirage configuration changes. A change to Mirage configuration does not trigger a rebuild. It seems as if mirage/ folder is not watched.
I reproduced this issue in a newly created Ember application using Ember CLI v4.1 with the --embroider flag. So it is not related to any special configuration of my application.
Do I need to configure Embroider somehow to watch mirage/ folder?
I think this probably related to: https://github.com/embroider-build/embroider/issues/972
and there could certainly be more documentation, but there was a similar issue with Docfy here: https://github.com/josemarluedke/docfy/issues/110
Does this work with mirage?:
EMBROIDER_REBUILD_ADDONS='ember-cli-mirage' ember s

Django/React Dev Servers Choices

I'm new to React. I'm building a project that uses Django to make a REST API and React to access the api. I have my backend running on http://localhost:8000/ & my frontend running on http://localhost:3000/. My frontend makes api requests to http://localhost:8000/api/v1/.
I found this tutorial to get my frontend running on the index of http://localhost:8000/ for dev purposes. I would still have to have my React dev server and my Django dev server, but I also had to run 'npm run eject'.
Is there any advantage to either of these setups? I don't know too much about 'npm run eject' but since I can't go back from it, is it better off to wait on ejecting until I'm closer to deployment?
edit* - one advantage I see with the latter method, is I can set my permissions as so
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
#'rest_framework.permissions.AllowAny',
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
instead of having to allow any. This would really only become an issue for deployment purposes too though.
this is what I found on documentation-link for npm run eject
this is a one-way operation. Once you eject, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
It moves create-react-app’s configuration files and dev/build/test scripts into you app directory.
If you don’t have a need to modify the config or scripts you don’t need to eject. Doing so will prevent you from being able to update to new versions of create-react-app.
create-react-app gives you a fast and easy way to get up and running. It encapsulates the project setup and gives you tools to create production ready apps.
When you run npm eject it gives you access to all config files. This can be useful if you want to edit the webpack setup
so it has it's pros and cons choose what's best for you.

Ember server does not serve dummy app while creating an addon

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.

EmberJS (without ember-cli) development behind firewall using systemjs or any other loader

I am planning to use EmberJS for a small application in my day job. I have used a little ember on my laptop using ember-cli. However at work I don't have access to Github.
I am planning to download the libraries and start using without any tools like npm, bower. I have tried to setup a static web app at https://github.com/mmrath/ember-standalone
There is not much code in there. I have tried to keep the structure as close to ember-cli as possible, os that it will be easier for me to upgrade to ember-cli when access is available. I would like to use ES6 modules like in ember-cli. However the fist step of loading the Ember is not working.
Error I see in chrome console is
Error: http://localhost:4200/vendor/ember/ember.debug.js detected as System.register but didn't execute.

Use ember cli mock server as actual server

I'm using ember-cli with Firebase for my data. I also have a simple server file I created with http-mock that handles some processes for Twilio. Is there a way to use that http-mock as an actual server on Heroku? I have found an embercli stack for heroku but I'm not sure how to make that use the server file I have:
https://github.com/tonycoco/heroku-buildpack-ember-cli
Thank you in advance for the help.
I believe that build pack just deploys your app's static files to Heroku.
The http-mock file you're working with within Ember CLI is a Node Express app. So, you'd need to host it on a server that can serve node apps somewhere.
In theory you could write a script that does that (deploys it separately) while keeping it within your main repo, but like others have said that's probably not a good idea.
In the future, though, you probably will be able to use http-mocks both for clicking around your app with ember serve, and for use in your tests.