1
0
Fork 0

Update to Angular RC 1

This commit is contained in:
Chocobozzz 2016-05-13 14:18:37 +02:00
parent bc503c2a62
commit 230809efa1
20 changed files with 135 additions and 55 deletions

2
client/.gitignore vendored
View file

@ -1,5 +1,7 @@
typings typings
!typings/typings.d.ts
angular/**/*.js angular/**/*.js
angular/**/*.map angular/**/*.map
angular/**/*.css angular/**/*.css
stylesheets/index.css stylesheets/index.css
bundles

View file

@ -1,6 +1,6 @@
import { Component } from 'angular2/core'; import { Component } from '@angular/core';
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from 'angular2/router'; import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
import { HTTP_PROVIDERS } from 'angular2/http'; import { HTTP_PROVIDERS } from '@angular/http';
import { VideosAddComponent } from '../videos/components/add/videos-add.component'; import { VideosAddComponent } from '../videos/components/add/videos-add.component';
import { VideosListComponent } from '../videos/components/list/videos-list.component'; import { VideosListComponent } from '../videos/components/list/videos-list.component';

View file

@ -1,5 +1,5 @@
import { Injectable } from 'angular2/core'; import { Injectable } from '@angular/core';
import { Http, Response } from 'angular2/http'; import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
@Injectable() @Injectable()

View file

@ -1,4 +1,4 @@
import { bootstrap } from 'angular2/platform/browser'; import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app/app.component'; import { AppComponent } from './app/app.component';
bootstrap(AppComponent); bootstrap(AppComponent);

View file

@ -1,5 +1,5 @@
import { Component } from 'angular2/core'; import { Component } from '@angular/core';
import { Router } from 'angular2/router'; import { Router } from '@angular/router-deprecated';
import { AuthService } from '../../services/auth.service'; import { AuthService } from '../../services/auth.service';
import { AuthStatus } from '../../models/authStatus'; import { AuthStatus } from '../../models/authStatus';

View file

@ -1,5 +1,5 @@
import { Injectable } from 'angular2/core'; import { Injectable } from '@angular/core';
import { Http, Response, Headers, URLSearchParams, RequestOptions } from 'angular2/http'; import { Http, Response, Headers, URLSearchParams, RequestOptions } from '@angular/http';
import { Observable, Subject } from 'rxjs/Rx'; import { Observable, Subject } from 'rxjs/Rx';
import { AuthStatus } from '../models/authStatus'; import { AuthStatus } from '../models/authStatus';

View file

@ -1,5 +1,5 @@
import { Component, ElementRef, OnInit } from 'angular2/core'; import { Component, ElementRef, OnInit } from '@angular/core';
import { Router } from 'angular2/router'; import { Router } from '@angular/router-deprecated';
import { AuthService } from '../../../users/services/auth.service'; import { AuthService } from '../../../users/services/auth.service';
import { User } from '../../../users/models/user'; import { User } from '../../../users/models/user';

View file

@ -1,5 +1,5 @@
import { Component, OnInit } from 'angular2/core'; import { Component, OnInit } from '@angular/core';
import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router'; import { ROUTER_DIRECTIVES, RouteParams } from '@angular/router-deprecated';
import { AuthService } from '../../../users/services/auth.service'; import { AuthService } from '../../../users/services/auth.service';
import { User } from '../../../users/models/user'; import { User } from '../../../users/models/user';

View file

@ -1,6 +1,6 @@
import { Component, OnInit, ElementRef } from 'angular2/core'; import { Component, OnInit, ElementRef } from '@angular/core';
import { RouteParams, CanDeactivate, ComponentInstruction } from 'angular2/router'; import { RouteParams, CanDeactivate, ComponentInstruction } from '@angular/router-deprecated';
import { BytesPipe } from 'angular-pipes/math'; import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
// TODO import it with systemjs // TODO import it with systemjs
declare var WebTorrent: any; declare var WebTorrent: any;

View file

@ -1,5 +1,5 @@
import { Injectable } from 'angular2/core'; import { Injectable } from '@angular/core';
import { Http, Response } from 'angular2/http'; import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
import { Video } from '../models/video'; import { Video } from '../models/video';

View file

