Code Monkey home page Code Monkey logo

ember-cli's Introduction

ember-cli

Latest npm release GitHub Actions CI Test Coverage Code Climate

The Ember.js command line utility.

Features

  • Asset build pipeline using Broccoli.js
  • ES6 transpilation using Babel
  • Project structure conventions using ES6 module syntax
  • Development server including live-reload and API proxy
  • File/Project generator using blueprints
  • Unit, Integration and Acceptance test support using Testem
  • Powerful addon system for extensibility

Installation

npm install -g ember-cli

Usage

After installation the ember CLI tool will be available to you. It is the entrypoint for all the functionality mentioned above.

You can call ember <command> --help to find out more about all of the following commands or visit https://cli.emberjs.com/release/ to read the in-depth documentation.

Documentation

Please refer to the CLI guides for help using Ember CLI.

Contributing

Please see the contributing guidelines

Community

License

This project is licensed under the MIT License.

ember-cli's People

Contributors

abuiles avatar bcardarella avatar bertdeblock avatar chadhietala avatar dcombslinkedin avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar ef4 avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hjdivad avatar homu avatar jakecraige avatar jgwhite avatar joefiorini avatar kategengler avatar kellyselden avatar locks avatar majorbreakfast avatar nathanhammond avatar nullvoxpopuli avatar quaertym avatar rwjblue avatar simonihmig avatar stefanpenner avatar thoov avatar trabus avatar turbo87 avatar twokul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli's Issues

EAK Feature Checklist

Tasks

  • build:dist - Build a minified & production-ready version of your app.
  • build:debug - Build an unminified version of your app for development and testing
  • default - Build (in debug mode) & test your application.
  • server - Run your server in development mode, auto-rebuilding when files change.
  • serve:dist - Build and preview a minified & production-ready version of your app.
  • test - Run your appsโ€™s tests once. Uses Google Chrome by default.
  • test:ci - Run your appโ€™s tests in PhantomJS. For use in continuous integration (i.e. Travis CI).
  • test:browsers - Run your appโ€™s tests in multiple browsers (see tasks/options/testem.js for configuration).
  • test:server - Alias to testem:run:basic. Be sure to install testem first using npm install -g testem

Compilation

Scripts

  • JavaScript (js)
  • CoffeeScript (coffee)
  • EmberScript (em)

Templates

  • Handlebars (hbs, handlebars)
  • Hogan (hjs)
  • Emblem (emblem)

Styles

  • SASS (sass, scss)
  • LESS (less)
  • Stylus (styl)
  • css

Images (png, jpg, jpeg)

  • sprites

JavaScript

  • Sourcemaps generation
  • JSHint validation
  • Cache busting with file revision
  • Validate imports

Styles

  • CSS Prefix
  • Cache busting with file revision

HTML

  • Minification
  • Preprocess

Server

  • LiveReload

Testing

Basic

  • PhantomJS
  • Chrome

Browsers

  • PhantomJS
  • Chrome
  • ChromeCanary
  • Firefox
  • Safari
  • IE7
  • IE8
  • IE9

Customization

  • Project specific tasks

Environment support

I would like environment support similar to rails where I have an application.js file which can be overriden in development.js, test.js and production.js.

Documentation site

What about a documentation site developed with ember-cli? :) Wouldn't that be awesome!

(Maybe the time has not come yet, but I wanted to suggest it nonetheless)

Edit: Ah, maybe it would be best to document everything in the offical ember documentation.

control-c should kill at any point in time

  • during "Installing dependencies"
  • during init confirmations

basically the way the UI is currently being hijacked during prompts, isn't enabled this expected behaviour.

ember build, server

Currently there are two commands server and build

I propose a unified build command:

  • --pack store output files in a folder (Default: dist/)
  • --watch turns on rebuilding on file changes
  • --test turns on testing with testem
  • --serve turns on server, port can be specified via --port

