Skip to content

Commit fdc03cf

Browse files
author
Andrey Morozov
committed
initial version
0 parents  commit fdc03cf

File tree

15 files changed

+287
-0
lines changed

15 files changed

+287
-0
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
build
3+
node_modules

.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true,
5+
"mocha": true
6+
},
7+
"globals": {
8+
"require": true,
9+
"module": true
10+
},
11+
"plugins": [],
12+
"rules": {
13+
"curly": 2,
14+
"eqeqeq": 2,
15+
"comma-dangle": 2,
16+
"quotes": [2, "single"],
17+
"no-use-before-define": 0,
18+
"no-underscore-dangle": 0,
19+
"strict": 0,
20+
"no-alert": 0,
21+
"no-empty": 0,
22+
"consistent-return": 0,
23+
"camelcase": 0,
24+
"max-len": [2, 120, 4]
25+
}
26+
}

.githooks/pre-commit/test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#
3+
# Checks changed javascript files in stage area by running npm test for each commit.
4+
#
5+
6+
PATCH_FILE="working-tree.patch"
7+
8+
function cleanup {
9+
exit_code=$?
10+
if [ -f "$PATCH_FILE" ]; then
11+
git apply "$PATCH_FILE" 2> /dev/null
12+
rm "$PATCH_FILE"
13+
fi
14+
exit $exit_code
15+
}
16+
17+
trap cleanup EXIT SIGINT SIGHUP
18+
19+
# Cancel any changes to the working tree that are not going to be committed
20+
git diff > "$PATCH_FILE"
21+
git checkout -- .
22+
23+
git_cached_files=$(git diff --cached --name-only --diff-filter=ACMR | grep "\.js$")
24+
if [ "$git_cached_files" ]; then
25+
npm run validate --silent || exit 1
26+
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
node_modules
3+
npm-debug.log

.jscs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"preset": "yandex",
3+
4+
"excludeFiles": [
5+
"build/**",
6+
"node_modules/**",
7+
".git/**"
8+
]
9+
}

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# iSeed
2+
Based on advice on the [lecture about infrastructure at Yandex](http://alt-j.github.io/front-end-infrastructure/).
3+
4+
## Quick start
5+
```
6+
git clone [email protected]:alt-j/iseed.git
7+
cd js-seed
8+
npm install
9+
npm build
10+
```
11+
Then open the link in your favorite browser: `build/index.html`.
12+
13+
## What's inside?
14+
15+
### Features
16+
* [Static code analyser and codestyle checking with jsint and jscs](#static-code-analyser-and-codestyle-checking)
17+
* [Unit tests with mocha and phantomjs](#run-tests)
18+
* Using [git hooks](http://github.com/tarmolov/git-hooks) to lint your code and run tests before each commit
19+
20+
### Tools
21+
* [eslint](http://eslint.org/) — a tool to detect errors and potential problems in JavaScript code
22+
* [jscs](http://jscs.info/) — a code style checker for javascript
23+
* [git-hooks](https://github.com/tarmolov/git-hooks-js) — a tool for git hooks managment
24+
* [mocha](http://visionmedia.github.io/mocha/) + [chai](http://chaijs.com/) + [sinon](http://sinonjs.org/) + [phantomjs](http://phantomjs.org/) + [karma](http://karma-runner.github.io/)— testing client javascript
25+
26+
## How it works
27+
28+
### Project structure
29+
```
30+
.enb ENB config for building project
31+
.git-hooks Git hooks
32+
src Source code
33+
src/assets Static data
34+
src/js Javascript files
35+
src/styles CSS or Stylus files
36+
```
37+
38+
## How to develop?
39+
### Build project
40+
```
41+
npm run build
42+
```
43+
44+
### Static code analyser and codestyle checking
45+
```
46+
npm run lint
47+
```
48+
49+
### Run tests
50+
Run tests:
51+
```
52+
npm test
53+
```
54+
55+
## Contribution
56+
* [Codestyle](https://github.com/yandex/codestyle/blob/master/javascript.md)

karma.conf.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = function (config) {
2+
config.set({
3+
browsers: ['PhantomJS'],
4+
singleRun: true,
5+
files: [
6+
{
7+
pattern: 'tests.webpack.js',
8+
watched: false
9+
}
10+
],
11+
frameworks: ['mocha', 'sinon-chai'],
12+
preprocessors: {
13+
'tests.webpack.js': ['webpack']
14+
},
15+
reporters: ['dots'],
16+
webpack: {
17+
module: require('./webpack.config.js').modules
18+
},
19+
webpackServer: {
20+
noInfo: true
21+
}
22+
});
23+
};

package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "iSeed",
3+
"description": "Start a frontend project in under 5 minutes, with full test and build infrastructure.",
4+
"version": "1.0.0",
5+
"author": "Andrey Morozov <[email protected]>",
6+
"contributors": [{
7+
"name": "Alexander Tarmolov",
8+
"email": "[email protected]"
9+
}],
10+
"repository": "https://github.com/alt-j/iseed",
11+
"devDependencies": {
12+
"autoprefixer-loader": "1.0.0",
13+
"babel-core": "5.8.23",
14+
"babel-loader": "5.3.2",
15+
"chai": "1.9.2",
16+
"core-js": "1.1.4",
17+
"css-loader": "0.9.0",
18+
"eslint": "1.3.1",
19+
"git-hooks": "1.0.0",
20+
"jscs": "2.1.1",
21+
"karma": "^0.13.9",
22+
"karma-cli": "0.1.0",
23+
"karma-mocha": "0.2.0",
24+
"karma-phantomjs-launcher": "0.2.1",
25+
"karma-sinon-chai": "1.0.0",
26+
"karma-webpack": "1.7.0",
27+
"mocha": "2.0.1",
28+
"mocha-loader": "0.7.0",
29+
"phantomjs": "1.9.18",
30+
"sinon": "1.9.1",
31+
"style-loader": "0.8.2",
32+
"stylus-loader": "0.4.0",
33+
"webpack": "1.4.13",
34+
"webpack-dev-server": "1.10.1"
35+
},
36+
"scripts": {
37+
"build": "cp -r src/assets build && webpack -p",
38+
"validate": "npm run lint && npm run test",
39+
"lint": "jscs . && eslint .",
40+
"test": "karma start karma.conf.js"
41+
},
42+
"license": "MIT"
43+
}

src/assets/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>Hello, world!</title>
7+
</head>
8+
9+
<body>
10+
<h1>Hello, world!</h1>
11+
<script src="build.js"></script>
12+
</body>
13+
</html>

src/js/boot.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require('../styles/global.styl');
2+
require('./main/main');

0 commit comments

Comments
 (0)