Fixed bundling and various improvements

- Fixed uglifyjs (apparently gulp-uglify was too new?!, fixes #1386)
- Updated to latest practices from https://github.com/MattJeanes/AngularBasic
- Fix primeng loading roboto (moved fonts lib from fonts to css/fonts)
- Upgrade to ngx-infinite-scroll from angular2-infinite-scroll and move it to npm auto-installer
- Remove weird content inclusion in csproj and just include all of wwwroot
- Upgrade to Angular 4.0.2 and TypeScript 2.3.0
pull/1389/head
Matt Jeanes 8 years ago
parent 1480e980e8
commit a23508adc9

@ -8,90 +8,7 @@
</PropertyGroup>
<ItemGroup>
<Content Remove="wwwroot/app\wizard\plex\plex.component.ts" />
</ItemGroup>
<ItemGroup>
<Content Include="wwwroot\app\auth\auth.guard.ts">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\auth\auth.module.ts" />
<Content Include="wwwroot\app\auth\auth.service.ts" />
<Content Include="wwwroot\app\auth\IUserLogin.ts" />
<Content Include="wwwroot\app\interfaces\IEmby.ts" />
<Content Include="wwwroot\app\interfaces\ISettings.js">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\interfaces\ISettings.js.map">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\interfaces\ISettings.ts">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\login\login.component.html" />
<Content Include="wwwroot\app\login\login.component.ts" />
<Content Include="wwwroot\app\services\applications\emby.service.js" />
<Content Include="wwwroot\app\services\applications\emby.service.js.map" />
<Content Include="wwwroot\app\services\applications\emby.service.ts">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\services\applications\plex.service.js" />
<Content Include="wwwroot\app\services\applications\plex.service.js.map" />
<Content Include="wwwroot\app\services\applications\plex.service.ts" />
<Content Include="wwwroot\app\services\identity.service.js" />
<Content Include="wwwroot\app\services\identity.service.js.map" />
<Content Include="wwwroot\app\services\identity.service.ts" />
<Content Include="wwwroot\app\services\plex.service.js" />
<Content Include="wwwroot\app\services\plex.service.js.map" />
<Content Include="wwwroot\app\services\plex.service.ts">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\services\settings.service.js" />
<Content Include="wwwroot\app\services\settings.service.js.map" />
<Content Include="wwwroot\app\services\settings.service.ts" />
<Content Include="wwwroot\app\services\status.service.js" />
<Content Include="wwwroot\app\services\status.service.js.map" />
<Content Include="wwwroot\app\services\status.service.ts" />
<Content Include="wwwroot\app\settings\emby\emby.component.html" />
<Content Include="wwwroot\app\settings\emby\emby.component.js" />
<Content Include="wwwroot\app\settings\emby\emby.component.js.map" />
<Content Include="wwwroot\app\settings\emby\emby.component.ts" />
<Content Include="wwwroot\app\settings\interfaces\ISettings.ts" />
<Content Include="wwwroot\app\settings\plex\plex.component.html">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\settings\plex\plex.component.js" />
<Content Include="wwwroot\app\settings\plex\plex.component.js.map" />
<Content Include="wwwroot\app\settings\plex\plex.component.ts" />
<Content Include="wwwroot\app\settings\settingsmenu.component.html" />
<Content Include="wwwroot\app\settings\settingsmenu.component.js" />
<Content Include="wwwroot\app\settings\settingsmenu.component.js.map" />
<Content Include="wwwroot\app\settings\settingsmenu.component.ts" />
<Content Include="wwwroot\app\wizard\createadmin\createadmin.component.html" />
<Content Include="wwwroot\app\wizard\createadmin\createadmin.component.js" />
<Content Include="wwwroot\app\wizard\createadmin\createadmin.component.js.map" />
<Content Include="wwwroot\app\wizard\createadmin\createadmin.component.ts" />
<Content Include="wwwroot\app\wizard\emby\emby.component.html" />
<Content Include="wwwroot\app\wizard\emby\emby.component.js" />
<Content Include="wwwroot\app\wizard\emby\emby.component.js.map" />
<Content Include="wwwroot\app\wizard\emby\emby.component.ts" />
<Content Include="wwwroot\app\wizard\mediaserver\mediaserver.component.html">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="wwwroot\app\wizard\mediaserver\mediaserver.component.js" />
<Content Include="wwwroot\app\wizard\mediaserver\mediaserver.component.js.map" />
<Content Include="wwwroot\app\wizard\mediaserver\mediaserver.component.ts" />
<Content Include="wwwroot\app\wizard\plex\plex.component.html" />
<Content Include="wwwroot\app\wizard\plex\plex.component.js" />
<Content Include="wwwroot\app\wizard\plex\plex.component.js.map" />
<Content Include="wwwroot\app\wizard\plex\plex.component.ts" />
<Content Include="wwwroot\app\wizard\welcome\welcome.component.html" />
<Content Include="wwwroot\app\wizard\welcome\welcome.component.js" />
<Content Include="wwwroot\app\wizard\welcome\welcome.component.js.map" />
<Content Include="wwwroot\app\wizard\welcome\welcome.component.ts" />
<Content Include="wwwroot\app\wizard\wizard.module.js" />
<Content Include="wwwroot\app\wizard\wizard.module.js.map" />
<Content Include="wwwroot\app\wizard\wizard.module.ts" />
<Content Include="wwwroot\**" />
</ItemGroup>
<ItemGroup>
@ -134,5 +51,6 @@
<ItemGroup>
<Folder Include="Models\Plex\" />
<Folder Include="wwwroot\css\fonts\" />
</ItemGroup>
</Project>

@ -1,24 +0,0 @@
// Configure bundling and minification for the project.
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
[
{
"outputFileName": "wwwroot/css/site.min.css",
// An array of relative input file paths. Globbing patterns supported
"inputFiles": [
"wwwroot/css/site.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/site.js"
],
// Optionally specify minification options
"minify": {
"enabled": true,
"renameLocals": true
},
// Optionally generate .map file
"sourceMap": false
}
]

@ -15,6 +15,7 @@ var cleancss = require('gulp-clean-css');
var filter = require('gulp-filter');
var systemJSBuilder = require('systemjs-builder');
var run = require('gulp-run');
var fs = require('fs');
var wwwroot = './wwwroot';
@ -32,16 +33,13 @@ var paths = {
'@angular/http',
'@angular/router',
'@angular/forms',
'@angular/platform-browser/animations',
'ngx-infinite-scroll'
],
dest: './lib'
},
lib: { // These are simple single-file dependencies with optional rename, for more files or folders use modules
src: [
{
file: './node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
rename: '@angular/platform-browser/animations'
},
{
file: './node_modules/systemjs/dist/system.src.js',
rename: 'system'
@ -89,7 +87,7 @@ var paths = {
src: [
'./node_modules/primeng/resources/themes/omega/fonts/*'
],
dest: './fonts/'
dest: './css/fonts/'
}
],
libimages: [ // Library images
@ -120,12 +118,7 @@ var paths = {
name: 'primeng',
src: './node_modules/primeng/**/*.js',
dest: './lib/primeng/'
},
{
name: "angular2-infinite-scroll",
src: ['./node_modules/angular2-infinite-scroll/**/*.js', '!./node_modules/angular2-infinite-scroll/bundles/**/*.js'],
dest: "./lib/angular2-infinite-scroll/"
},
}
],
sass: { // Simple sass->css compilation
src: ['./Styles/**/*.scss', '!./Styles/primeng/**'],
@ -252,7 +245,7 @@ gulp.task('sass', function () {
});
gulp.task('bundle', function () {
gulp.task('bundle', ['typescript_firstrun'], function () {
var builder = new systemJSBuilder(paths.bundle.root);
builder.config(paths.bundle.config);
@ -264,15 +257,32 @@ gulp.task('bundle', function () {
gulp.task('clean', function () {
return del([
paths.sass.dest,
paths.sass.dest + paths.sass.filter,
paths.lib.dest,
paths.bundle.dest,
...paths.modules.map(m => m.dest)
...paths.modules.map(m => m.dest),
...paths.libcss.map(m => m.dest + (m.filter ? m.filter : '')),
...paths.libfonts.map(m => m.dest)
].map(x => path.join(paths.wwwroot, x)), { force: true });
})
gulp.task('typescript', function () {
// Runs the TypeScript compiler
function runTSC() {
return run('tsc').exec();
}
// Allows app to bundle libs on first run by compiling the app first, only compiles if entry point doesn't exist
gulp.task('typescript_firstrun', function () {
var bundle = path.join(paths.wwwroot, paths.bundle.bundle);
var exists = fs.existsSync(bundle);
if (!exists) {
console.log(`'${bundle}' doesn't exist - compiling TypeScript`);
return runTSC();
}
})
gulp.task('typescript', function () {
return runTSC();
});
uglify().on('error',
@ -285,7 +295,7 @@ gulp.task('fullvar', () => { global.full = true });
gulp.task('copy', ['lib', 'libcss', 'libfonts', 'libimages', 'npm', 'modules']);
gulp.task('compile', callback => runSequence('copy', 'sass', callback));
gulp.task('build', callback => runSequence('compile', 'bundle', callback));
gulp.task('full', callback => runSequence(/*'clean',*/ 'compile', callback));
gulp.task('full', callback => runSequence('clean', 'compile', callback));
// Use this in a build server environment to compile and bundle everything
gulp.task('publish', callback => runSequence('fullvar', 'full', 'typescript', 'bundle', callback));

@ -3,22 +3,21 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@angular/animations": "^4.0.2",
"@angular/common": "^4.0.2",
"@angular/compiler": "^4.0.2",
"@angular/compiler-cli": "^4.0.2",
"@angular/core": "^4.0.2",
"@angular/forms": "^4.0.2",
"@angular/http": "^4.0.2",
"@angular/platform-browser": "^4.0.2",
"@angular/platform-browser-dynamic": "^4.0.2",
"@angular/platform-server": "^4.0.2",
"@angular/router": "^4.0.0",
"@types/jquery": "^2.0.33",
"@types/systemjs": "^0.20.2",
"angular2-infinite-scroll": "^0.3.4",
"angular2-moment": "^1.3.3",
"angular2-jwt": "0.2.0",
"angular2-moment": "^1.3.3",
"bootstrap": "3.3.6",
"core-js": "^2.4.1",
"del": "^2.2.2",
@ -32,17 +31,18 @@
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.9.0",
"gulp-systemjs-builder": "^0.15.0",
"gulp-uglify": "^2.1.2",
"gulp-uglify": "^1.5.4",
"jquery": "2.2.1",
"merge-stream": "^1.0.1",
"nanoscroller": "^0.8.7",
"ngx-infinite-scroll": "^0.4.1",
"primeng": "^2.0.5",
"run-sequence": "^1.2.2",
"rxjs": "^5.0.3",
"systemjs": "^0.19.41",
"systemjs-builder": "^0.15.34",
"tether": "^1.4.0",
"typescript": "^2.2.1",
"typescript": "^2.3.0",
"zone.js": "^0.8.5"
}
}

@ -8,7 +8,7 @@ import { AppComponent } from './app.component';
import { RouterModule, Routes } from '@angular/router';
import { HttpModule } from '@angular/http';
import { InfiniteScrollModule } from 'angular2-infinite-scroll/angular2-infinite-scroll'
import { InfiniteScrollModule } from 'ngx-infinite-scroll'
import { SearchComponent } from './search/search.component';
import { RequestComponent } from './requests/request.component';

@ -78,13 +78,6 @@
{{/if_eq}}
</div>-->
</div>
<div class="col-sm-3 col-sm-push-3">
<div *ngIf="!request.admin">
<div *ngIf="!request.approved">

Loading…
Cancel
Save