phone gap, node-webkit development: ember --pack --watch
simple web app development: ember --serve --watch
web app deployment ember --pack --env production
web app development and testing: ember --serve --test --watch, ember -stw
everything at once: ember --serve --test --pack --watch, ember -stpw

I'm proposing this because although it doesn't hurt to open a server when developping for phonegap or node-webkit it's not very clean either. Watching is kind of independent to serving. It's more like watch on/off, test on/off, pack on/off, serve on/off

@stefanpenner @joefiorini What do you think?

  • Yes, I wrote ember instead of ember build. Maybe that makes sense, maybe not
  • I just invented pack
  • server became serve in order to stay with verbs
  • autotest became test

Add validate command

Starting an issue for tracking some discussions with @stefanpenner.

  • Incorporate es6-import-validate broccoli task
  • Add jshint, jscs, csslint or other validation mechanisms?

Looks like I can take the broccoli-eslint task as an example of how to do validation style broccoli plugins.

Automatically require any files in app/config/initializers

Currently there is no automatic way of getting an initializer to run for you. I'm proposing to have any modules in the registry that start with app/config/initializers be required upon startup within the app.js (and start_app.js testing helper).

I can implement this fairly easily if y'all agree.

Init command creates application directory

Should ember init app-name create an "app-name" directory in the CWD and then copy the skeleton, instead of it's current process of creating the skeleton in the CWD?

Plugin interface

This is a follow up to a thread on EAK about the API Fixture Proxy.

I have several use cases where I would want to extend the built in server. It would be helpful to have a plugin interface that would provide consistent mechanism for extending ember-cli.

Use Cases

  1. proxy (route path to domain)
  2. modify response based on request parameters ( useful when need to test scenarios that are not part of the core application )
  3. custom routing (to allow routing to static content that's part of the project)

Generating and Scaffolding

As proposed on the projects README, I believe it would be very useful to create a generate and scaffold command for the CLI.

I would like to propose the following generators:

  • model
  • view
  • controller
  • route
  • scaffold

Generating Models

ember generate model NAME [field[:type][:index] field[:type][:index]]

example: ember generate model User firstName:string lastName:string username:boolean

Generating Views

ember generate view Name

example: ember generate view Dashboard

This would generate the following:

app/views/dashboard.js
app/templates/dashboard.hbs

Generating Controllers

ember generate controller Name

example: ember generate controller Dashboard

app/controllers/dashboard.js

Generating Routes

ember generate route Name

example: ember generate route Dashboard

app/routes/dashboard.js

Generating Scaffolds

ember generate scaffold Name

example: ember generate route Users firstName:string lastName:string username:boolean

app/views/user.js
app/templates/user.hbs
app/controllers/user.js
app/routes/user.js

These are just preliminary thoughts, but I'm thinking it may be useful to have in future ember projects?

Initial buildout

@stefanpenner What do you think about getting started on the initial buildout with commander.js & using the grunt setup from ember-app-kit kinda similar to how lineman does it? Then once broccoli is fully ready we can replace the grunt parts with broccoli. That would also solve the problem of updateability and let us start to figure out configuration faster. Thoughts?

port config

  • port config works
  • live-reload works (with chrome extensions)
  • live-reload port should be configurable
  • live-reload port should be an offset of port (by default, as to easily work with multiple ember-cli instances)

Handle bower/git install errors

While running ember init I had the following issue:

Installing project dependencies..bower ECMDERR       Failed to execute "git ls-remote --tags --heads git://github.com/components/handlebars.js.git", exit code of #128

Additional error details:
fatal: unable to connect to github.com:
github.com[0: 192.30.252.131]: errno=Operation timed out

Error running npm install
Unhandled Error

/usr/local/lib/node_modules/ember-cli/lib/cli.js:12
  throw error;
        ^
Error: [email protected] postinstall: `bower install`
Exit status 1
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/ember-cli/node_modules/npm/lib/utils/lifecycle.js:212:16)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

This was due to my network blocking the git:// protocol.

Thanks to @stefanpenner pointing me to this Stack Overflow post, I managed to get around the git issue by executing:
git config --global url."https://".insteadOf git://