@ -1,47 +1,34 @@
<html> <html>
<head> <head>
<base href="/">
<title>PeerTube</title> <title>PeerTube</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/app/stylesheets/index.css"> <link rel="stylesheet" href="/app/stylesheets/index.css">
<!-- 1. Load libraries --> <!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order --> <!-- IE required polyfills, in this exact order -->
<script src="/app/node_modules/es6-shim/es6-shim.min.js"></script> <script src="/app/node_modules/es6-shim/es6-shim.min.js"></script>
<script src="/app/node_modules/systemjs/dist/system-polyfills.js"></script> <script src="/app/node_modules/zone.js/dist/zone.js"></script>
<script src="/app/node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script> <script src="/app/node_modules/reflect-metadata/Reflect.js"></script>
<script src="/app/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="/app/node_modules/systemjs/dist/system.src.js"></script> <script src="/app/node_modules/systemjs/dist/system.src.js"></script>
<script src="/app/node_modules/rxjs/bundles/Rx.js"></script>
<script src="/app/node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="/app/node_modules/angular2/bundles/router.dev.js"></script>
<script src="/app/node_modules/angular2/bundles/http.dev.js"></script>
<script src="/app/node_modules/jquery/dist/jquery.js"></script> <script src="/app/node_modules/jquery/dist/jquery.js"></script>
<script src="/app/node_modules/jquery.ui.widget/jquery.ui.widget.js"></script> <script src="/app/node_modules/jquery.ui.widget/jquery.ui.widget.js"></script>
<script src="/app/node_modules/blueimp-file-upload/js/jquery.fileupload.js"></script> <script src="/app/node_modules/blueimp-file-upload/js/jquery.fileupload.js"></script>
<script src="/app/node_modules/webtorrent/webtorrent.min.js"></script> <script src="/app/node_modules/webtorrent/webtorrent.min.js"></script>
<!-- <script src="/app/angular/angular-rxjs.bundle.js"></script> -->
<!-- 2. Configure SystemJS --> <!-- 2. Configure SystemJS -->
<script src="/app/systemjs.config.js"></script>
<script> <script>
System.config({ System.import('app').catch(function(err){ console.error(err); });
packages: {
'/app': {
components: {
format: 'register',
defaultExtension: 'js'
}
}
},
map: {
'angular-pipes/math': '/app/node_modules/angular-pipes/math.js'
}
});
System.import('/app/angular/bootstrap')
.then(null, console.error.bind(console));
</script> </script>
<base href="/">
</head> </head>
<!-- 3. Display the application --> <!-- 3. Display the application -->

View file

@ -17,28 +17,42 @@
"tsc:w": "tsc -w", "tsc:w": "tsc -w",
"typings": "typings", "typings": "typings",
"postinstall": "typings install", "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": { "dependencies": {
"angular-pipes": "^1.5.0", "angular-pipes": "^2.0.0",
"angular2": "2.0.0-beta.17", "@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", "blueimp-file-upload": "^9.12.1",
"bootstrap-sass": "^3.3.6", "bootstrap-sass": "^3.3.6",
"es6-promise": "^3.0.2", "es6-promise": "^3.0.2",
"es6-shim": "^0.35.0", "es6-shim": "^0.35.0",
"jquery": "^2.2.3", "jquery": "^2.2.3",
"jquery.ui.widget": "^1.10.3", "jquery.ui.widget": "^1.10.3",
"reflect-metadata": "0.1.2", "reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6", "rxjs": "5.0.0-beta.6",
"systemjs": "0.19.26", "systemjs": "0.19.27",
"webtorrent": "^0.89.0", "webtorrent": "^0.89.0",
"zone.js": "0.6.12" "zone.js": "0.6.12"
}, },
"devDependencies": { "devDependencies": {
"codelyzer": "0.0.18", "codelyzer": "0.0.18",
"standard": "^7.0.1",
"systemjs-builder": "^0.15.16",
"tslint": "^3.7.4", "tslint": "^3.7.4",
"typescript": "^1.8.10", "typescript": "^1.8.10",
"typings": "^0.8.1" "typings": "^0.8.1"
},
"standard": {
"ignore": [
"angular/",
"bundles/"
]
} }
} }

15
client/systemjs.bundle.js Normal file
View file

@ -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')

47
client/systemjs.config.js Normal file
View file

@ -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)

View file

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"module": "system", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"sourceMap": true, "sourceMap": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,

View file

@ -1,6 +1,7 @@
{ {
"ambientDependencies": { "ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd", "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd" "jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
"node": "registry:dt/node#4.0.0+20160509154515"
} }
} }

13
client/typings/typings.d.ts vendored Normal file
View file

@ -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;

View file

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
cd client || exit -1 cd client || exit -1
node systemjs.bundle.js
npm run tsc npm run tsc

View file

@ -2,3 +2,4 @@
cd client || exit -1 cd client || exit -1
find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \; find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;
rm -rf ./bundles

View file

@ -3,5 +3,5 @@
read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r
if [[ "$REPLY" =~ ^[Yy]$ ]]; then 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 fi