Intermediate commit:

- webpack build does not run successfully, typescript errors out, saying
  "TS2304: Cannot find name 'module'." or 'require' or 'process' in
  certain .ts files.
This commit is contained in:
Manuel Friedli 2017-03-14 15:42:11 +01:00
parent d6604351fe
commit be51aab2ee
43 changed files with 213 additions and 53 deletions

5
.gitignore vendored
View File

@ -4,6 +4,7 @@
atlassian-ide-plugin.xml
node_modules/
typings/
app/**/*.js
app/**/*.js.map
src/**/*.js
src/**/*.js.map
npm-debug.log
dist/

7
config/helpers.js Normal file
View File

@ -0,0 +1,7 @@
var path = require('path');
var _root = path.resolve(__dirname, '..');
function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [_root].concat(args));
}
exports.root = root;

76
config/webpack.common.js Normal file
View File

@ -0,0 +1,76 @@
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var helpers = require('./helpers');
module.exports = {
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts',
'app': './src/main.ts'
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
loaders: [
{
loader: 'awesome-typescript-loader',
options: {
configFileName: helpers.root('src', 'tsconfig.json')
}
},
'angular2-template-loader'
]
},
{
test: /\.html$/,
use: 'html-loader'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
use: 'file-loader?name=assets/[name].[hash].[ext]'
},
// {
// test: /\.css$/,
// exclude: helpers.root('src', 'app'),
// use: ExtractTextPlugin.extract({
// fallback: 'style-loader',
// use: 'css-loader?sourceMap'
// })
// },
{
test: /\.css$/,
include: helpers.root('src', 'app'),
use: 'raw-loader'
}
]
},
plugins: [
// Workaround for angular/angular#11580
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
helpers.root('./src'), // location of your src
{} // a map of your routes
),
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor', 'polyfills']
}),
new HtmlWebpackPlugin({
template: 'src/index.html'
}),
new webpack.optimize.UglifyJsPlugin({
comments: false
})
]
};

24
config/webpack.dev.js Normal file
View File

@ -0,0 +1,24 @@
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');
module.exports = webpackMerge(commonConfig, {
devtool: 'cheap-module-eval-source-map',
output: {
path: helpers.root('dist'),
publicPath: 'http://localhost:8080/',
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
plugins: [
new ExtractTextPlugin('[name].css')
],
devServer: {
historyApiFallback: true,
stats: 'minimal'
}
});

1
karma.conf.js Normal file
View File

@ -0,0 +1 @@
module.exports = require('./config/karma.conf.js');

View File

@ -3,7 +3,10 @@
"version": "1.0.0-alpha.1",
"description": "Convert to and fro!",
"keywords": [
"dencode", "conversion", "converter", "convert"
"dencode",
"conversion",
"converter",
"convert"
],
"author": {
"name": "Manuel Friedli",
@ -13,35 +16,48 @@
"homepage": "https://test.friedli.info/~manuel/dencode",
"repository": "https://gittr.ch/manuel/dencode.org.git",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/upgrade": "2.0.0",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "^0.19.27",
"zone.js": "^0.6.12",
"@angular/common": "~2.4.0",
"@angular/compiler": "~2.4.0",
"@angular/core": "~2.4.0",
"@angular/forms": "~2.4.0",
"@angular/platform-browser": "~2.4.0",
"@angular/platform-browser-dynamic": "~2.4.0",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.7.4",
"bootstrap": "^3.3.0",
"quoted-printable": "^1.0.0",
"utf8": "^2.1.1",
"punycode": "1.4.1"
"utf8": "^2.1.0",
"punycode": "^1.4.0"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.0",
"typescript": "^2.0.2",
"typings": "^1.3.2"
"@types/node": "^6.0.45",
"@types/jasmine": "2.5.36",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.0.4",
"css-loader": "^0.26.1",
"extract-text-webpack-plugin": "2.0.0-beta.5",
"file-loader": "^0.9.0",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.16.1",
"jasmine-core": "^2.4.1",
"karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.1",
"null-loader": "^0.1.1",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.2",
"style-loader": "^0.13.1",
"typescript": "~2.0.10",
"webpack": "2.2.1",
"webpack-dev-server": "2.4.1",
"webpack-merge": "^3.0.0"
},
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
"start": "webpack-dev-server --inline --progress --port 8080",
"test": "karma start",
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail"
}
}

View File