However, it would be great if we could catch the error and provide some tips for the user.

Replace commander.js for more flexible setup

I've had to make trade a user-friendly UI for being able to fit into commander.js more easily. I want to replace it with a more flexible setup. Specifically, I haven't been able to include an option without a flag. For example, instead of ember new todos, we had to do ember new --name todos.

On top of that, commander doesn't do quite as much as advertised. A number of the methods in its API docs don't actually exist. The only thing it provides that is nice is git-style subcommands, where, for example, ember build is actually a separate binary called ember-build. This makes it really easy to write plugins; as long as the binary is on the load path, other devs can easily extend with additional commands. However, this seems like something we can solve better later if we need to.

After doing some research, I think a better solution would be to just use https://github.com/npm/nopt to parse options and use a lightweight command pattern to execute each command.

"new" command implementation

Am I correct in assuming that the "new" command described in your "ideas" section of the readme has yet to be created? I would be happy to help work on that, I am a huge fan of Ember and I think a good built tool for new projects is its biggest "weakness".

Installation issues

I'm having trouble installing using npm install -g
Things seem to go wrong here:

> [email protected] install /usr/local/lib/node_modules/ember-cli/node_modules/grunt-contrib-testem/node_modules/testem/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished
/usr/local/bin/ember -> /usr/local/lib/node_modules/ember-cli/bin/ember
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/ember-cli/bin/ember-build'

Any ideas?

Broccoli's copy of hapi fails to install dependencies.

I don't know where the root of this issue lies, but I wanted to capture it in case somebody else runs into it. The issue could be in any one of npm, broccoli, ember-cli, or hapi, but manifests for me in ember-cli's context only. I've identified a workaround to this problem, below.

Repro:

npm install -g ember-cli # 0.0.4
cd ~/Repos
mkdir emberconf-2014-demo
cd emberconf-2014-demo
ember init
ember build

Full stack trace:

Error: Cannot find module 'boom'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    # Error 1
    at Object.<anonymous> (/Users/nathanhammond/Repos/emberconf-2014-demo/node_modules/broccoli-uglify-js/node_modules/broccoli/node_modules/hapi/lib/index.js:3:63)
    # Error 2
    at Object.<anonymous> (/Users/nathanhammond/Repos/emberconf-2014-demo/node_modules/broccoli-es6-concatenator/node_modules/broccoli/node_modules/hapi/lib/index.js:3:63)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

It's actually pretty simple to fix:

cd /Users/nathanhammond/Repos/emberconf-2014-demo/node_modules/broccoli-uglify-js/node_modules/broccoli/node_modules/hapi
npm install
cd /Users/nathanhammond/Repos/emberconf-2014-demo/node_modules/broccoli-es6-concatenator/node_modules/broccoli/node_modules/hapi
npm install

I can't figure out why hapi fails to install its dependencies successfully in these two scenarios, but it definitely does.

Do not use bower for managing ember versions

As great as bower is, it's been a small hell for managing ember versions. For the majority case, where you are always on the release channel, it's probably okay. Once you stray from that, however, it's very difficult. Also, ember-cli is bringing its own updater for ember & ember-data. @stefanpenner Are you cool if we don't use bower just for the ember/ember-data dependencies in apps?

How do we add vendor libraries

To add a third party library like d3 in EAK, currently I am doing.

bower install d3
  1. Add the file to index.html ( alongside jQuery )
  2. Add the file to test

How would ember-cli allow me to do this stuff ?
How would ember-cli ensure d3 is not available as Global, but imported?

I see d3 has some code trying to be compatible here

if (typeof define === "function" && define.amd) {
  define(d3);
} else if (typeof module === "object" && module.exports) {
  module.exports = d3;
} else {
  this.d3 = d3;
}

But I don't even understand how to make use of it even in EAK. I see both d3 and jQuery available globally in EAK. Any thoughts?

PS: I am new to es6 and EAK , pardon me if I am being ignorant.

