Skip to content

Rogach/jsdep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Automatic dependency import for Angular & RequireJS projects. Described here: Solving quadruple dependency injection problem.

Essenitally, it allows to transform this:

// answer.js
define(["angular"], function(angular) {
  angular.module("the.answer")
    .value("TheAnswer", 42);
});

// main.js
define(["angular", "the.answer"], function(angular) {
  angular.module("main", ["the.answer"])
    .run(["TheAnswer", function(TheAnswer) {
      console.log(TheAnswer);
    }]);
});

into this:

// answer.js
angular.module("the.answer")
  .value("TheAnswer", 42);

// main.js
angular.module("main")
  .run(function(TheAnswer) {
    console.log(TheAnswer);
  });

using awesome recast library for JavaScript AST parsing and manipulation.

Dependencies

npm install recast underscore

About

Automate Angular & RequireJS import management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published