Skip to content

Commit 59fd2ca

Browse files
chore(*): set up the project structure and build
This commit adds the initial source code, sets up the project structure, creates the gulp build file and configures karma.
1 parent 333f90d commit 59fd2ca

File tree

19 files changed

+882
-6
lines changed

19 files changed

+882
-6
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# 2 space indentation
12+
[**.*]
13+
indent_style = space
14+
indent_size = 2

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
jspm_packages
3+
bower_components
4+
.idea
5+
.DS_STORE

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
jspm_packages
2+
bower_components
3+
.idea

LICENSE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 aurelia
3+
Copyright (c) 2014 The Durandal Project
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,5 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
22-
21+
SOFTWARE.

README.md

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,74 @@
1-
framework
2-
=========
1+
# aurelia-framework
32

4-
The aurelia framework brings together all the required core libraries into an application framework.
3+
This library is part of the [Aurelia](http://www.aurelia.io/) platform and contains the aurelia framework which brings together all the required core aurelia libraries into a ready-to-go application-building platform.
4+
5+
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to join us on [our Gitter Channel](https://gitter.im/Aurelia/Discuss).
6+
7+
## Dependencies
8+
9+
* [aurelia-dependency-injection](https://github.com/aurelia/dependency-injection)
10+
* [aurelia-binding](https://github.com/aurelia/binding)
11+
* [aurelia-metadata](https://github.com/aurelia/metadata)
12+
* [aurelia-templating](https://github.com/aurelia/templating)
13+
* [aurelia-loader](https://github.com/aurelia/loader)
14+
* [aurelia-task-queue](https://github.com/aurelia/task-queue)
15+
* [aurelia-event-aggregator](https://github.com/aurelia/event-aggregator)
16+
* [aurelia-logging](https://github.com/aurelia/logging)
17+
18+
## Platform Support
19+
20+
This library can be used in the **browser** only.
21+
22+
## Building The Code
23+
24+
To build the code, follow these steps.
25+
26+
1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs.
27+
2. From the project folder, execute the following command:
28+
29+
```shell
30+
npm install
31+
```
32+
3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command:
33+
34+
```shell
35+
npm install -g gulp
36+
```
37+
4. To build the code, you can now run:
38+
39+
```shell
40+
gulp build
41+
```
42+
5. You will find the compiled code in the `dist` folder, available in three module formats: AMD, CommonJS and ES6.
43+
44+
6. See `gulpfile.js` for other tasks related to generating the docs and linting.
45+
46+
## Running The Tests
47+
48+
To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:
49+
50+
1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command:
51+
52+
```shell
53+
npm install -g karma-cli
54+
```
55+
2. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following commnand:
56+
57+
```shell
58+
npm install -g jspm
59+
```
60+
3. Install the client-side dependencies with jspm:
61+
62+
```shell
63+
jspm install
64+
```
65+
66+
4. You can now run the tests with this command:
67+
68+
```shell
69+
karma start
70+
```
71+
72+
## Contributing
73+
74+
We'd love for you to contribute to our source code and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accepts a Pull Request from you. More information on the process is including in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md).

config.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
System.config({
2+
"paths": {
3+
"*": "*.js",
4+
"github:*": "jspm_packages/github/*.js"
5+
}
6+
});
7+
8+
System.config({
9+
"map": {
10+
"aurelia-binding": "github:aurelia/[email protected]",
11+
"aurelia-dependency-injection": "github:aurelia/[email protected]",
12+
"aurelia-event-aggregator": "github:aurelia/[email protected]",
13+
"aurelia-loader": "github:aurelia/[email protected]",
14+
"aurelia-logging": "github:aurelia/[email protected]",
15+
"aurelia-metadata": "github:aurelia/[email protected]",
16+
"aurelia-task-queue": "github:aurelia/[email protected]",
17+
"aurelia-templating": "github:aurelia/[email protected]",
18+
"github:aurelia/[email protected]": {
19+
"aurelia-metadata": "github:aurelia/[email protected]",
20+
"aurelia-task-queue": "github:aurelia/[email protected]"
21+
},
22+
"github:aurelia/[email protected]": {
23+
"aurelia-metadata": "github:aurelia/[email protected]"
24+
},
25+
"github:aurelia/[email protected]": {
26+
"aurelia-path": "github:aurelia/[email protected]"
27+
},
28+
"github:aurelia/[email protected]": {
29+
"aurelia-binding": "github:aurelia/[email protected]",
30+
"aurelia-dependency-injection": "github:aurelia/[email protected]",
31+
"aurelia-loader": "github:aurelia/[email protected]",
32+
"aurelia-logging": "github:aurelia/[email protected]",
33+
"aurelia-metadata": "github:aurelia/[email protected]",
34+
"aurelia-path": "github:aurelia/[email protected]",
35+
"aurelia-task-queue": "github:aurelia/[email protected]"
36+
}
37+
}
38+
});
39+

dist/amd/aurelia.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
define(["exports", "aurelia-logging", "aurelia-dependency-injection", "aurelia-loader", "aurelia-templating", "aurelia-event-aggregator"], function (exports, _aureliaLogging, _aureliaDependencyInjection, _aureliaLoader, _aureliaTemplating, _aureliaEventAggregator) {
2+
"use strict";
3+
4+
var LogManager = _aureliaLogging;
5+
var Container = _aureliaDependencyInjection.Container;
6+
var Loader = _aureliaLoader.Loader;
7+
var BindingLanguage = _aureliaTemplating.BindingLanguage;
8+
var ResourceCoordinator = _aureliaTemplating.ResourceCoordinator;
9+
var ViewSlot = _aureliaTemplating.ViewSlot;
10+
var ResourceRegistry = _aureliaTemplating.ResourceRegistry;
11+
var EventAggregator = _aureliaEventAggregator.EventAggregator;
12+
var includeEventsIn = _aureliaEventAggregator.includeEventsIn;
13+
14+
15+
var logger = LogManager.getLogger("aurelia");
16+
17+
var Aurelia = (function () {
18+
var Aurelia = function Aurelia(loader, container, resources) {
19+
this.loader = loader || Loader.createDefaultLoader();
20+
this.container = container || new Container();
21+
this.resources = resources || new ResourceRegistry();
22+
this.resourcesToLoad = [];
23+
24+
this.withInstance(Aurelia, this);
25+
this.withInstance(Loader, this.loader);
26+
this.withInstance(ResourceRegistry, this.resources);
27+
this.withInstance(EventAggregator, includeEventsIn(this));
28+
};
29+
30+
Aurelia.prototype.withInstance = function (type, instance) {
31+
this.container.registerInstance(type, instance);
32+
return this;
33+
};
34+
35+
Aurelia.prototype.withSingleton = function (type, implementation) {
36+
this.container.registerSingleton(type, implementation);
37+
return this;
38+
};
39+
40+
Aurelia.prototype.withBindingLanguage = function (languageType) {
41+
this.container.registerSingleton(BindingLanguage, languageType);
42+
return this;
43+
};
44+
45+
Aurelia.prototype.withPlugins = function (config, baseUrl) {
46+
logger.error("withPlugins is not yet implemented");
47+
return this;
48+
};
49+
50+
Aurelia.prototype.withResources = function (resources) {
51+
if (Array.isArray(resources)) {
52+
this.resourcesToLoad = this.resourcesToLoad.concat(resources);
53+
} else {
54+
this.resourcesToLoad = this.resourcesToLoad.concat(Array.prototype.slice.call(arguments));
55+
}
56+
57+
return this;
58+
};
59+
60+
Aurelia.prototype.start = function () {
61+
var _this = this;
62+
if (this.started) {
63+
return;
64+
}
65+
66+
this.started = true;
67+
logger.info("Aurelia Starting");
68+
69+
if (!this.container.hasHandler(BindingLanguage)) {
70+
logger.error("You must configure Aurelia with a BindingLanguage implementation.");
71+
}
72+
73+
return this.container.get(ResourceCoordinator).importResources(this.resourcesToLoad).then(function (resources) {
74+
resources.forEach(function (x) {
75+
return x.register(_this.resources);
76+
});
77+
logger.info("Aurelia Started");
78+
return _this;
79+
});
80+
};
81+
82+
Aurelia.prototype.setRoot = function (root, transition, applicationHost) {
83+
var _this2 = this;
84+
if (!applicationHost || typeof applicationHost == "string") {
85+
this.host = document.getElementById(applicationHost || "applicationHost") || document.body;
86+
} else {
87+
this.host = applicationHost;
88+
}
89+
90+
this.host.aurelia = this;
91+
92+
return this.container.get(ResourceCoordinator).loadElement(root).then(function (type) {
93+
_this2.root = type.create(_this2.container);
94+
var slot = new ViewSlot(_this2.host, true);
95+
slot.swap(_this2.root.view);
96+
slot.attached();
97+
return _this2;
98+
});
99+
};
100+
101+
return Aurelia;
102+
})();
103+
104+
exports.Aurelia = Aurelia;
105+
});

dist/amd/index.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
define(["exports", "./aurelia", "aurelia-dependency-injection", "aurelia-binding", "aurelia-metadata", "aurelia-templating", "aurelia-loader", "aurelia-task-queue", "aurelia-event-aggregator", "aurelia-logging"], function (exports, _aurelia, _aureliaDependencyInjection, _aureliaBinding, _aureliaMetadata, _aureliaTemplating, _aureliaLoader, _aureliaTaskQueue, _aureliaEventAggregator, _aureliaLogging) {
2+
"use strict";
3+
4+
exports.Aurelia = _aurelia.Aurelia;
5+
(function (obj) {
6+
for (var i in obj) {
7+
exports[i] = obj[i];
8+
}
9+
})(_aureliaDependencyInjection);
10+
11+
(function (obj) {
12+
for (var i in obj) {
13+
exports[i] = obj[i];
14+
}
15+
})(_aureliaBinding);
16+
17+
(function (obj) {
18+
for (var i in obj) {
19+
exports[i] = obj[i];
20+
}
21+
})(_aureliaMetadata);
22+
23+
(function (obj) {
24+
for (var i in obj) {
25+
exports[i] = obj[i];
26+
}
27+
})(_aureliaTemplating);
28+
29+
(function (obj) {
30+
for (var i in obj) {
31+
exports[i] = obj[i];
32+
}
33+
})(_aureliaLoader);
34+
35+
(function (obj) {
36+
for (var i in obj) {
37+
exports[i] = obj[i];
38+
}
39+
})(_aureliaTaskQueue);
40+
41+
(function (obj) {
42+
for (var i in obj) {
43+
exports[i] = obj[i];
44+
}
45+
})(_aureliaEventAggregator);
46+
47+
var TheLogManager = _aureliaLogging;
48+
var LogManager = exports.LogManager = TheLogManager;
49+
});

0 commit comments

Comments
 (0)