What is ember-cli?
Ember CLI is the command line interface for managing and developing Ember.js applications. It provides a robust set of tools for scaffolding, building, testing, and deploying Ember.js applications.
What are ember-cli's main functionalities?
Project Creation
This command creates a new Ember.js application with the name 'my-app'. It sets up the project structure, installs dependencies, and configures the build system.
ember new my-app
Generating Blueprints
This command generates a new component called 'my-component'. Blueprints are templates for generating various parts of an Ember.js application, such as components, routes, and services.
ember generate component my-component
Running the Development Server
This command starts a local development server, allowing you to preview your application in the browser. It also watches for file changes and automatically reloads the application.
ember serve
Building the Application
This command builds the Ember.js application for production. It optimizes the assets and outputs them to the 'dist' directory, ready for deployment.
ember build --environment production
Running Tests
This command runs the application's test suite. Ember CLI supports both unit and integration tests, and it can be configured to run tests in different environments.
ember test
Other packages similar to ember-cli
create-react-app
Create React App is a command line tool for creating and managing React applications. It provides a similar set of features to Ember CLI, including project scaffolding, development server, and build tools. However, it is tailored specifically for React applications.
vue-cli
Vue CLI is the standard tooling for Vue.js development. It offers a similar feature set to Ember CLI, including project creation, development server, and build tools. Vue CLI also provides a plugin system for extending its functionality.
angular-cli
Angular CLI is the command line interface for Angular applications. It provides tools for generating components, services, and other parts of an Angular application, as well as running a development server and building the application for production. It is similar to Ember CLI but tailored for Angular.
ember-cli
The Ember.js command line utility.
Supports node 0.12.x and npm 2.7.x and 3.x.
Project Elements
Additional components of this project that are used at runtime in your application:
Development Hints
Working with master
git clone https://github.com/ember-cli/ember-cli.git
cd ember-cli
npm link
npm link
is very similar to npm install -g
except that instead of downloading the package from the repo the just cloned ember-cli/
folder becomes the global package. Any changes to the files in the ember-cli/
folder will immediately affect the global ember-cli package.
Now you can use ember-cli
via the command line:
ember new foo
cd foo
npm link ember-cli
ember server
npm link ember-cli
is needed because by default the globally installed ember-cli
just loads the local ember-cli
from the project. npm link ember-cli
symlinks the global ember-cli
package to the local ember-cli
package. Now the ember-cli
you cloned before is in three places: The folder you cloned it into, npm's folder where it stores global packages and the ember-cli
project you just created.
If you upgrade an app running against Ember CLI master you will need to re-link to your checkout of Ember CLI by running npm link ember-cli
in your project again.
Please read the official npm-link documentation and the npm-link cheatsheet for more information.
Working with the tests
Use npm test
to run the tests (Runs only fast tests).
For a full test run which includes some very slow acceptance tests,
please run: npm run test-all
. Please note, this is what travis
runs.
To exclude a test or test suite append a .skip
to it()
or describe()
respectively (e.g. it.skip(...)
). To focus on a certain test or test suite append .only
.
The default test suite includes JSHint and JSCS.
Please read the official mocha documentation for more information.
Running specific tests
node tests/runner.js path/to/test/file path/to/other/test/file
Example
node tests/runner.js tests/acceptance/addon-smoke-test-slow.js
Running JSHint and JSCS only
npm run lint
Reusing test related npm + bower installs
To prevent test trolling, the test caches for npm and bower are removed for each run.
When trying to rapidly debug an issue disabling this can result in much faster test runs.
For now, the easiest way to disable them is to comment out the following lines https://github.com/ember-cli/ember-cli/blob/664f7998142e8deb9806ca54472f44e8cec9dbcf/tests/runner.js#L13-L14
Problems
When running ember cli it could happen that a lack of file watches can occur. You will get an error message like:
Serving on http://localhost:4200
watch ENOSPC
Error: watch ENOSPC
at errnoException (fs.js:1019:11)
at FSWatcher.start (fs.js:1051:11)
...
This problem will be corrected in future releases. The following line is a workaround to get the server up and running until this problem is fixed. See Issue 1054.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
For Arch Linux or Manjaro Linux, in order for the parameters to be loaded at boot, the kernel sysctl parameters have to be saved in a drop-in directory instead of sysctl.conf
.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.d/99-sysctl.conf && sudo sysctl --system
Why is CI broken?
If all pull requests are breaking on the same issue, we likely have a dependency that updated and broke our CI. This app can tell you which packages updated.
Inline Documentation
Use npm run docs
to build HTML and JSON documentation with YUIDoc and place it in docs/build/
. Please help by improving this documentation.
Contribution
See CONTRIBUTING.md
Upgrading
Programmatic Access
You can programmatically access the CLI from your node application.
- Create a new node app
npm init
- Install the cli
npm install ember-cli -save
- Create index.js
- Use the cli
var cli = require("ember-cli/lib/cli");
cli({
inputStream: process.stdin,
outputStream: process.stdout,
cliArgs: ['help']
}).then(function(exitCode) {
});
- Run your app with
node .
and it should execute the ember help
command
License
ember-cli is MIT Licensed.