Gracefully handling bower feedback

Had an interesting issue with ember init where bower couldn't resolve a version of ember and asked for a choice.

Is there an idea as to how bower choices should be resolve on init (or any other case where bower is updated)?

such tests

unit

  • cli
  • actions
  • skeleton

acceptance

  • init
  • server + rebuilds (with ENVs)
  • build (with ENVs)
  • keep output tidy
  • test more expected output.
  • more DI like injection of behavior.

ember new

by popular request

essentially mkdir project-name && cd project-name && ember init

Proxying or Middleware

Part of my development process often involves requesting live production or staging data across several services.

Currently, we're using custom grunt build scripts and a express middleware to match urls and fake things like single sign on headers and API key query params.

Would love to see a place to hook into this in the cli.

alias 'em' to 'ember'

I like to use the Em alias for Ember, and I was thinking it'd be nice if you could say something like em server or em build --production too.

Managing a user's channel subscription

In the README you mention prompting the user if there are updates to their channel when they start the app. I'm not sure if we want to be asking the user for input that often. Updating is usually a conscious effort, not something I do on a whim.

What if instead we print a message telling the user updates are available and provide a command they can use to download the update. I'm thinking ember update [--channel=<channel>].

This would allow users to see that updated are available, and to update when they are ready. We can even print out a changelog or something after the update installs.

For the subscription itself, I'm thinking we can just look at the ember.js file they have downloaded and check what channel it is. Perhaps we can even provide a separate npm package for this.

@stefanpenner What do you think?

ember server command errors

I created a new folder, ran ember init followed by npm install
ember server then yields the following errors:

Serving on http://0.0.0.0:4200/

Built with error:
Error: Line 1: Unexpected token :
    at throwError (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:2579:21)
    at throwUnexpected (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:2641:9)
    at consumeSemicolon (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:2727:13)
    at parseStatement (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:4542:9)
    at /Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:5661:38
    at parseSourceElement (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:5080:20)
    at parseStatementList (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:3693:25)
    at parseBlock (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:3708:17)
    at /Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:5661:38
    at parseStatement (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:4480:24)

Built with error:
Error: Line 1: Unexpected token :
    at throwError (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:2579:21)
    at throwUnexpected (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:2641:9)
    at consumeSemicolon (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:2727:13)
    at parseStatement (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:4542:9)
    at /Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:5661:38
    at parseSourceElement (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:5080:20)
    at parseStatementList (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:3693:25)
    at parseBlock (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:3708:17)
    at /Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:5661:38
    at parseStatement (/Users/markus/Projects/Git/ember-cli-test/node_modules/broccoli-es6-concatenator/node_modules/es6-module-transpiler/dist/es6-module-transpiler.js:4480:24)

And not sure if that is worth mentioning, but if I have another server running (generator-ember) it gives me also this error on top:

... Uhoh. Got error listen EADDRINUSE ...
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at Server.listen (/usr/local/lib/node_modules/ember-cli/node_modules/broccoli/node_modules/tiny-lr/lib/server.js:138:15)
    at Object.serve (/usr/local/lib/node_modules/ember-cli/node_modules/broccoli/lib/server.js:75:20)
    at Object.server (/usr/local/lib/node_modules/ember-cli/lib/adapters/broccoli/server.js:11:19)
    at run (/usr/local/lib/node_modules/ember-cli/lib/commands/server.js:18:11)
    at init (/usr/local/lib/node_modules/ember-cli/bin/ember:66:21)

Not that I would expect it to work in this case but thought I'd just post that error anyway. But that could also be considered nitpicking ;)

verbose mode

if something goes wrong, having a verbose mode around is always handy.

Running tests

@stefanpenner What's your plan for running tests in the app? Maybe ember tests and ember tests:integration, ember tests:unit?

Options at ember new generation

Suggestion: At generation, user should be able to specify language and style options. And possibly even the adapter.

For example:

ember new --language coffeescript --template emblem --style saas adapter --epf

Something like that would be pretty nifty ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.