Skip to content

Latest commit

 

History

History
88 lines (66 loc) · 1.9 KB

xone_deps.md

File metadata and controls

88 lines (66 loc) · 1.9 KB

Xone Dependency Management & Calculation

Note: Work in progress.

Xone provides 3 ways of managing dependencies:

1. Xone Dependency Calculation

Define dependencies with goog.provide and goog.require in the top of each javascript file:

goog.provide("MyLib.foobar");
goog.require("MyLib.foo");
goog.require("MyLib.bar");

Note: Xone uses a fallback for goog.provide and goog.require if closure compiler is not available.

In app/manifest.js set to true:

"calculate": true

Execute CLI script:

workspace\my_project> xone deps

Note: This scripts also automatically executed in background when running xone compile or xone build.

2. Closure Compiler (jar)

Define dependencies with goog.provide and goog.require in the top of each javascript file:

goog.provide("MyLib.foobar");
goog.require("MyLib.foo");
goog.require("MyLib.bar");

In app/manifest.js manage your codebase dependencies in any order (supports wildcards):

"dependencies": {
    "calculate": false,
    "js": [
        "js/main.js",
        "js/lib/**/*.js",
        "js/layout/*.js",
        "js/view/*.js",
        "js/init.js"
    ]
}

Execute CLI script:

workspace\my_project> xone compile

Note: Closure Compiler Javascript Version actually do not support dependency sorting by goog.provide and goog.require. For this case you have to use method 1. or 3. in order.

3. Manual Dependency Definition

In app/manifest.js manage your codebase dependencies manually ordered (did not support wildcards):

"dependencies": {
    "js": [
        "js/init.js",
        "js/layout.js",
        "js/view.js",
        "js/setup.js",
        "js/main.js"
    ],
    "production": [],
    "development": [],
    "benchmark": [],
    "test": [],
    "spec": [
        "test/helper.js",
        "test/main_spec.js"
    ]
}