Reworking the compiler & how the code is imported.

This commit is contained in:
Tristan Roux
2019-03-21 22:27:50 +01:00
parent 8b04d5f8fc
commit c0f4cb94d7
13 changed files with 2227 additions and 275 deletions

19
.vscode/tasks.json vendored
View File

@@ -1,7 +1,4 @@
// Sass configuration
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks":
[
@@ -20,15 +17,17 @@
"command": "gulp watch",
"group": "build"
},
{
"label": "Build Typescript",
"type": "shell",
"command": "npx webpack",
"group": "build"
},
{
"label": "Watch Typescript",
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"group": "build",
"problemMatcher": [
"$tsc-watch"
]
"type": "shell",
"command": "npx webpack --watch",
"group": "build"
}
]
}

View File

@@ -3,22 +3,5 @@
{
"path": "."
}
],
"settings":
{
"liveSassCompile.settings.formats":
[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/dist/css"
}
],
"liveSassCompile.settings.excludeList":
[
"**/node_modules/**",
".vscode/**",
"**/src/scss/fragments/**"
]
}
}

21
dist/js/Carousel.js vendored
View File

@@ -1,21 +0,0 @@
"use strict";
var selectedIndex = 0;
var carousel;
var angle = 0;
function setup() {
carousel = document.querySelector(".carousel");
var list = document.getElementsByClassName("carousel__cell");
for (var i = 0; i < list.length; i++) {
list[i].id = i.toString();
list[i].addEventListener("click", () => {
var ev = event.target;
rotateCarousel(ev.id);
});
}
;
}
function rotateCarousel(target) {
angle = (selectedIndex - target) * 20 + angle;
carousel.style.transform = "translateZ(-880px) rotateY(" + angle + "deg)";
selectedIndex = target;
}

65
dist/js/Library.js vendored
View File

