Project Description

JSAnalyse is a tool to analyze the dependencies between JavaScript files and keep them under control. It helps to visualize and handle static references between JavaScript files in order to ensure the defined client-side architecture.

In the last couple years the amount of JavaScript lines in web applications has been dramatically increased. A lot of new client-side frameworks (like JQuery, Knockout, etc...) have aroused, but the tools for developing JavaScript just got slightly better. For instance, the Visual Studio 2010 has improved the IntelliSense. But for a well-designed application, not only the server-side code is relevant anymore. It is also very important to have a good architecture for the client-side code and to keep it in a healthy and good state during the whole application lifecycle.
That is exactly when JSAnalyse comes into play. It enables not just the possibility to analyze the existing JavaScript dependencies but also to constrain them. The allowed dependencies can be either configured via XML or by using the great Visual Studio 2010 Architecture features. JSAnalyse provides an extension for the Visual Studio Layer Diagram to validate and control also dependencies between JavaScript files. This can be integrated into the build and with the Gated Check-in feature it is not even possible to check-in source code which does not fulfill the JavaScript architectural rules.

Visual Studio Layer Diagram Validation Extension

DependencyViolation.png

Console Application

ConsoleOutput.png

Technical Description

JSAnalyse uses "Jint - Javascript Interpreter for .NET" in order to parse the JavaScript files. It creates a dependency tree of the different files based on the static references between them. A data source can be configured which defines the allowed dependencies. Out-of-the-box JSAnalyse offers an XML-based configuration and a definition via the Visual Studio Layer Diagram.
Of course, JSAnalyse cannot check all dependencies between JavaScript files because JavaScript is an interpreted language which is not type-safe. But it checks at least all the static references between them and can identify a high percentage of the unintentional references.

The following image illustrates the basic concept of JSAnalyse. First, it parses the JavaScript files and builds up a tree. After that the dependencies are analyzed based on this tree. And finally, the approver checks if the dependencies are allowed or not.
JSAnalyseArchitecture.png

How to use JSAnalyse

This is described on the Documentation page.

Last edited Jan 3, 2012 at 1:22 PM by tstune, version 33