fivetanley / ember-cli-migrator

migrate your files to the standard ember-cli structure, preserving git history
MIT License
106 stars 22 forks source link

ember-cli-migratorBuild Status

Important: As of 0.5.0 Node JS v0.10 is no longer supported. Please use Node v0.12 or IOJS instead.

Installation

npm install -g ember-cli-migrator

About

Migrate your files to the standard ember-cli structure, preserving git history.

You can run the command line tool by running the ember-cli-migrator script from within your existing ember project.

The goal of the project is to convert global variables to ES6 Modules. For example:

App.Post = DS.Model.extend({

});

becomes

import DS from "ember-data";

var Post = DS.Model.extend({

});

export default Post;

Features

Command Line Options

-h, --help                              output usage information
-V, --version                           output the version number
-g, --global [name]                     Global namespace of Ember application, eg: "MyApplication = Ember.Application.."
-a, --ember-cli-app-name [name],        Name of application namespace/modulePrefix. This is the name of the app you would pass to `ember new <ember-cli-app-name>`
-s, --source [source_directory]         Directory to perform migration on
-t, --target [target_directory]         Directory to output result of migration
-f, --force                             Migrate even if output files exist
--keep-source                           Keep source files. (Target does not replicate git history.)
--ignore-subdirs [comma_separated_dirs] Sub-directories in source to ignore

Example

To convert an Ember App Kit-like project and put it back in the same parent directory, you can use the following

ember-cli-migrator -g App -t . -s . -a appkit

Testing

You can run the tests by running npm test in the root folder.

Running the CLI locally

You can run bin/ember-cli-migrator from the root of this project and use the command line arguments above.

Dependencies

The project uses recast (which uses Esprima) to walk the JavaScript AST to accurately identify exports and move the file.

Necessary Manual Steps

TODOS