Skip to content

Commit

Permalink
Webpack build working
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed Aug 10, 2015
1 parent 969fdec commit 32b9240
Show file tree
Hide file tree
Showing 11 changed files with 556 additions and 24 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
201 changes: 201 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"env": {
"browser": 2,
"node": 2,
"mocha": 2,
"es6": 2
},
"parser": "babel-eslint",
"ecmaFeatures": {
"modules": true
},
"globals": {
"_": 2,
"$": 2,
"angular": 2,
"jQuery": 2
},
"rules": {
// Possible Errors
"comma-dangle": 2,
// no-comma-dangle - (deprecated)
"no-cond-assign": [2, "always"],
"no-console": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-keys": 2,
"no-dupe-args": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
// no-empty-class - (deprecated)
"no-empty": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 2,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-sparse-arrays": 2,
"no-unreachable": 2,
"use-isnan": 2,
"valid-jsdoc": 2,
"valid-typeof": 2,
"no-unexpected-multiline": 2,

// Best Practices
// not sure
"accessor-pairs": [2, {"getWithoutSet": false, "setWithoutGet": true}],
"block-scoped-var": 2,
"complexity": [2, 6],
"consistent-return": 2,
"curly": 2,
"default-case": 2,
"dot-notation": 2,
// not good for chain calls, but not for properties
"dot-location": [2, "property"],
"eqeqeq": 2,
"guard-for-in": 2,
"no-alert": 2,
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-empty-label": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-param-reassign": 2,
"no-process-env": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-throw-literal": 2,
"no-unused-expressions": 2,
"no-void": 2,
"no-warning-comments": [1, { "terms": ["todo", "fixme"], "location": "anywhere" }],
"no-with": 2,
"radix": 2,
"vars-on-top": 0,
"wrap-iife": [2, "inside"],
"yoda": [2, "never"],

// Strict Mode
"strict": [2, "global"],

// Variables
"no-catch-shadow": 2,
"no-delete-var": 2,
"no-label-var": 2,
"no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 2,
"no-unused-vars": 2,
"no-use-before-define": [2, "nofunc"],

// Node.js
"handle-callback-err": [2, "^.*(e|E)rr" ],
"no-mixed-requires": [2, true],
"no-new-require": 2,
"no-path-concat": 2,
"no-process-exit": 2,
"no-sync": 2,

// Stylistic Issues
"array-bracket-spacing": [2, "never"],
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": 2,
"comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [2, "last"],
"computed-property-spacing": [2, "never"],
"consistent-this": [2, "self"],
// not sure
"eol-last": 0,
"func-names": 0,
"func-style": [2, "declaration"],
"indent": [2, 2],
"key-spacing": [2, { "beforeColon": false, "afterColon": true}],
"max-nested-callbacks": [2, 3],
"new-cap": [2, {"newIsCap": true, "capIsNew": true, "capIsNewExceptions":[
"ObjectId",
"Object",
"Function",
"Number",
"String",
"Boolean",
"Date",
"Array",
"Symbol",
"RegExp"
]}],
"new-parens": 2,
"newline-after-var": 0,
"no-array-constructor": 2,
"no-inline-comments": 2,
"no-lonely-if": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": [2, {"max": 1}],
"no-nested-ternary": 2,
"no-new-object": 2,
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-underscore-dangle": 2,
"no-unneeded-ternary": 2,
"object-curly-spacing": [2, "never"],
"one-var": [2, {
"var": "never", // Exactly one var declaration per function
"let": "never", // Exactly one let declaration per block
"const": "never" // Exactly one declarator per const declaration per block
}],
"operator-assignment": [1, "always"],
"operator-linebreak": [2, "after"],
"padded-blocks": [2, "never"],
"quote-props": [2, "as-needed"],
"quotes": [2, "single", "avoid-escape"],
"semi": [2, "always"],
"semi-spacing": 2,
// "sort-vars": [1, { "ignoreCase": true }],
"space-after-keywords": [2, "always" ],
"space-before-blocks": [2, "always"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-comment": 0,
"wrap-regexp": 0,

// Legacy
"max-len": [1, 120, 4],
// todo: apply max-params
"max-params": [0, 3],
// todo: apply max-statements
"max-statements": [2, 30],
"no-bitwise": 2
}
}
33 changes: 9 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# type script artifacts
typings

# WebStorm
.idea

# build
build
11 changes: 11 additions & 0 deletions gulp-tasks/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var gulp = require('gulp');
var esLint = require('gulp-eslint');

var paths = gulp.paths;

gulp.task('lint', function () {
return gulp.src(paths.src)
.pipe(esLint({useEslintrc: true}))
.pipe(esLint.format())
.pipe(esLint.failOnError());
});
11 changes: 11 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var gulp = require('gulp');

gulp.paths = {
src: ['**/*.{js,ts}', '!node_modules/**/*', '!**/*.{ts,coffee}.js']
};

require('require-dir')('./gulp-tasks');

gulp.task('default', function () {
gulp.start('lint');
});
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "angular2-bootstrap",
"version": "0.34.0",
"description": "angular2 bootstrap components",
"main": "index.js",
"scripts": {
"postinstall": "tsd reinstall --overwrite",
"prestart": "npm install",
"server": "webpack-dev-server --inline --colors --display-error-details --display-cached --port 8080",
"start": "npm run server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/valor-software/angular2-bootstrap.git"
},
"keywords": [
"angular2",
"bootstrap",
"angularjs",
"twitter-bootstrap"
],
"author": "Dmitriy Shekhovtsov <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/valor-software/angular2-bootstrap/issues"
},
"homepage": "https://github.com/valor-software/angular2-bootstrap#readme",
"dependencies": {},
"devDependencies": {
"angular2": "^2.0.0-alpha.34",
"babel-eslint": "^4.0.5",
"bootstrap": "^3.3.5",
"eslint": "^1.1.0",
"gulp": "^3.9.0",
"gulp-eslint": "^1.0.0",
"reflect-metadata": "^0.1.0",
"require-dir": "^0.3.0",
"rtts_assert": "^2.0.0-alpha.34",
"traceur-runtime": "0.0.59",
"typescript": "^1.5.3",
"typescript-simple": "^2.0.0",
"typescript-simple-loader": "^0.3.4",
"webpack": "^1.11.0",
"webpack-dev-server": "^1.10.1",
"zone.js": "angular/zone.js"
}
}
35 changes: 35 additions & 0 deletions src/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="">
<head>
<title>Angular2 Bootstrap by @valorkin</title>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Angular2 Bootstrap">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<base href="/">

<!--link to bootstrap.css-->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<!--
Angular 2
traceur-runtime: is only needed for ES6 browser polyfill
this is not the full traceur only the polyfills
-->
<!--<script src="/lib/traceur-runtime.min.js"></script>-->
</head>
<body>

<app>
Loading...
</app>

<!-- Commmon files to be cached -->
<script src="/build/common.js"></script>
<!-- Angular2 files -->
<script src="/build/angular2.js"></script>
<!-- App script -->
<script src="/build/app.js"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions src/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// <reference path="../../typings/tsd.d.ts" />

import {Component, View, bootstrap, coreDirectives} from 'angular2/angular2';

@Component({
selector: 'app'
})
@View({
template: `<span *ng-if="name">Hello, {{name}}!</span>
`,
directives: [coreDirectives]
})
export class Hello {
name = 'World';
constructor() {
setTimeout(() => {
this.name = 'NEW World'
}, 2000);
}
}

bootstrap(Hello);
Loading

0 comments on commit 32b9240

Please sign in to comment.