From 99c04e389fd4f99b782ea789df1b63a20eeca385 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Tue, 4 Apr 2017 10:43:50 +0100 Subject: [PATCH] The start of a new world. --- Ombi/.gitignore | 16 ++ Ombi/Build/publish windows.bat | 4 + Ombi/Build/publish.bat | 7 + Ombi/Ombi.sln | 28 +++ Ombi/Ombi/.bowerrc | 3 + Ombi/Ombi/.gitignore | 17 ++ Ombi/Ombi/Controllers/HomeController.cs | 35 +++ Ombi/Ombi/Ombi.csproj | 32 +++ Ombi/Ombi/Program.cs | 24 ++ Ombi/Ombi/Properties/launchSettings.json | 22 ++ Ombi/Ombi/Startup.cs | 75 ++++++ Ombi/Ombi/Views/Home/Index.cshtml | 1 + Ombi/Ombi/Views/Shared/Error.cshtml | 14 ++ Ombi/Ombi/Views/Shared/_Layout.cshtml | 20 ++ Ombi/Ombi/Views/_ViewImports.cshtml | 2 + Ombi/Ombi/Views/_ViewStart.cshtml | 3 + Ombi/Ombi/app/app.component.html | 1 + Ombi/Ombi/app/app.component.ts | 10 + Ombi/Ombi/app/app.module.ts | 44 ++++ Ombi/Ombi/app/config.ts | 29 +++ Ombi/Ombi/app/errors/not-found.component.ts | 7 + Ombi/Ombi/app/main.ts | 13 + Ombi/Ombi/app/polyfills.ts | 14 ++ Ombi/Ombi/app/search/search.component.html | 1 + Ombi/Ombi/app/search/search.component.ts | 10 + Ombi/Ombi/appsettings.Development.json | 10 + Ombi/Ombi/appsettings.json | 8 + Ombi/Ombi/bower.json | 13 + Ombi/Ombi/bundleconfig.json | 24 ++ Ombi/Ombi/gulpfile.js | 252 ++++++++++++++++++++ Ombi/Ombi/package.json | 42 ++++ Ombi/Ombi/systemjs.config.ts | 20 ++ Ombi/Ombi/tsconfig.json | 20 ++ 33 files changed, 821 insertions(+) create mode 100644 Ombi/.gitignore create mode 100644 Ombi/Build/publish windows.bat create mode 100644 Ombi/Build/publish.bat create mode 100644 Ombi/Ombi.sln create mode 100644 Ombi/Ombi/.bowerrc create mode 100644 Ombi/Ombi/.gitignore create mode 100644 Ombi/Ombi/Controllers/HomeController.cs create mode 100644 Ombi/Ombi/Ombi.csproj create mode 100644 Ombi/Ombi/Program.cs create mode 100644 Ombi/Ombi/Properties/launchSettings.json create mode 100644 Ombi/Ombi/Startup.cs create mode 100644 Ombi/Ombi/Views/Home/Index.cshtml create mode 100644 Ombi/Ombi/Views/Shared/Error.cshtml create mode 100644 Ombi/Ombi/Views/Shared/_Layout.cshtml create mode 100644 Ombi/Ombi/Views/_ViewImports.cshtml create mode 100644 Ombi/Ombi/Views/_ViewStart.cshtml create mode 100644 Ombi/Ombi/app/app.component.html create mode 100644 Ombi/Ombi/app/app.component.ts create mode 100644 Ombi/Ombi/app/app.module.ts create mode 100644 Ombi/Ombi/app/config.ts create mode 100644 Ombi/Ombi/app/errors/not-found.component.ts create mode 100644 Ombi/Ombi/app/main.ts create mode 100644 Ombi/Ombi/app/polyfills.ts create mode 100644 Ombi/Ombi/app/search/search.component.html create mode 100644 Ombi/Ombi/app/search/search.component.ts create mode 100644 Ombi/Ombi/appsettings.Development.json create mode 100644 Ombi/Ombi/appsettings.json create mode 100644 Ombi/Ombi/bower.json create mode 100644 Ombi/Ombi/bundleconfig.json create mode 100644 Ombi/Ombi/gulpfile.js create mode 100644 Ombi/Ombi/package.json create mode 100644 Ombi/Ombi/systemjs.config.ts create mode 100644 Ombi/Ombi/tsconfig.json diff --git a/Ombi/.gitignore b/Ombi/.gitignore new file mode 100644 index 000000000..fb8c95056 --- /dev/null +++ b/Ombi/.gitignore @@ -0,0 +1,16 @@ +../app/**/*.js +../app/**/*.js.map +../wwwroot/** + +# dependencies +../node_modules +../bower_components + +# misc +/.sass-cache +/connect.lock +/coverage/* +/libpeerconnection.log +npm-debug.log +testem.log +/typings diff --git a/Ombi/Build/publish windows.bat b/Ombi/Build/publish windows.bat new file mode 100644 index 000000000..22260498f --- /dev/null +++ b/Ombi/Build/publish windows.bat @@ -0,0 +1,4 @@ +;https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/ +cd .. +dotnet restore +dotnet publish -c Release -r win10-x64 diff --git a/Ombi/Build/publish.bat b/Ombi/Build/publish.bat new file mode 100644 index 000000000..2d6b312a7 --- /dev/null +++ b/Ombi/Build/publish.bat @@ -0,0 +1,7 @@ +;https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/ +cd .. +dotnet restore +dotnet publish -c Release -r win10-x64 +dotnet publish -c Release -r osx.10.12-x64 +dotnet publish -c Release -r ubuntu.16.10-x64 +dotnet publish -c Release -r debian.8-x64 diff --git a/Ombi/Ombi.sln b/Ombi/Ombi.sln new file mode 100644 index 000000000..e46d08528 --- /dev/null +++ b/Ombi/Ombi.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.10 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9D30CCF8-A115-4EB7-A34D-07780D752789}" + ProjectSection(SolutionItems) = preProject + Build\publish windows.bat = Build\publish windows.bat + Build\publish.bat = Build\publish.bat + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Ombi/Ombi/.bowerrc b/Ombi/Ombi/.bowerrc new file mode 100644 index 000000000..69fad3580 --- /dev/null +++ b/Ombi/Ombi/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "bower_components" +} diff --git a/Ombi/Ombi/.gitignore b/Ombi/Ombi/.gitignore new file mode 100644 index 000000000..71bffc9b8 --- /dev/null +++ b/Ombi/Ombi/.gitignore @@ -0,0 +1,17 @@ +/app/**/*.js +/app/**/*.js.map +/wwwroot/** + +# dependencies +/node_modules +/bower_components + +# misc +/.sass-cache +/connect.lock +/coverage/* +/libpeerconnection.log +npm-debug.log +testem.log +/typings +/systemjs.config.js* diff --git a/Ombi/Ombi/Controllers/HomeController.cs b/Ombi/Ombi/Controllers/HomeController.cs new file mode 100644 index 000000000..c03c9f475 --- /dev/null +++ b/Ombi/Ombi/Controllers/HomeController.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace Ombi.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult About() + { + ViewData["Message"] = "Your application description page."; + + return View(); + } + + public IActionResult Contact() + { + ViewData["Message"] = "Your contact page."; + + return View(); + } + + public IActionResult Error() + { + return View(); + } + } +} diff --git a/Ombi/Ombi/Ombi.csproj b/Ombi/Ombi/Ombi.csproj new file mode 100644 index 000000000..b1bcbb7c6 --- /dev/null +++ b/Ombi/Ombi/Ombi.csproj @@ -0,0 +1,32 @@ + + + + netcoreapp1.0 + win10-x64;osx.10.12-x64;ubuntu.16.10-x64;debian.8-x64; + + + + + + + + + + + + + + + + + + + + + + + + search.component.js + + + diff --git a/Ombi/Ombi/Program.cs b/Ombi/Ombi/Program.cs new file mode 100644 index 000000000..1949a296a --- /dev/null +++ b/Ombi/Ombi/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; + +namespace Ombi +{ + public class Program + { + public static void Main(string[] args) + { + var host = new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/Ombi/Ombi/Properties/launchSettings.json b/Ombi/Ombi/Properties/launchSettings.json new file mode 100644 index 000000000..8cea528a3 --- /dev/null +++ b/Ombi/Ombi/Properties/launchSettings.json @@ -0,0 +1,22 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52038/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Ombi": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/Ombi/Ombi/Startup.cs b/Ombi/Ombi/Startup.cs new file mode 100644 index 000000000..ccee5f545 --- /dev/null +++ b/Ombi/Ombi/Startup.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.StaticFiles; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Logging; + +namespace Ombi +{ + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(Configuration.GetSection("Logging")); + loggerFactory.AddDebug(); + + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + app.UseBrowserLink(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + } + + app.UseStaticFiles(); + app.UseStaticFiles(new StaticFileOptions + { + FileProvider = new PhysicalFileProvider( + Path.Combine(Directory.GetCurrentDirectory(), @"app")), + RequestPath = new PathString("/app"), + }); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + + routes.MapRoute( + name: "spa-fallback", + template: "{*url}", + defaults: new { controller = "Home", action = "Index" }); + }); + } + } +} diff --git a/Ombi/Ombi/Views/Home/Index.cshtml b/Ombi/Ombi/Views/Home/Index.cshtml new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Ombi/Ombi/Views/Home/Index.cshtml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Ombi/Ombi/Views/Shared/Error.cshtml b/Ombi/Ombi/Views/Shared/Error.cshtml new file mode 100644 index 000000000..e514139c4 --- /dev/null +++ b/Ombi/Ombi/Views/Shared/Error.cshtml @@ -0,0 +1,14 @@ +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/Ombi/Ombi/Views/Shared/_Layout.cshtml b/Ombi/Ombi/Views/Shared/_Layout.cshtml new file mode 100644 index 000000000..0eaaf503f --- /dev/null +++ b/Ombi/Ombi/Views/Shared/_Layout.cshtml @@ -0,0 +1,20 @@ + + + + + + @ViewData["Title"] - Ombi + + + + + + + + + + + @RenderBody() + + + diff --git a/Ombi/Ombi/Views/_ViewImports.cshtml b/Ombi/Ombi/Views/_ViewImports.cshtml new file mode 100644 index 000000000..b60f8a386 --- /dev/null +++ b/Ombi/Ombi/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using Ombi +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Ombi/Ombi/Views/_ViewStart.cshtml b/Ombi/Ombi/Views/_ViewStart.cshtml new file mode 100644 index 000000000..a5f10045d --- /dev/null +++ b/Ombi/Ombi/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/Ombi/Ombi/app/app.component.html b/Ombi/Ombi/app/app.component.html new file mode 100644 index 000000000..87b55177c --- /dev/null +++ b/Ombi/Ombi/app/app.component.html @@ -0,0 +1 @@ + diff --git a/Ombi/Ombi/app/app.component.ts b/Ombi/Ombi/app/app.component.ts new file mode 100644 index 000000000..3b828746f --- /dev/null +++ b/Ombi/Ombi/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'ombi', + moduleId: module.id, + templateUrl: './app.component.html' +}) +export class AppComponent { + +} \ No newline at end of file diff --git a/Ombi/Ombi/app/app.module.ts b/Ombi/Ombi/app/app.module.ts new file mode 100644 index 000000000..05807f52a --- /dev/null +++ b/Ombi/Ombi/app/app.module.ts @@ -0,0 +1,44 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { AppComponent } from './app.component'; + +import 'jquery.nanoscroller'; + +import { RouterModule, Routes } from '@angular/router'; +import { HttpModule } from '@angular/http'; + +import { SearchComponent } from './search/search.component'; +import { PageNotFoundComponent } from './errors/not-found.component'; + + +import { MenubarModule } from 'primeng/components/menubar/menubar'; +import { GrowlModule } from 'primeng/components/growl/growl'; + +const routes: Routes = [ + { path: '*', component: PageNotFoundComponent }, + { path: 'search', component: SearchComponent } +]; + +@NgModule({ + imports: [ + RouterModule.forRoot(routes), + BrowserModule, + BrowserAnimationsModule, + HttpModule, + MenubarModule, + GrowlModule, + //ITAdminModule + ], + declarations: [ + AppComponent, + PageNotFoundComponent, + SearchComponent + ], + providers: [ + //MessageService, + //UtilService + ], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/Ombi/Ombi/app/config.ts b/Ombi/Ombi/app/config.ts new file mode 100644 index 000000000..a9ad55679 --- /dev/null +++ b/Ombi/Ombi/app/config.ts @@ -0,0 +1,29 @@ +// Config + +enum envs { + local, + test, + next, + live +} + +var envVar = "#{Environment}"; +var env = envs.local; +if (envs[envVar]) { + env = envs[envVar]; +} + +export var config = { + envs: envs, + env: env, + systemJS: { + bundle: { + [envs.local]: false, + [envs.test]: true, + [envs.next]: true, + [envs.live]: true + }[env] + } +} + +export default config; \ No newline at end of file diff --git a/Ombi/Ombi/app/errors/not-found.component.ts b/Ombi/Ombi/app/errors/not-found.component.ts new file mode 100644 index 000000000..29a78e9e0 --- /dev/null +++ b/Ombi/Ombi/app/errors/not-found.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + moduleId: module.id, + template: '

Page not found

' +}) +export class PageNotFoundComponent { } \ No newline at end of file diff --git a/Ombi/Ombi/app/main.ts b/Ombi/Ombi/app/main.ts new file mode 100644 index 000000000..774678cc2 --- /dev/null +++ b/Ombi/Ombi/app/main.ts @@ -0,0 +1,13 @@ +import './polyfills'; + +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app.module'; +import { config } from './config'; + +if (config.env !== config.envs.local) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule); \ No newline at end of file diff --git a/Ombi/Ombi/app/polyfills.ts b/Ombi/Ombi/app/polyfills.ts new file mode 100644 index 000000000..7dbacb023 --- /dev/null +++ b/Ombi/Ombi/app/polyfills.ts @@ -0,0 +1,14 @@ +// TypeScript transpiles our app to ES5 but some dependencies are written in ES6 so must polyfill +import 'core-js/es6/string'; +import 'core-js/es6/array'; +import 'core-js/es6/object'; + +import 'core-js/es7/reflect'; +import 'zone.js/dist/zone'; + +import { config } from './config'; + +if (config.env === config.envs.local) { + Error['stackTraceLimit'] = Infinity; + require('zone.js/dist/long-stack-trace-zone'); +} \ No newline at end of file diff --git a/Ombi/Ombi/app/search/search.component.html b/Ombi/Ombi/app/search/search.component.html new file mode 100644 index 000000000..633c82a61 --- /dev/null +++ b/Ombi/Ombi/app/search/search.component.html @@ -0,0 +1 @@ +

Search

\ No newline at end of file diff --git a/Ombi/Ombi/app/search/search.component.ts b/Ombi/Ombi/app/search/search.component.ts new file mode 100644 index 000000000..d92fb760b --- /dev/null +++ b/Ombi/Ombi/app/search/search.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'ombi', + moduleId: module.id, + templateUrl: './search.component.html' +}) +export class SearchComponent { + +} \ No newline at end of file diff --git a/Ombi/Ombi/appsettings.Development.json b/Ombi/Ombi/appsettings.Development.json new file mode 100644 index 000000000..fa8ce71a9 --- /dev/null +++ b/Ombi/Ombi/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/Ombi/Ombi/appsettings.json b/Ombi/Ombi/appsettings.json new file mode 100644 index 000000000..5fff67bac --- /dev/null +++ b/Ombi/Ombi/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } + } +} diff --git a/Ombi/Ombi/bower.json b/Ombi/Ombi/bower.json new file mode 100644 index 000000000..66d9701f8 --- /dev/null +++ b/Ombi/Ombi/bower.json @@ -0,0 +1,13 @@ +{ + "name": "ombi", + "private": true, + "dependencies": { + "bootstrap": "3.3.7", + "jquery": "2.2.0", + "jquery-validation": "1.14.0", + "jquery-validation-unobtrusive": "3.2.6", + "PACE": "pace#^1.0.2", + "font-awesome": "^4.7.0" + } +} + \ No newline at end of file diff --git a/Ombi/Ombi/bundleconfig.json b/Ombi/Ombi/bundleconfig.json new file mode 100644 index 000000000..6d3f9a57a --- /dev/null +++ b/Ombi/Ombi/bundleconfig.json @@ -0,0 +1,24 @@ +// 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 + } +] diff --git a/Ombi/Ombi/gulpfile.js b/Ombi/Ombi/gulpfile.js new file mode 100644 index 000000000..1e12fb57e --- /dev/null +++ b/Ombi/Ombi/gulpfile.js @@ -0,0 +1,252 @@ +/// +'use strict'; +var gulp = require('gulp'); +var sass = require('gulp-sass'); +var changed = require('gulp-changed'); +var rename = require('gulp-rename'); +var uglify = require('gulp-uglify'); +var sourcemaps = require('gulp-sourcemaps'); +var path = require('path'); +var del = require('del'); +var merge = require('merge-stream'); +var gulpif = require('gulp-if'); +var runSequence = require('run-sequence'); +var cleancss = require('gulp-clean-css'); +var filter = require('gulp-filter'); +var systemJSBuilder = require('systemjs-builder'); +var run = require('gulp-run'); + +var paths = { + wwwroot: './wwwroot/', + npm: { // These will be resolved automatically and copied to output directory as its name, only works for pre-bundled modules e.g. angular + src: [ + '@angular/animations', + '@angular/animations/browser', + '@angular/core', + '@angular/common', + '@angular/compiler', + '@angular/platform-browser', + '@angular/platform-browser-dynamic', + '@angular/http', + '@angular/router', + '@angular/forms' + ], + 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' + }, + { + file: './node_modules/systemjs/dist/system-polyfills.src.js', + rename: 'system-polyfills' + }, + './bower_components/jquery/dist/jquery.js', + './bower_components/PACE/pace.js', + './primeng/ripple.js', + './node_modules/nanoscroller/bin/javascripts/jquery.nanoscroller.js', + './systemjs.config.js' + ], + dest: './lib/' + }, + libcss: [ // Normal css files to be copied + { + src: [ + './bower_components/PACE/themes/purple/pace-theme-center-simple.css', + './node_modules/primeng/resources/primeng.css', + './node_modules/nanoscroller/bin/css/nanoscroller.css' + ], + dest: './css/lib/' + }, + { + src: './Styles/**/*.css', + dest: './css', + filter: '**/*.css' + } + ], + libfonts: [ // Library fonts + { + src: [ + './bower_components/font-awesome/fonts/*' + ], + dest: './fonts/lib/' + } + ], + modules: [ // This is for modules with multiple files that require each other, used when npm can't be used + { + name: 'zone.js', + src: ['./node_modules/zone.js/**/*.js'], + dest: './lib/zone.js/' + }, + { + name: 'rxjs', + src: ['./node_modules/rxjs/**/*.js', '!./node_modules/rxjs/src/**/*.js'], + dest: './lib/rxjs/' + }, + { + name: 'core-js', + src: ['./node_modules/core-js/**/*.js'], + dest: './lib/core-js/' + }, + { + name: 'primeng', + src: './node_modules/primeng/**/*.js', + dest: './lib/primeng/' + } + ], + sass: { // Simple sass->css compilation + src: ['./Styles/**/*.scss', '!./Styles/primeng/**'], + dest: './css/', + filter: '**/*.css' + }, + bundle: { // This is the config for the bundler, you shouldn't need to change this + root: './', + dest: './lib/bundle.js', + bundle: 'app/main.js', + } +} + +gulp.task('npm', function () { + var streams = [] + for (let module of paths.npm.src) { + let file = require.resolve(module); + streams.push( + gulp.src(file) + .pipe(gulpif(global.full, sourcemaps.init())) + .pipe(gulpif(global.full, uglify({ source_map: true }))) + .pipe(rename((path => { path.basename = module }))) + .pipe(gulpif(global.full, sourcemaps.write('../maps'))) + .pipe(gulp.dest(path.join(paths.wwwroot, paths.npm.dest))) + ); + } + return merge(streams); +}) + +gulp.task('lib', function () { + var streams = [] + for (let module of paths.lib.src) { + streams.push( + gulp.src(typeof module === "string" ? module : module.file) + .pipe(gulpif(global.full, sourcemaps.init())) + .pipe(gulpif(global.full, uglify({ source_map: true }))) + .pipe(rename(function (path) { + if (typeof module !== "string" && module.rename) { + path.basename = module.rename; + } + })) + .pipe(gulpif(global.full, sourcemaps.write('maps'))) + .pipe(gulp.dest(path.join(paths.wwwroot, paths.lib.dest))) + ); + } + return merge(streams); +}) + +gulp.task('libcss', function () { + var streams = [] + for (let module of paths.libcss) { + var f = filter("**/*.css", { restore: true }); + streams.push( + gulp.src(module.src) + .pipe(f) + .pipe(gulpif(global.full, sourcemaps.init())) + .pipe(gulpif(global.full, cleancss())) + .pipe(gulpif(global.full, sourcemaps.write(`${module.name ? '.' : ''}./maps/${module.name ? module.name : ''}`))) + .pipe(f.restore) + .pipe(gulp.dest(path.join(paths.wwwroot, module.dest))) + ); + } + return merge(streams); +}) + + +gulp.task('libfonts', function () { + var streams = [] + for (let module of paths.libfonts) { + streams.push( + gulp.src(module.src) + .pipe(gulp.dest(path.join(paths.wwwroot, module.dest))) + ); + } + return merge(streams); +}) + +gulp.task('modules', function () { + var streams = [] + for (let module of paths.modules) { + streams.push( + gulp.src(module.src) + .pipe(gulpif(global.full, sourcemaps.init())) + .pipe(gulpif(global.full, uglify({ source_map: true }))) + .pipe(gulpif(global.full, sourcemaps.write(`${module.name ? '.' : ''}./maps/${module.name ? module.name : ''}`))) + .pipe(gulp.dest(path.join(paths.wwwroot, module.dest))) + ); + } + return merge(streams); +}) + +gulp.task('sass', function () { + return gulp.src(paths.sass.src) + .pipe(changed(paths.sass.dest)) + .pipe(gulpif(global.full, sourcemaps.init())) + .pipe(sass({ outputStyle: global.full ? 'compressed' : 'nested' }).on('error', sass.logError)) + .pipe(gulpif(global.full, sourcemaps.write('maps'))) + .pipe(gulp.dest(path.join(paths.wwwroot, paths.sass.dest))) +}); + +gulp.task('bundle', function () { + var builder = new systemJSBuilder(paths.bundle.root); + builder.config({ + baseURL: paths.wwwroot, + packages: { + '.': { + defaultExtension: 'js' + } + }, + paths: { + '*': 'lib/*', + 'app/*': 'app/*' + } + }); + del.sync(path.join(paths.wwwroot, paths.bundle.dest), { force: true }); + return builder.bundle(paths.bundle.bundle, path.join(paths.wwwroot, paths.bundle.dest), { + sourceMaps: true + }) +}) + +gulp.task('clean', function () { + return del([ + ...paths.npm.src.map(x => path.join(paths.npm.dest, x + "**")), + paths.sass.dest + paths.sass.filter, + paths.lib.dest, + paths.bundle.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 () { + return run('tsc').exec(); +}); + +gulp.task('fullvar', () => { global.full = true }); +gulp.task('libs') +gulp.task('copy', ['lib', 'libcss', 'libfonts', 'npm', 'modules']); +gulp.task('compile', ['sass']); +gulp.task('build', callback => runSequence('copy', 'compile', callback)); +gulp.task('full', callback => runSequence('clean', 'build', callback)); + +// Use this in a build server environment to compile and bundle everything +gulp.task('publish', callback => runSequence('fullvar', 'full', 'typescript', 'bundle', callback)); + +// Auto compiles sass files on change, note that this doesn't seem to pick up new files at the moment +gulp.task('watch', function () { + gulp.watch(paths.sass.src, ['sass']); + gulp.watch('./Styles/**/*.css', ['libcss']); // legacy css +}); \ No newline at end of file diff --git a/Ombi/Ombi/package.json b/Ombi/Ombi/package.json new file mode 100644 index 000000000..6c8d0fb82 --- /dev/null +++ b/Ombi/Ombi/package.json @@ -0,0 +1,42 @@ +{ + "name": "ombi", + "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/router": "^4.0.0", + "@types/jquery": "^2.0.33", + "@types/systemjs": "^0.20.2", + "core-js": "^2.4.1", + "del": "^2.2.2", + "gulp": "~3.9.1", + "gulp-changed": "^1.3.0", + "gulp-clean-css": "^3.0.4", + "gulp-filter": "^5.0.0", + "gulp-if": "^2.0.2", + "gulp-rename": "^1.2.2", + "gulp-run": "^1.7.1", + "gulp-sass": "^2.3.2", + "gulp-sourcemaps": "^1.9.0", + "gulp-systemjs-builder": "^0.15.0", + "gulp-uglify": "^1.5.4", + "merge-stream": "^1.0.1", + "nanoscroller": "^0.8.7", + "primeng": "^2.0.5", + "run-sequence": "^1.2.2", + "rxjs": "^5.0.3", + "systemjs": "^0.19.41", + "systemjs-builder": "^0.15.34", + "typescript": "^2.2.1", + "zone.js": "^0.8.5" + } +} \ No newline at end of file diff --git a/Ombi/Ombi/systemjs.config.ts b/Ombi/Ombi/systemjs.config.ts new file mode 100644 index 000000000..b31bed9a4 --- /dev/null +++ b/Ombi/Ombi/systemjs.config.ts @@ -0,0 +1,20 @@ +System.import('/app/config.js').then((module: any) => { + var config = module.config.systemJS; + System.config({ + baseURL: '/lib', + packages: { + '.': { + defaultExtension: 'js' + } + }, + map: { app: '../app' } + }) + + if (config.bundle) { + System.import('bundle').then(() => { + System.import('/app/main'); + }) + } else { + System.import('/app/main') + } +}); \ No newline at end of file diff --git a/Ombi/Ombi/tsconfig.json b/Ombi/Ombi/tsconfig.json new file mode 100644 index 000000000..442f43235 --- /dev/null +++ b/Ombi/Ombi/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ "es5", "es2015" ], + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "strictNullChecks": true, + "noUnusedLocals": true, + "noImplicitThis": true, + "noImplicitReturns": true, + "noImplicitAny": true, + "suppressImplicitAnyIndexErrors": true, + "alwaysStrict": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "skipLibCheck": true + }, + "compileOnSave": true +} \ No newline at end of file