@ -1,4 +1,5 @@
import {Converter} from "./converter";
export class BinToDecConverter implements Converter {
getDisplayname():string {
return "Convert binary to decimal";

View File

@ -1,4 +1,5 @@
import {Converter} from "./converter";
export class DecToBinConverter implements Converter {
getDisplayname():string {
return "Convert decimal to binary";

View File

@ -1,4 +1,5 @@
import {Converter} from "./converter";
export class DecToHexConverter implements Converter {
getDisplayname():string {
return "Convert decimal to hexadecimal";

View File

@ -1,4 +1,5 @@
import {Converter} from "./converter";
export class HexToDecConverter implements Converter {
getDisplayname():string {
return "Convert hexadecimal to decimal";

View File

@ -1,4 +1,5 @@
import {Converter} from "./converter/converter";
export class Step {
public content:string = "";
public selectedConverter:Converter = undefined;

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -1,23 +1,27 @@
<!DOCTYPE html>
<!--
~ Copyright (C) Schweizerische Bundesbahnen SBB, 2017.
-->
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<title>Decode? Encode? DENcode!</title>
<script type="text/javascript" src="node_modules/core-js/client/shim.js"></script>
<script type="text/javascript" src="node_modules/zone.js/dist/zone.js"></script>
<script type="text/javascript" src="node_modules/reflect-metadata/Reflect.js"></script>
<script type="text/javascript" src="node_modules/systemjs/dist/system.src.js"></script>
<script type="text/javascript" src="node_modules/utf8/utf8.js"></script>
<script type="text/javascript" src="node_modules/quoted-printable/quoted-printable.js"></script>
<script type="text/javascript" src="node_modules/punycode/punycode.js"></script>
<!--<script type="text/javascript" src="node_modules/core-js/client/shim.js"></script>-->
<!--<script type="text/javascript" src="node_modules/zone.js/dist/zone.js"></script>-->
<!--<script type="text/javascript" src="node_modules/reflect-metadata/Reflect.js"></script>-->
<!--<script type="text/javascript" src="node_modules/systemjs/dist/system.src.js"></script>-->
<!--<script type="text/javascript" src="node_modules/utf8/utf8.js"></script>-->
<!--<script type="text/javascript" src="node_modules/quoted-printable/quoted-printable.js"></script>-->
<!--<script type="text/javascript" src="node_modules/punycode/punycode.js"></script>-->
<script type="text/javascript" src="systemjs.config.js"></script>
<script type="text/javascript">
System.import("app").catch(function (err) {
console.log(err);
});
</script>
<!--<script type="text/javascript" src="systemjs.config.js"></script>-->
<!--<script type="text/javascript">-->
<!--System.import("app").catch(function (err) {-->
<!--console.log(err);-->
<!--});-->
<!--</script>-->
<style>
@font-face {
font-family: "ABeeZee";

View File

@ -1,4 +1,4 @@
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AppModule} from "./app.module";
import {AppModule} from "./app/app.module";
platformBrowserDynamic().bootstrapModule(AppModule);

12
src/polyfills.ts Normal file
View File

@ -0,0 +1,12 @@
import "core-js/es6";
import "core-js/es7/reflect";
import "zone.js/dist/zone";
require('zone.js/dist/zone');
if (process.env.ENV === 'production') {
// Production
} else {
// Development and test
Error['stackTraceLimit'] = Infinity;
require('zone.js/dist/long-stack-trace-zone');
}

View File

@ -1,12 +1,17 @@
{
"compilerOptions": {
"alwaysStrict": true,
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
"lib": [
"es2015",
"dom"
],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}

17
src/vendor.ts Normal file
View File

@ -0,0 +1,17 @@
import "@angular/core";
import "@angular/platform-browser";
import "@angular/platform-browser-dynamic";
import "@angular/forms";
// import {Component, Injectable, NgModule, OnInit} from "@angular/core";
// import {BrowserModule} from "@angular/platform-browser";
// import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
// import {FormsModule} from "@angular/forms";
// // Angular
// import '@angular/platform-browser-dynamic';
// import '@angular/common';
// import '@angular/http';
// import '@angular/router';
//
// // RxJS
// import 'rxjs';

View File

@ -1,9 +0,0 @@
{
"name": "dencode.org",
"dependencies": {},
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160914114559",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160915134512"
}
}

1
webpack.config.js Normal file
View File

@ -0,0 +1 @@
module.exports = require('./config/webpack.dev.js');