Merge branch '16-migrate-build-to-webpack' into 'develop'
Resolve "Migrate build to webpack" Closes #16 See merge request !11
This commit is contained in:
commit
c4f508705f
53 changed files with 330 additions and 301 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
||||||
atlassian-ide-plugin.xml
|
atlassian-ide-plugin.xml
|
||||||
node_modules/
|
node_modules/
|
||||||
typings/
|
typings/
|
||||||
app/**/*.js
|
src/**/*.js
|
||||||
app/**/*.js.map
|
src/**/*.js.map
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
dist/
|
||||||
|
|
|
@ -2,56 +2,27 @@ stages:
|
||||||
- build
|
- build
|
||||||
- cleanup_build
|
- cleanup_build
|
||||||
- deploy
|
- deploy
|
||||||
# - cleanup
|
- cleanup
|
||||||
|
|
||||||
.run_deploy: &run_deploy
|
|
||||||
script:
|
|
||||||
- chmod +x ./deploy.sh
|
|
||||||
- ./deploy.sh
|
|
||||||
# dependencies:
|
|
||||||
# - build_job
|
|
||||||
|
|
||||||
build_job:
|
build_job:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
- npm run tsc
|
- npm run build
|
||||||
tags:
|
tags:
|
||||||
- javascript
|
- javascript
|
||||||
except:
|
except:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- app/*.css
|
- dist
|
||||||
- app/*.html
|
|
||||||
- app/*.js
|
|
||||||
- app/*.js.map
|
|
||||||
- app/converter/*.js
|
|
||||||
- app/converter/*.js.map
|
|
||||||
- node_modules/@angular/
|
|
||||||
- node_modules/core-js/client/shim.js
|
|
||||||
- node_modules/zone.js/dist/zone.js
|
|
||||||
- node_modules/reflect-metadata/Reflect.js
|
|
||||||
- node_modules/rxjs/
|
|
||||||
- node_modules/systemjs/dist/system.src.js
|
|
||||||
- node_modules/utf8/utf8.js
|
|
||||||
- node_modules/quoted-printable/quoted-printable.js
|
|
||||||
- node_modules/punycode/punycode.js
|
|
||||||
- abeezee-regular.woff
|
|
||||||
- freemono.eot
|
|
||||||
- freemono.svg
|
|
||||||
- freemono.ttf
|
|
||||||
- freemono.woff
|
|
||||||
- index.html
|
|
||||||
- package.json
|
|
||||||
- systemjs.config.js
|
|
||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
|
|
||||||
cleanup_build_job:
|
cleanup_build_job:
|
||||||
stage: cleanup_build
|
stage: cleanup_build
|
||||||
script:
|
script:
|
||||||
- rm -rf node_modules
|
- rm -rf node_modules
|
||||||
- rm -rf typings
|
- rm -rf dist
|
||||||
when: on_failure
|
when: on_failure
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
|
@ -61,19 +32,7 @@ pages:
|
||||||
- tags
|
- tags
|
||||||
- master
|
- master
|
||||||
script:
|
script:
|
||||||
- mkdir -p public/{app/converter,node_modules/{@angular,core-js/client,zone.js/dist,reflect-metadata,rxjs,systemjs/dist,utf8,quoted-printable,punycode}}
|
- mv dist public
|
||||||
- cp -a index.html abeezee-regular.woff freemono.* package.json systemjs.config.js public/
|
|
||||||
- cp -a app/*.css app/*.html app/*.js app/*.js.map public/app/
|
|
||||||
- cp -a app/converter/*.js app/converter/*.js.map public/app/converter/
|
|
||||||
- cp -a node_modules/@angular/* public/node_modules/@angular/
|
|
||||||
- cp -a node_modules/core-js/client/shim.js public/node_modules/core-js/client/
|
|
||||||
- cp -a node_modules/zone.js/dist/zone.js public/node_modules/zone.js/dist/
|
|
||||||
- cp -a node_modules/reflect-metadata/Reflect.js public/node_modules/reflect-metadata/
|
|
||||||
- cp -a node_modules/rxjs/* public/node_modules/rxjs/
|
|
||||||
- cp -a node_modules/systemjs/dist/system.src.js public/node_modules/systemjs/dist/
|
|
||||||
- cp -a node_modules/utf8/utf8.js public/node_modules/utf8/
|
|
||||||
- cp -a node_modules/quoted-printable/quoted-printable.js public/node_modules/quoted-printable/
|
|
||||||
- cp -a node_modules/punycode/punycode.js public/node_modules/punycode/
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
@ -82,17 +41,16 @@ pages:
|
||||||
|
|
||||||
production:
|
production:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
<<: *run_deploy
|
|
||||||
environment: production
|
environment: production
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
variables:
|
script:
|
||||||
ENVIRON: production
|
- if [[ -z "${WWW_DEPLOY_ROOT_PRODUCTION}" ]] ; then echo "WWW_DEPLOY_ROOT_PRODUCTION is not set" ; exit 1 ; fi
|
||||||
TARGET: $WWW_DEPLOY_ROOT_PRODUCTION
|
- if [[ ! -d "${WWW_DEPLOY_ROOT_PRODUCTION}" ]] ; then mkdir -p "${WWW_DEPLOY_ROOT_PRODUCTION}" || die "Failed to create target directory for deployment!" ; fi
|
||||||
|
- cp dist/* "${WWW_DEPLOY_ROOT_PRODUCTION}"
|
||||||
|
|
||||||
#cleanup_job:
|
cleanup_job:
|
||||||
# stage: cleanup
|
stage: cleanup
|
||||||
# script:
|
script:
|
||||||
# - rm -rf node_modules
|
- rm -rf node_modules
|
||||||
# - rm -rf typings
|
when: always
|
||||||
# when: always
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
import {Injectable} from "@angular/core";
|
|
||||||
|
|
||||||
declare var utf8:any;
|
|
||||||
declare var quotedPrintable:any;
|
|
||||||
declare var punycode:any;
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class NativeLibraryWrapperService {
|
|
||||||
public utf8:any;
|
|
||||||
public quotedPrintable:any;
|
|
||||||
public punycode:any;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.utf8 = utf8;
|
|
||||||
this.quotedPrintable = quotedPrintable;
|
|
||||||
this.punycode = punycode;
|
|
||||||
}
|
|
||||||
}
|
|
7
config/helpers.js
Normal file
7
config/helpers.js
Normal 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
76
config/webpack.common.js
Normal 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
24
config/webpack.dev.js
Normal 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'
|
||||||
|
}
|
||||||
|
});
|
38
config/webpack.prod.js
Normal file
38
config/webpack.prod.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
var webpack = require('webpack');
|
||||||
|
var webpackMerge = require('webpack-merge');
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
|
var commonConfig = require('./webpack.common.js');
|
||||||
|
var helpers = require('./helpers');
|
||||||
|
|
||||||
|
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
|
||||||
|
|
||||||
|
module.exports = webpackMerge(commonConfig, {
|
||||||
|
devtool: 'source-map',
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: helpers.root('dist'),
|
||||||
|
publicPath: '',
|
||||||
|
filename: '[name].[hash].js',
|
||||||
|
chunkFilename: '[id].[hash].chunk.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
|
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
|
||||||
|
mangle: {
|
||||||
|
keep_fnames: true
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
new ExtractTextPlugin('[name].[hash].css'),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': {
|
||||||
|
'ENV': JSON.stringify(ENV)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
new webpack.LoaderOptionsPlugin({
|
||||||
|
htmlLoader: {
|
||||||
|
minimize: false // workaround for ng2
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
61
deploy.sh
61
deploy.sh
|
@ -1,61 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
function die() {
|
|
||||||
echo $*
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
declare destination
|
|
||||||
case "${TARGET}" in
|
|
||||||
"${WWW_DEPLOY_ROOT_DEVELOP}")
|
|
||||||
destination="${TARGET}/${CI_BUILD_REF_NAME}"
|
|
||||||
;;
|
|
||||||
"${WWW_DEPLOY_ROOT_STAGING}"|"${WWW_DEPLOY_ROOT_PRODUCTION}")
|
|
||||||
destination="${TARGET}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
die "Invalid TARGET specified. Aborting deployment."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ ! -d "${destination}" ]] ; then
|
|
||||||
mkdir -p "${destination}" || die "Failed to create target directory for deployment!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf "${destination}"/* || die "Failed to clean destination directory (step 1)"
|
|
||||||
rm -rf "${destination}"/.??* || die "Failed to clean destination directory (step 2)"
|
|
||||||
|
|
||||||
cp -a index.html abeezee-regular.woff freemono.* package.json systemjs.config.js "${destination}" || die "Failed to copy resources to dest/"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/app/converter" || die "Failed to create dest/app/converter directory"
|
|
||||||
cp -a app/*.css app/*.html app/*.js app/*.js.map "${destination}/app" || die "Failed to copy resources to dest/app"
|
|
||||||
cp -a app/converter/*.js app/converter/*.js.map "${destination}/app/converter" || die "Failed to copy resources to dest/app/converter"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/@angular" || die "Failed to create dest/node_modules/@angular"
|
|
||||||
cp -a node_modules/@angular/* "${destination}/node_modules/@angular/" || die "Failed to copy @angular"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/core-js/client" || die "Failed to create dest/node_modules/core-js"
|
|
||||||
cp -a node_modules/core-js/client/shim.js "${destination}/node_modules/core-js/client/" || die "Failed to copy core-js"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/zone.js/dist" || die "Failed to create dest/node_modules/zone.js"
|
|
||||||
cp -a node_modules/zone.js/dist/zone.js "${destination}/node_modules/zone.js/dist/" || die "Failed to copy zone.js"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/reflect-metadata" || die "Failed to create dest/node_modules/reflect-metadata"
|
|
||||||
cp -a node_modules/reflect-metadata/Reflect.js "${destination}/node_modules/reflect-metadata/" || die "Failed to copy Reflect.js"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/rxjs" || die "Failed to create dest/node_modules/rxjs"
|
|
||||||
cp -a node_modules/rxjs/* "${destination}/node_modules/rxjs/" || die "Failed to copy rxjs"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/systemjs/dist" || die "Failed to create dest/node_modules/systemjs"
|
|
||||||
cp -a node_modules/systemjs/dist/system.src.js "${destination}/node_modules/systemjs/dist/" || die "Failed to copy system.src.js"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/utf8" || die "Failed to create dest/node_modules/utf8"
|
|
||||||
cp -a node_modules/utf8/utf8.js "${destination}/node_modules/utf8/" || die "Failed to copy utf8.js"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/quoted-printable" || die "Failed to create dest/node_modules/quoted-printable"
|
|
||||||
cp -a node_modules/quoted-printable/quoted-printable.js "${destination}/node_modules/quoted-printable/" || die "Failed to copy quoted-printable.js"
|
|
||||||
|
|
||||||
mkdir -p "${destination}/node_modules/punycode" || die "Failed to create dest/node_modules/punycode"
|
|
||||||
cp -a node_modules/punycode/punycode.js "${destination}/node_modules/punycode/" || die "Failed to copy punycode.js"
|
|
||||||
|
|
||||||
echo "Deployment successful."
|
|
55
index.html
55
index.html
|
@ -1,55 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<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="systemjs.config.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
System.import("app").catch(function (err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: "ABeeZee";
|
|
||||||
font-stretch: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-variant: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
src: local("ABeeZee Regular"),
|
|
||||||
local("ABeeZee-Regular"),
|
|
||||||
local("ABeeZee"),
|
|
||||||
url("abeezee-regular.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: "ABeeZee", sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 1em 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Decode? Encode? DENcode!</h1>
|
|
||||||
<noscript>This webpage lets you decode and encode data and text to and from various formats. But
|
|
||||||
it requires you to <strong>enable Javascript</strong> to do so. So please turn it on in your
|
|
||||||
Browser. You won't regret it!
|
|
||||||
</noscript>
|
|
||||||
<den-app>
|
|
||||||
<div style="text-align:center;">Please hold on, we're starting the turbines ...</div>
|
|
||||||
</den-app>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
1
karma.conf.js
Normal file
1
karma.conf.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./config/karma.conf.js');
|
77
package.json
77
package.json
|
@ -1,47 +1,66 @@
|
||||||
{
|
{
|
||||||
"name": "dencode.org",
|
"name": "dencode.org",
|
||||||
"version": "1.0.0-alpha.1",
|
"version": "1.0.0-alpha.2",
|
||||||
"description": "Convert to and fro!",
|
"description": "Convert to and fro!",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"dencode", "conversion", "converter", "convert"
|
"dencode",
|
||||||
|
"conversion",
|
||||||
|
"converter",
|
||||||
|
"convert"
|
||||||
],
|
],
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Manuel Friedli",
|
"name": "Manuel Friedli",
|
||||||
"email": "manuel@fritteli.ch"
|
"email": "manuel@fritteli.ch"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://test.friedli.info/~manuel/dencode",
|
"homepage": "https://manuel.pages.gittr.ch/dencode.org",
|
||||||
"repository": "https://gittr.ch/manuel/dencode.org.git",
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gittr.ch/manuel/dencode.org.git"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/common": "2.0.0",
|
"@angular/common": "^2.4.0",
|
||||||
"@angular/compiler": "2.0.0",
|
"@angular/compiler": "^2.4.0",
|
||||||
"@angular/core": "2.0.0",
|
"@angular/core": "^2.4.0",
|
||||||
"@angular/forms": "2.0.0",
|
"@angular/forms": "^2.4.0",
|
||||||
"@angular/platform-browser": "2.0.0",
|
"@angular/platform-browser": "^2.4.0",
|
||||||
"@angular/platform-browser-dynamic": "2.0.0",
|
"@angular/platform-browser-dynamic": "^2.4.0",
|
||||||
"@angular/upgrade": "2.0.0",
|
"core-js": "^2.4.1",
|
||||||
"bootstrap": "^3.3.6",
|
"rxjs": "^5.0.1",
|
||||||
"core-js": "^2.4.0",
|
"zone.js": "^0.7.4",
|
||||||
"reflect-metadata": "^0.1.3",
|
"bootstrap": "^3.3.0",
|
||||||
"rxjs": "5.0.0-beta.12",
|
|
||||||
"systemjs": "^0.19.27",
|
|
||||||
"zone.js": "^0.6.12",
|
|
||||||
"quoted-printable": "^1.0.0",
|
"quoted-printable": "^1.0.0",
|
||||||
"utf8": "^2.1.1",
|
"utf8": "^2.1.0",
|
||||||
"punycode": "1.4.1"
|
"punycode": "^1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"concurrently": "^2.2.0",
|
"@types/node": "^6.0.45",
|
||||||
"lite-server": "^2.2.0",
|
"@types/jasmine": "2.5.36",
|
||||||
"typescript": "^2.0.2",
|
"angular2-template-loader": "^0.6.0",
|
||||||
"typings": "^1.3.2"
|
"awesome-typescript-loader": "^3.0.4",
|
||||||
|
"css-loader": "^0.26.1",
|
||||||
|
"extract-text-webpack-plugin": "^2.0.0",
|
||||||
|
"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": {
|
"scripts": {
|
||||||
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
|
"start": "webpack-dev-server --inline --progress --port 8080",
|
||||||
"lite": "lite-server",
|
"test": "karma start",
|
||||||
"postinstall": "typings install",
|
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail"
|
||||||
"tsc": "tsc",
|
|
||||||
"tsc:w": "tsc -w",
|
|
||||||
"typings": "typings"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,3 @@
|
||||||
@font-face {
|
|
||||||
font-family: "ABeeZee";
|
|
||||||
font-stretch: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-variant: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
src: local("ABeeZee Regular"),
|
|
||||||
local("ABeeZee-Regular"),
|
|
||||||
local("ABeeZee"),
|
|
||||||
url("abeezee-regular.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Free Monospaced";
|
|
||||||
src: url("freemono.eot?") format("eot"),
|
|
||||||
url("freemono.woff") format("woff"),
|
|
||||||
url("freemono.ttf") format("truetype"),
|
|
||||||
url("freemono.svg#FreeMono") format("svg");
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inputwrapper {
|
.inputwrapper {
|
||||||
font-family: "ABeeZee", sans-serif;
|
font-family: "ABeeZee", sans-serif;
|
||||||
margin: 0 1em 1em 1em;
|
margin: 0 1em 1em 1em;
|
|
@ -5,11 +5,12 @@ import {Converter} from "./converter/converter";
|
||||||
import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service";
|
import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service";
|
||||||
import {Step} from "./step";
|
import {Step} from "./step";
|
||||||
|
|
||||||
|
import "../assets/css/style.css";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
|
||||||
selector: "den-app",
|
selector: "den-app",
|
||||||
templateUrl: "app.component.html",
|
templateUrl: "./app.component.html",
|
||||||
styleUrls: ["app.component.css"],
|
styleUrls: ["./app.component.css"],
|
||||||
providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService]
|
providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService]
|
||||||
})
|
})
|
||||||
export class AppComponent extends OnInit {
|
export class AppComponent extends OnInit {
|
|
@ -1,4 +1,5 @@
|
||||||
import {Converter} from "./converter";
|
import {Converter} from "./converter";
|
||||||
|
|
||||||
export class BinToDecConverter implements Converter {
|
export class BinToDecConverter implements Converter {
|
||||||
getDisplayname():string {
|
getDisplayname():string {
|
||||||
return "Convert binary to decimal";
|
return "Convert binary to decimal";
|
|
@ -1,4 +1,5 @@
|
||||||
import {Converter} from "./converter";
|
import {Converter} from "./converter";
|
||||||
|
|
||||||
export class DecToBinConverter implements Converter {
|
export class DecToBinConverter implements Converter {
|
||||||
getDisplayname():string {
|
getDisplayname():string {
|
||||||
return "Convert decimal to binary";
|
return "Convert decimal to binary";
|
|
@ -1,4 +1,5 @@
|
||||||
import {Converter} from "./converter";
|
import {Converter} from "./converter";
|
||||||
|
|
||||||
export class DecToHexConverter implements Converter {
|
export class DecToHexConverter implements Converter {
|
||||||
getDisplayname():string {
|
getDisplayname():string {
|
||||||
return "Convert decimal to hexadecimal";
|
return "Convert decimal to hexadecimal";
|
|
@ -1,4 +1,5 @@
|
||||||
import {Converter} from "./converter";
|
import {Converter} from "./converter";
|
||||||
|
|
||||||
export class HexToDecConverter implements Converter {
|
export class HexToDecConverter implements Converter {
|
||||||
getDisplayname():string {
|
getDisplayname():string {
|
||||||
return "Convert hexadecimal to decimal";
|
return "Convert hexadecimal to decimal";
|
17
src/app/nativelibrarywrapper.service.ts
Normal file
17
src/app/nativelibrarywrapper.service.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import {Injectable} from "@angular/core";
|
||||||
|
import {Punycode} from "./punycode";
|
||||||
|
import {Utf8} from "./utf8";
|
||||||
|
import {QuotedPrintable} from "./quotedprintable";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class NativeLibraryWrapperService {
|
||||||
|
public utf8:Utf8;
|
||||||
|
public quotedPrintable:QuotedPrintable;
|
||||||
|
public punycode:Punycode;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.utf8 = require("utf8");
|
||||||
|
this.quotedPrintable = require("quoted-printable");
|
||||||
|
this.punycode = require("punycode");
|
||||||
|
}
|
||||||
|
}
|
4
src/app/punycode.ts
Normal file
4
src/app/punycode.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export interface Punycode {
|
||||||
|
encode(input:string):string;
|
||||||
|
decode(input:string):string;
|
||||||
|
}
|
4
src/app/quotedprintable.ts
Normal file
4
src/app/quotedprintable.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export interface QuotedPrintable {
|
||||||
|
encode(input:string):string;
|
||||||
|
decode(input:string):string;
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
import {Converter} from "./converter/converter";
|
import {Converter} from "./converter/converter";
|
||||||
|
|
||||||
export class Step {
|
export class Step {
|
||||||
public content:string = "";
|
public content:string = "";
|
||||||
public selectedConverter:Converter = undefined;
|
public selectedConverter:Converter = undefined;
|
4
src/app/utf8.ts
Normal file
4
src/app/utf8.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export interface Utf8 {
|
||||||
|
encode(input:any):string;
|
||||||
|
decode(input:string):any;
|
||||||
|
}
|
35
src/assets/css/style.css
Normal file
35
src/assets/css/style.css
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: "ABeeZee";
|
||||||
|
font-stretch: normal;
|
||||||
|
font-style: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
src: local("ABeeZee Regular"),
|
||||||
|
local("ABeeZee-Regular"),
|
||||||
|
local("ABeeZee"),
|
||||||
|
url("../fonts/abeezee-regular.woff") format("woff");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Free Monospaced";
|
||||||
|
src: url("../fonts/freemono.eot?") format("eot"),
|
||||||
|
url("../fonts/freemono.woff") format("woff"),
|
||||||
|
url("../fonts/freemono.ttf") format("truetype"),
|
||||||
|
url("../fonts/freemono.svg#FreeMono") format("svg");
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "ABeeZee", sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 1em 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apploader {
|
||||||
|
text-align: center;
|
||||||
|
}
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
18
src/index.html
Normal file
18
src/index.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
|
||||||
|
<title>Decode? Encode? DENcode!</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Decode? Encode? DENcode!</h1>
|
||||||
|
<noscript>This webpage lets you decode and encode data and text to and from various formats. But
|
||||||
|
it requires you to <strong>enable Javascript</strong> to do so. So please turn it on in your
|
||||||
|
Browser. You won't regret it!
|
||||||
|
</noscript>
|
||||||
|
<den-app>
|
||||||
|
<div class="apploader">Please hold on, we're starting the turbines ...</div>
|
||||||
|
</den-app>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,4 +1,4 @@
|
||||||
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
|
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
|
||||||
import {AppModule} from "./app.module";
|
import {AppModule} from "./app/app.module";
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
11
src/polyfills.ts
Normal file
11
src/polyfills.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import "core-js/es6";
|
||||||
|
import "core-js/es7/reflect";
|
||||||
|
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');
|
||||||
|
}
|
|
@ -1,12 +1,20 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"alwaysStrict": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"removeComments": false,
|
"lib": [
|
||||||
"noImplicitAny": false
|
"es2015",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"typeRoots": [
|
||||||
|
"../node_modules/@types/"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
5
src/vendor.ts
Normal file
5
src/vendor.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import "@angular/core";
|
||||||
|
import "@angular/platform-browser";
|
||||||
|
import "@angular/platform-browser-dynamic";
|
||||||
|
import "@angular/forms";
|
||||||
|
import "rxjs";
|
|
@ -1,43 +0,0 @@
|
||||||
/**
|
|
||||||
* System configuration for Angular 2 samples
|
|
||||||
* Adjust as necessary for your application needs.
|
|
||||||
*/
|
|
||||||
(function (global) {
|
|
||||||
System.config({
|
|
||||||
paths: {
|
|
||||||
// paths serve as alias
|
|
||||||
'npm:': 'node_modules/'
|
|
||||||
},
|
|
||||||
// map tells the System loader where to look for things
|
|
||||||
map: {
|
|
||||||
// our app is within the app folder
|
|
||||||
app: 'app',
|
|
||||||
// angular bundles
|
|
||||||
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
|
|
||||||
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
|
|
||||||
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
|
|
||||||
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
|
|
||||||
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
|
|
||||||
// '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
|
|
||||||
// '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
|
|
||||||
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
|
|
||||||
// other libraries
|
|
||||||
'rxjs': 'npm:rxjs'//,
|
|
||||||
// 'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
|
|
||||||
},
|
|
||||||
// packages tells the System loader how to load when no filename and/or no extension
|
|
||||||
packages: {
|
|
||||||
app: {
|
|
||||||
main: './main.js',
|
|
||||||
defaultExtension: 'js'
|
|
||||||
},
|
|
||||||
rxjs: {
|
|
||||||
defaultExtension: 'js'
|
|
||||||
},
|
|
||||||
'angular2-in-memory-web-api': {
|
|
||||||
main: './index.js',
|
|
||||||
defaultExtension: 'js'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(this);
|
|
|
@ -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
1
webpack.config.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./config/webpack.dev.js');
|
Loading…
Reference in a new issue