diff --git a/client/.gitignore b/client/.gitignore
index 4bb21ebab..24129f7c5 100644
--- a/client/.gitignore
+++ b/client/.gitignore
@@ -1,5 +1,7 @@
typings
+!typings/typings.d.ts
angular/**/*.js
angular/**/*.map
angular/**/*.css
stylesheets/index.css
+bundles
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts
index 83a4f3310..359d7128e 100644
--- a/client/angular/app/app.component.ts
+++ b/client/angular/app/app.component.ts
@@ -1,6 +1,6 @@
-import { Component } from 'angular2/core';
-import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from 'angular2/router';
-import { HTTP_PROVIDERS } from 'angular2/http';
+import { Component } from '@angular/core';
+import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
+import { HTTP_PROVIDERS } from '@angular/http';
import { VideosAddComponent } from '../videos/components/add/videos-add.component';
import { VideosListComponent } from '../videos/components/list/videos-list.component';
diff --git a/client/angular/friends/services/friends.service.ts b/client/angular/friends/services/friends.service.ts
index 4eb1fc67b..cb34323e4 100644
--- a/client/angular/friends/services/friends.service.ts
+++ b/client/angular/friends/services/friends.service.ts
@@ -1,5 +1,5 @@
-import { Injectable } from 'angular2/core';
-import { Http, Response } from 'angular2/http';
+import { Injectable } from '@angular/core';
+import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
@Injectable()
diff --git a/client/angular/bootstrap.ts b/client/angular/main.ts
similarity index 54%
rename from client/angular/bootstrap.ts
rename to client/angular/main.ts
index d0f524f4a..e35f7dbdf 100644
--- a/client/angular/bootstrap.ts
+++ b/client/angular/main.ts
@@ -1,4 +1,4 @@
-import { bootstrap } from 'angular2/platform/browser';
+import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app/app.component';
bootstrap(AppComponent);
diff --git a/client/angular/users/components/login/login.component.ts b/client/angular/users/components/login/login.component.ts
index cecf5d2fd..d339353ef 100644
--- a/client/angular/users/components/login/login.component.ts
+++ b/client/angular/users/components/login/login.component.ts
@@ -1,5 +1,5 @@
-import { Component } from 'angular2/core';
-import { Router } from 'angular2/router';
+import { Component } from '@angular/core';
+import { Router } from '@angular/router-deprecated';
import { AuthService } from '../../services/auth.service';
import { AuthStatus } from '../../models/authStatus';
diff --git a/client/angular/users/services/auth.service.ts b/client/angular/users/services/auth.service.ts
index fc5048d8a..099563d43 100644
--- a/client/angular/users/services/auth.service.ts
+++ b/client/angular/users/services/auth.service.ts
@@ -1,5 +1,5 @@
-import { Injectable } from 'angular2/core';
-import { Http, Response, Headers, URLSearchParams, RequestOptions } from 'angular2/http';
+import { Injectable } from '@angular/core';
+import { Http, Response, Headers, URLSearchParams, RequestOptions } from '@angular/http';
import { Observable, Subject } from 'rxjs/Rx';
import { AuthStatus } from '../models/authStatus';
diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.ts
index bc7b4057c..f801cecbb 100644
--- a/client/angular/videos/components/add/videos-add.component.ts
+++ b/client/angular/videos/components/add/videos-add.component.ts
@@ -1,5 +1,5 @@
-import { Component, ElementRef, OnInit } from 'angular2/core';
-import { Router } from 'angular2/router';
+import { Component, ElementRef, OnInit } from '@angular/core';
+import { Router } from '@angular/router-deprecated';
import { AuthService } from '../../../users/services/auth.service';
import { User } from '../../../users/models/user';
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts
index b081522c7..6ff0b2afb 100644
--- a/client/angular/videos/components/list/videos-list.component.ts
+++ b/client/angular/videos/components/list/videos-list.component.ts
@@ -1,5 +1,5 @@
-import { Component, OnInit } from 'angular2/core';
-import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router';
+import { Component, OnInit } from '@angular/core';
+import { ROUTER_DIRECTIVES, RouteParams } from '@angular/router-deprecated';
import { AuthService } from '../../../users/services/auth.service';
import { User } from '../../../users/models/user';
diff --git a/client/angular/videos/components/watch/videos-watch.component.ts b/client/angular/videos/components/watch/videos-watch.component.ts
index b996ad882..6ac2787ed 100644
--- a/client/angular/videos/components/watch/videos-watch.component.ts
+++ b/client/angular/videos/components/watch/videos-watch.component.ts
@@ -1,6 +1,6 @@
-import { Component, OnInit, ElementRef } from 'angular2/core';
-import { RouteParams, CanDeactivate, ComponentInstruction } from 'angular2/router';
-import { BytesPipe } from 'angular-pipes/math';
+import { Component, OnInit, ElementRef } from '@angular/core';
+import { RouteParams, CanDeactivate, ComponentInstruction } from '@angular/router-deprecated';
+import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
// TODO import it with systemjs
declare var WebTorrent: any;
diff --git a/client/angular/videos/services/videos.service.ts b/client/angular/videos/services/videos.service.ts
index 74b6a1ddc..d08548339 100644
--- a/client/angular/videos/services/videos.service.ts
+++ b/client/angular/videos/services/videos.service.ts
@@ -1,5 +1,5 @@
-import { Injectable } from 'angular2/core';
-import { Http, Response } from 'angular2/http';
+import { Injectable } from '@angular/core';
+import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { Video } from '../models/video';
diff --git a/client/index.html b/client/index.html
index 49a448c2c..c9bc7adb2 100644
--- a/client/index.html
+++ b/client/index.html
@@ -1,47 +1,34 @@
+
+
PeerTube
+
+
+
-
-
-
-
+
+
-
-
-
-
+
+
+
+
-
-
diff --git a/client/package.json b/client/package.json
index db93ac681..5a103ceb7 100644
--- a/client/package.json
+++ b/client/package.json
@@ -17,28 +17,42 @@
"tsc:w": "tsc -w",
"typings": "typings",
"postinstall": "typings install",
- "test": "tslint -c ./tslint.json angular/**/*.ts angular/**/**/*.ts angular/**/**/**/*.ts"
+ "test": "standard && tslint -c ./tslint.json angular/**/*.ts angular/**/**/*.ts angular/**/**/**/*.ts"
},
- "license": "ISC",
+ "license": "GPLv3",
"dependencies": {
- "angular-pipes": "^1.5.0",
- "angular2": "2.0.0-beta.17",
+ "angular-pipes": "^2.0.0",
+ "@angular/common": "2.0.0-rc.1",
+ "@angular/compiler": "2.0.0-rc.1",
+ "@angular/core": "2.0.0-rc.1",
+ "@angular/http": "2.0.0-rc.1",
+ "@angular/platform-browser-dynamic": "2.0.0-rc.1",
+ "@angular/platform-browser": "2.0.0-rc.1",
+ "@angular/router-deprecated": "2.0.0-rc.1",
"blueimp-file-upload": "^9.12.1",
"bootstrap-sass": "^3.3.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.0",
"jquery": "^2.2.3",
"jquery.ui.widget": "^1.10.3",
- "reflect-metadata": "0.1.2",
+ "reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
- "systemjs": "0.19.26",
+ "systemjs": "0.19.27",
"webtorrent": "^0.89.0",
"zone.js": "0.6.12"
},
"devDependencies": {
"codelyzer": "0.0.18",
+ "standard": "^7.0.1",
+ "systemjs-builder": "^0.15.16",
"tslint": "^3.7.4",
"typescript": "^1.8.10",
"typings": "^0.8.1"
+ },
+ "standard": {
+ "ignore": [
+ "angular/",
+ "bundles/"
+ ]
}
}
diff --git a/client/systemjs.bundle.js b/client/systemjs.bundle.js
new file mode 100644
index 000000000..2fd45156a
--- /dev/null
+++ b/client/systemjs.bundle.js
@@ -0,0 +1,15 @@
+var SystemBuilder = require('systemjs-builder')
+var builder = new SystemBuilder('node_modules', 'systemjs.config.js')
+
+var toBundle = [
+ 'rxjs/Rx',
+ '@angular/common',
+ '@angular/compiler',
+ '@angular/core',
+ '@angular/http',
+ '@angular/platform-browser',
+ '@angular/platform-browser-dynamic',
+ '@angular/router-deprecated'
+]
+
+builder.bundle(toBundle.join(' + '), 'bundles/angular-rxjs.bundle.js')
diff --git a/client/systemjs.config.js b/client/systemjs.config.js
new file mode 100644
index 000000000..6b284ec63
--- /dev/null
+++ b/client/systemjs.config.js
@@ -0,0 +1,47 @@
+;(function (global) {
+ var map = {
+ 'app': 'app/angular',
+ 'angular-pipes': 'app/node_modules/angular-pipes',
+ 'angular-rxjs.bundle': 'app/bundles/angular-rxjs.bundle.js'
+ }
+
+ var packages = {
+ 'app': { main: 'main.js', defaultExtension: 'js' },
+ 'rxjs': { defaultExtension: 'js' }
+ }
+ var packageNames = [
+ '@angular/common',
+ '@angular/compiler',
+ '@angular/core',
+ '@angular/http',
+ '@angular/platform-browser',
+ '@angular/platform-browser-dynamic',
+ '@angular/router-deprecated',
+ 'angular-pipes'
+ ]
+
+ packageNames.forEach(function (pkgName) {
+ packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }
+ })
+
+ var config = {
+ map: map,
+ packages: packages,
+ bundles: {
+ 'angular-rxjs.bundle': [
+ 'rxjs',
+ '@angular/common/index.js',
+ '@angular/compiler/index.js',
+ '@angular/core/index.js',
+ '@angular/http/index.js',
+ '@angular/platform-browser/index.js',
+ '@angular/platform-browser-dynamic/index.js',
+ '@angular/router-deprecated/index.js'
+ ]
+ }
+ }
+
+ // filterSystemConfig - index.html's chance to modify config before we register it.
+ if (global.filterSystemConfig) global.filterSystemConfig(config)
+ System.config(config)
+})(this)
diff --git a/client/tsconfig.json b/client/tsconfig.json
index ca58ddb89..3e4648cf7 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
- "module": "system",
+ "module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
diff --git a/client/typings.json b/client/typings.json
index c06bb4d72..b5324f419 100644
--- a/client/typings.json
+++ b/client/typings.json
@@ -1,6 +1,7 @@
{
"ambientDependencies": {
- "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
- "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd"
+ "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
+ "jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
+ "node": "registry:dt/node#4.0.0+20160509154515"
}
}
diff --git a/client/typings/typings.d.ts b/client/typings/typings.d.ts
new file mode 100644
index 000000000..579c9a586
--- /dev/null
+++ b/client/typings/typings.d.ts
@@ -0,0 +1,13 @@
+/**
+ * Declares the 'commonjs' format module object that identifies the "module id" for the current module.
+ * Set a component's `moduleId` metadata property to `module.id` for module-relative urls
+ * when the generated module format is 'commonjs'.
+ */
+declare var module: {id: string};
+
+/**
+ * Declares the 'system' format string that identifies the "module id" for the current module.
+ * Set a component's `moduleId` metadata property to `__moduleName` for module-relative urls
+ * when the generated module format is 'system'.
+ */
+declare var __moduleName: string;
diff --git a/scripts/build/client/tsc.sh b/scripts/build/client/tsc.sh
index ec06b643a..cca1643d4 100755
--- a/scripts/build/client/tsc.sh
+++ b/scripts/build/client/tsc.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
cd client || exit -1
-
+node systemjs.bundle.js
npm run tsc
diff --git a/scripts/clean/client/tsc.sh b/scripts/clean/client/tsc.sh
index 775157a54..3ea6e78d5 100755
--- a/scripts/clean/client/tsc.sh
+++ b/scripts/clean/client/tsc.sh
@@ -2,3 +2,4 @@
cd client || exit -1
find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;
+rm -rf ./bundles
diff --git a/scripts/danger/clean/modules.sh b/scripts/danger/clean/modules.sh
index 1aa6c732b..d357e1b77 100755
--- a/scripts/danger/clean/modules.sh
+++ b/scripts/danger/clean/modules.sh
@@ -3,5 +3,5 @@
read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
- rm -rf node_modules client/node_modules client/typings
+ rm -rf node_modules client/node_modules client/typings/{browser,main}*
fi