@@ -1,65 +0,0 @@
"use strict";
class Game {
constructor(name, id, thumbnail, launcher, launcherID, isInstalled, localPath) {
this.name = name;
this.id = id;
this.thumbnail = thumbnail;
this.launcher = launcher;
this.launcherID = launcherID;
this.isInstalled = isInstalled;
this.localPath = localPath;
}
}
var launcher;
(function (launcher) {
launcher[launcher["LocalOnly"] = 0] = "LocalOnly";
launcher[launcher["Steam"] = 1] = "Steam";
})(launcher || (launcher = {}));
function populateGrid() {
var games = [
new Game("La ligue du sel", "", "https://news-a.akamaihd.net/public/images/misc/GameBox.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, "")
];
let grid = document.getElementById("library");
for (var i = 0; i < games.length; i++) {
let game = games[i];
let gridHtml = "<img src='" + game.thumbnail + "'/> <p>" + game.name + "</p>";
let element = document.createElement("div");
element.className = "game";
element.onclick = () => { onGameClick(game); };
element.innerHTML = gridHtml;
if (grid != null)
grid.appendChild(element);
}
}
function onGameClick(gameClicked) {
console.log(gameClicked.name);
}
function openSearch() {
let input = document.getElementById("searchInput");
input.value = "";
input.focus();
}

31
dist/js/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -10,20 +10,18 @@
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script>if (window.module) module = window.module;</script>
<script src="dist/js/Carousel.js"></script>
<script src="dist/js/Library.js"></script>
<script src="dist/js/index.js"></script>
</head>
<body onLoad="home()">
<body>
<header>
<nav class="navbar navbar-dark bg-primary align-items-end"> <!--fixed-top-->
<a id="title" class="navbar-brand text-white" onClick="home()">EAU</a>
<a id="title" class="navbar-brand text-white">EAU</a>
<div style="float: right;">
<div class="searchbar">
<button type="button" class="btn icon" onClick="openSearch()"><i class="fa fa-search"></i></button>
<button id="searchBtn" type="button" class="btn icon"><i class="fa fa-search"></i></button>
<input type="text" id="searchInput" placeholder="Search your library" />
</div>
<button type="button" class="btn icon" onClick="openSettings()"><i class="fa fa-cog"></i></button>
<button id="settingsBtn" type="button" class="btn icon"><i class="fa fa-cog"></i></button>
</div>
</nav>
</header>

2166
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,12 +6,12 @@
"dependencies": {
"@types/jquery": "^3.3.29",
"bootstrap": "^4.3.1",
"electron": "^4.0.5",
"electron": "^4.1.1",
"gulp": "^4.0.0",
"gulp-sass": "^4.0.2",
"jquery": "^3.3.1",
"npm": "^6.9.0",
"oidc-client": "^1.6.1",
"oidc-client": "^1.7.0",
"popper.js": "^1.14.7"
},
"scripts": {
@@ -26,5 +26,12 @@
"bugs": {
"url": "https://github.com/AnonymusRaccoon/EAU/issues"
},
"homepage": "https://github.com/AnonymusRaccoon/EAU#readme"
"homepage": "https://github.com/AnonymusRaccoon/EAU#readme",
"devDependencies": {
"ts-loader": "^5.3.3",
"typescript": "^3.3.4000",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
}
}

View File

@@ -2,7 +2,7 @@ var selectedIndex = 0;
var carousel: any;
var angle = 0;
function setup()
export function setup()
{
carousel = document.querySelector(".carousel");

View File

@@ -27,7 +27,7 @@ enum launcher
}
function populateGrid()
export function populateGrid()
{
var games: Game[] =
[
@@ -76,11 +76,3 @@ function onGameClick(gameClicked: Game)
{
console.log(gameClicked.name);
}
function openSearch()
{
let input = <HTMLInputElement>document.getElementById("searchInput");
input.value = "";
input.focus();
}

View File

@@ -1,3 +1,15 @@
// import $ from "jquery"; //Using global scope jquery instead beacause it make a huge file if we use this.
import { setup } from "./Carousel";
import { populateGrid } from "./Library"
$(function ()
{
home();
document.getElementById("title").onclick = () => { home() };
document.getElementById("searchBtn").onclick = () => { openSearch() };
document.getElementById("settingsBtn").onclick = () => { openSettings() };
});
function home()
{
$("#content").load("dist/html/home.html", () =>
@@ -8,6 +20,14 @@ function home()
document.getElementById("title").innerHTML = "EAU";
}
function openSearch()
{
let input = <HTMLInputElement>document.getElementById("searchInput");
input.value = "";
input.focus();
}
function openSettings()
{
$("#content").load("dist/html/settings.html");
@@ -15,20 +35,23 @@ function openSettings()
}
//Log In
import Oidc, { UserManagerSettings } from "oidc-client";
// import Oidc, { UserManagerSettings } from "oidc-client";
var OidcSettings: UserManagerSettings =
{
authority: "https://steamcommunity.com/openid",
client_id: "7C218E8D1347C3CD6CB8117E5ED533BC",
redirect_uri: "localhost:5500",
response_type: "token",
scope: "openid"
};
// var OidcSettings: UserManagerSettings =
// {
// authority: "https://steamcommunity.com/openid",
// client_id: "7C218E8D1347C3CD6CB8117E5ED533BC",
// redirect_uri: "localhost:5500",
// response_type: "token",
// scope: "openid"
// };
function steamLogIn()
{
console.log("Logging into steam");
var manager = new Oidc.UserManager(OidcSettings);
manager.signinPopup();
}
// function steamLogIn()
// {
// console.log("Logging into steam");
// var manager = new Oidc.UserManager(OidcSettings);
// manager.signinPopup();
// }
require("./Library");
require("./Carousel");

View File

@@ -1,10 +1,14 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": { "*": ["types/*"] },
"paths":
{
"oidc-client": ["node_modules/oidc-client/index.d.ts"],
"*": ["types/*"]
},
/* Basic Options */
"target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"target": "ES5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "ES6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib":
// [
// "dom"

27
webpack.config.js Normal file
View File

@@ -0,0 +1,27 @@
const path = require("path");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: [
"./src/ts/index.ts",
"./src/ts/Carousel.ts"
],
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: "index.js",
path: path.resolve(__dirname, "dist/js")
},
mode: "production"
};