Skip to content

Commit 5ea7cbb

Browse files
authored
Merge pull request #1 from Protocore-UI/develop
Adds partial initial Webpack+Typescript stack
2 parents 040b88b + 06b2b13 commit 5ea7cbb

36 files changed

+1107
-1
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
trim_trailing_white_space_on_save = true
12+
insert_final_newline = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
# Tab indentation (no size specified)
18+
[{src/**/*.js, *.js, *.json, *.yml, config/*.json, config/*.js}]
19+
indent_style = tab
20+
indent_size = 2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ build/Release
2525

2626
# Dependency directory
2727
node_modules
28+
typings
2829

2930
# Optional npm cache directory
3031
.npm

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
# protocore-typescript-edition
1+
# protocore-typescript-edition
2+
3+
## Installation
4+
5+
```
6+
npm install -g typings typescript tsd webpack
7+
tsd install
8+
```

config/server.env.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Application configuration setup.
3+
*/
4+
module.exports = {
5+
"server": {
6+
"dev": {
7+
"port": 9000,
8+
"uri": "localhost",
9+
"codebase": "src"
10+
},
11+
"prod": {
12+
"port": 8000,
13+
"uri": "localhost",
14+
"codebase": "dist"
15+
}
16+
}
17+
}

package.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "protocore-typescript-edition",
3+
"version": "0.0.2",
4+
"description": "Protocore-typescript-edition is special Typescript implementation edition of Protocore project.",
5+
"scripts": {
6+
"start": "node server.js",
7+
"dev": "webpack -d --watch",
8+
"build": "webpack -p",
9+
"postinstall": "typings install"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/Protocore-UI/protocore-typescript-edition.git"
14+
},
15+
"author": "Ashwin Hegde",
16+
"license": "MIT",
17+
"bugs": {
18+
"url": "https://github.com/Protocore-UI/protocore-typescript-edition/issues"
19+
},
20+
"homepage": "https://github.com/Protocore-UI/protocore-typescript-edition#readme",
21+
"dependencies": {
22+
"body-parser": "~1.14.2",
23+
"cookie-parser": "~1.3.2",
24+
"crossroads": "^0.12.2",
25+
"express": "~4.13.4",
26+
"handlebars": "^3.0.3",
27+
"hasher": "^1.2.0",
28+
"jquery": "^2.2.4",
29+
"morgan": "~1.6.0",
30+
"signals": "^1.0.0",
31+
"typescript": "^2.0.3"
32+
},
33+
"devDependencies": {
34+
"chai": "^3.0.0",
35+
"css-loader": "^0.23.1",
36+
"csslint-loader": "^0.2.1",
37+
"file-loader": "^0.9.0",
38+
"handlebars-loader": "^1.4.0",
39+
"html-webpack-plugin": "^2.22.0",
40+
"jscs-loader": "^0.2.0",
41+
"jshint": "^2.8.0",
42+
"jshint-loader": "^0.8.3",
43+
"json-loader": "^0.5.4",
44+
"less": "^2.5.3",
45+
"less-loader": "^2.2.3",
46+
"mocha": "^2.2.5",
47+
"style-loader": "^0.13.1",
48+
"ts-loader": "^0.9.0",
49+
"webpack": "^1.13.2"
50+
},
51+
"keywords": [
52+
"webpack",
53+
"javascript",
54+
"typescript",
55+
"jquery",
56+
"framework",
57+
"web",
58+
"rest",
59+
"restful",
60+
"node",
61+
"express",
62+
"architecture"
63+
],
64+
"engines": {
65+
"node": ">=6.0.0"
66+
}
67+
}

server.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/***
2+
* Build-in | Third party module dependencies.
3+
*/
4+
var express = require('express'),
5+
http = require('http'),
6+
path = require('path'),
7+
bodyParser = require('body-parser');
8+
9+
var app = express(),
10+
config = require("./config/server.env");
11+
12+
var env = process.env.NODE_ENV || 'development',
13+
staticEnvString = 'development';
14+
15+
/**
16+
* Application configurations for development environment.
17+
* NODE_ENV=development node server.js
18+
***/
19+
if (staticEnvString.toLowerCase() === env.toLowerCase()) {
20+
app.set('port', process.env.PORT || config.server.dev.port);
21+
app.use(bodyParser.json());
22+
app.use(bodyParser.urlencoded({
23+
extended: true
24+
}));
25+
app.use(express.static(path.join(__dirname, config.server.dev.codebase)));
26+
}
27+
28+
/**
29+
* Application configurations for production environment.
30+
* NODE_ENV=production node server.js
31+
***/
32+
staticEnvString = "production";
33+
if (staticEnvString.toLowerCase() === env.toLowerCase()) {
34+
app.set('port', process.env.PORT || config.server.prod.port);
35+
app.use(bodyParser.json());
36+
app.use(bodyParser.urlencoded({
37+
extended: true
38+
}));
39+
app.use(express.static(path.join(__dirname, config.server.prod.codebase)));
40+
}
41+
42+
http.createServer(app).listen(app.get('port'), function() {
43+
console.log("\n\n\tNode (Express) server listening on port " + app.get('port'));
44+
});

src/apps/router/routes.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import signals from "signals";
2+
import hasher from "hasher";
3+
import crossroads from "crossroads";
4+
5+
import HomeView from '../views/homeView.ts';
6+
import HomeTemplate from '../templates/homeTpl.handlebars';
7+
8+
import AboutView from '../views/aboutView.ts';
9+
import AboutTemplate from '../templates/aboutTpl.handlebars';
10+
11+
let router = crossroads.create();
12+
13+
let parseHash = (newHash) => {
14+
router.parse(newHash);
15+
};
16+
17+
router.addRoute('', () => {
18+
console.log("Home View");
19+
new HomeView({
20+
template: HomeTemplate
21+
});
22+
});
23+
24+
router.addRoute('/about', () => {
25+
console.log("About Us View");
26+
new AboutView({
27+
template: AboutTemplate
28+
});
29+
});
30+
31+
hasher.initialized.add(parseHash);
32+
hasher.changed.add(parseHash);
33+
hasher.init();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<div class="site-wrapper">
2+
<div class="site-wrapper-inner">
3+
<div class="cover-container">
4+
<div class="masthead clearfix">
5+
<div class="inner">
6+
<h1 class="masthead-brand">Protocore Typescript <sup><small class="release">v0.0.2</small></sup></h1>
7+
<ul class="nav masthead-nav">
8+
<li><a href="#">Home</a></li>
9+
<li class="active"><a href="#about">About</a></li>
10+
</ul>
11+
</div>
12+
</div>
13+
<div class="inner cover">
14+
<div class="row">
15+
<div class="col-lg-12">
16+
<p class="lead">We really appreciate all kind of feedback and contributions.<br/>Thanks for using and supporting Protocore Typescript Edition!</p>
17+
<p class="lead">
18+
<a class="btn btn-default btn-sm" href="//github.com/hegdeashwin/protocore-webpack-edition" target="_blank">Learn more...</a>
19+
</p>
20+
</div>
21+
</div>
22+
</div>
23+
<div class="mastfoot">
24+
<div class="inner">
25+
<p>
26+
Maintained by the <a href="//github.com/hegdeashwin" target="_blank">core developer</a> with the help of our <a href="//github.com/hegdeashwin/protocore-webpack-edition/graphs/contributors" target="_blank">contributors</a>. Code licensed under <a href="//raw.github.com/hegdeashwin/protocore-webpack-edition/master/LICENSE" target="_blank">MIT</a>
27+
</p>
28+
</div>
29+
</div>
30+
</div>
31+
</div>
32+
</div>

src/apps/templates/homeTpl.handlebars

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<div class="site-wrapper">
2+
<div class="site-wrapper-inner">
3+
<div class="cover-container">
4+
<div class="masthead clearfix">
5+
<div class="inner">
6+
<h1 class="masthead-brand">Protocore Typescript <sup><small class="release">v0.0.2</small></sup></h1>
7+
<ul class="nav masthead-nav">
8+
<li class="active"><a href="#">Home</a></li>
9+
<li><a href="#about">About</a></li>
10+
</ul>
11+
</div>
12+
</div>
13+
<div class="inner cover">
14+
<h1 class="cover-heading">Learn, Develop &amp; Perform Web</h1>
15+
<p class="lead">Protocore Typescript Edition is special Typescript implementation edition of <a href="//github.com/hegdeashwin/Protocore" target="_blank">Protocore</a> project.</p>
16+
<p class="lead">
17+
<a class="btn btn-default btn-sm" href="//github.com/hegdeashwin/protocore-webpack-edition" target="_blank">Learn more...</a>
18+
</p>
19+
</div>
20+
<div class="mastfoot">
21+
<div class="inner">
22+
<p>
23+
<iframe src="//ghbtns.com/github-btn.html?user=hegdeashwin&repo=protocore-webpack-edition&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
24+
<iframe src="//ghbtns.com/github-btn.html?user=hegdeashwin&repo=protocore-webpack-edition&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
25+
<iframe src="//ghbtns.com/github-btn.html?user=hegdeashwin&type=follow" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>
26+
</p>
27+
<p>
28+
Maintained by the <a href="//github.com/hegdeashwin" target="_blank">core developer</a> with the help of our <a href="//github.com/hegdeashwin/protocore-webpack-edition/graphs/contributors" target="_blank">contributors</a>. Code licensed under <a href="//raw.github.com/hegdeashwin/protocore-webpack-edition/master/LICENSE" target="_blank">MIT</a>
29+
</p>
30+
</div>
31+
</div>
32+
</div>
33+
</div>
34+
</div>

src/apps/views/_baseView.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import $ from "jquery";
2+
3+
class BaseView {
4+
el: string;
5+
6+
template: string;
7+
8+
constructor(params: any) {
9+
console.log('LOG: Initialize BaseView');
10+
11+
this.el = params.el || 'body';
12+
this.template = params.template || '<div></div>';
13+
this.render();
14+
}
15+
16+
render() {
17+
console.log("LOG: Executed Baseview Render");
18+
$(this.el).html(this.template);
19+
}
20+
};
21+
22+
export default BaseView;

src/apps/views/aboutView.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import BaseView from './_baseView.ts';
2+
3+
class AboutView extends BaseView {
4+
constructor(params: any) {
5+
super(params);
6+
console.log('LOG: Initialize AboutView');
7+
}
8+
9+
beforeRender() {
10+
console.log("LOG: AboutView Before Render");
11+
}
12+
13+
afterRender() {
14+
console.log("LOG: AboutView After Render");
15+
}
16+
17+
eventsHash() {
18+
console.log("LOG: AboutView Events Hash");
19+
}
20+
};
21+
22+
export default AboutView;

src/apps/views/homeView.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import BaseView from './_baseView.ts';
2+
3+
class HomeView extends BaseView {
4+
constructor(params: any) {
5+
super(params);
6+
console.log('LOG: Initialize HomeView');
7+
}
8+
9+
beforeRender() {
10+
console.log("LOG: HomeView Before Render");
11+
}
12+
13+
afterRender() {
14+
console.log("LOG: HomeView After Render");
15+
}
16+
17+
eventsHash() {
18+
console.log("LOG: HomeView Events Hash");
19+
}
20+
}
21+
22+
export default HomeView;

src/assets/fonts/segoeui.ttf

505 KB
Binary file not shown.

src/assets/images/.gitkeep

Whitespace-only changes.

src/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3+
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4+
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5+
<!--[if gt IE 8]><!-->
6+
<html lang="en" class="no-js">
7+
<!--<![endif]-->
8+
<head>
9+
<meta charset="utf-8"/>
10+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
11+
<title>Protocore Typescript Edition&brvbar; v0.0.2</title>
12+
</head>
13+
<body>
14+
<!--[if lt IE 7]>
15+
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
16+
<![endif]-->
17+
</body>
18+
</html>

src/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// import './stylesheets/less/_consolidate.less';
2+
3+
import './apps/router/routes.ts';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Consolidate:
3+
*
4+
* This file holds all the SMACSS import file references.
5+
*/
6+
7+
// Common
8+
@import "common/_imports.less";
9+
10+
// Base
11+
@import "base/_imports.less";
12+
13+
// Layout
14+
@import "layout/_imports.less";
15+
16+
// Modules
17+
@import "modules/_imports.less";
18+
19+
// State
20+
@import "state/_imports.less";
21+
22+
// Theme
23+
@import "theme/_imports.less";

0 commit comments

Comments
 (0)