Skip to content

Commit

Permalink
Merge remote-tracking branch 'starter/master' into mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Krueger committed Aug 5, 2017
2 parents 0955134 + 840330b commit a304759
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions"]
}
}],
"stage-0",
"flow"
]
}
33 changes: 33 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parser": "babel-eslint",
"extends": "eslint:recommended",

"plugins": [
"import",
"flowtype"
],

"parserOptions": {
"sourceType": "module"
},

"globals": {
"require": true,
"console": true,
"document": true,
"process": true,
"module": true,
"__dirname": true
},

"env": {
"es6": true,
"jest": true,
"browser": true,
"node": true
},

"rules": {
"strict": [2, "never"]
}
}
23 changes: 23 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[ignore]
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/dist/.*
.*\.config.*
.*\.test.*

[include]
<PROJECT_ROOT>/src

[libs]

[options]
all=true
emoji=true
esproposal.class_instance_fields=ignore
esproposal.class_static_fields=ignore
esproposal.decorators=ignore
experimental.const_params=true
module.file_ext=.js
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=src
module.system=node
module.use_strict=true
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.log
coverage
dist
doc
flow-typed
node_modules
package-lock.json
yarn.lock

.*
!.babelrc
!.eslintrc
!.flowconfig
!.git*
!.tern-project
!.travis.yml
10 changes: 10 additions & 0 deletions .tern-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"libs": [
"browser"
],
"plugins": {
"node": {},
"modules": {},
"es_modules": {}
}
}
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "node"
after_success:
"npm run coveralls"
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2017 Justin Krueger <justin@kroo.gs>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Proto ES2017+

[![TravisCI](https://img.shields.io/travis/kroogs/proto-es2017.svg)](https://travis-ci.org/kroogs/proto-es2017)
[![Coverage](https://img.shields.io/coveralls/kroogs/proto-es2017.svg)](https://coveralls.io/github/kroogs/proto-es2017)
[![Dependencies](https://img.shields.io/david/kroogs/proto-es2017.svg)](https://david-dm.org/kroogs/proto-es2017)
[![Dev Dependencies](https://img.shields.io/david/dev/kroogs/proto-es2017.svg)](https://david-dm.org/kroogs/proto-es2017?type=dev)
[![MIT License](https://img.shields.io/github/license/kroogs/proto-es2017.svg)](https://github.com/kroogs/proto-es2017/blob/master/LICENSE)

> Spiffy boilerplate for building and testing with ES2017+.
## Getting Started

Clone and cd to `project_name`:
```
git clone https://github.com/kroogs/proto-es2017 project_name && cd project_name
```

(Optional) Setup remotes:
```
git remote rename origin starter
git remote add origin <your repo url>
```

Install dependencies:
```
npm install
```

## Usage

Watch `src` for changes:
```
npm start
```

Run tests:
```
npm test
```

Type check, reformat, lint:
```
npm run lint
```

Produce minified bundle in `dist`:
```
npm run build
```
64 changes: 64 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "proto-es2017",
"version": "0.0.0",
"description": "Spiffy boilerplate for building and testing with ES2017+.",
"keywords": [],
"homepage": "https://github.com/kroogs/proto-es2017",
"author": "Justin Krueger <justin@kroo.gs>",
"contributors": [],
"private": "true",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kroogs/proto-es2017.git"
},
"bugs": {
"url": "https://github.com/kroogs/proto-es2017/issues"
},
"main": "./dist/proto-es2017.js",
"files": [
"dist",
"src",
"test"
],
"scripts": {
"start": "webpack-dev-server",
"build": "webpack -p",
"test": "jest --coverage",
"test-dev": "jest --watch --coverage",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"lint": "prettier --no-color --trailing-comma all --no-semi --single-quote --write \"src/**/*.js\" && eslint --fix src",
"prepublishOnly": "npm run lint && npm test && npm run build"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.1",
"babel-preset-env": "^1.6.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-stage-0": "^6.24.1",
"coveralls": "^2.13.1",
"esdoc": "^1.0.1",
"esdoc-flow-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^4.3.0",
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-import": "^2.7.0",
"file-loader": "^0.11.2",
"flow": "^0.2.3",
"flow-bin": "^0.52.0",
"flow-typed": "^2.1.5",
"jest": "^20.0.4",
"jest-cli": "^20.0.4",
"prettier": "^1.5.3",
"webpack": "^3.4.1",
"webpack-dev-server": "^2.6.1"
},
"jest": {
"moduleDirectories": [
"node_modules",
"src"
]
}
}
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Return the sum of the arguments.
* @param {...number} args - numbers to sum
* @return {number}
*/
export function sum(...args: number[]): number {
return args.reduce((total, current) => total + current, 0)
}
7 changes: 7 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { sum } from './index'

describe('Proto ES2017+', function() {
test('#sum should add 1, 2, 3, and 4 to equal 10', () => {
expect(sum(1, 2, 3, 4)).toBe(10)
})
})
48 changes: 48 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const path = require('path')

module.exports = {
context: __dirname,
entry: './src/index.js',
devtool: 'source-map',

output: {
library: 'es2017-starter',
libraryTarget: 'umd',
path: path.resolve('dist'),
filename: 'es2017-starter.js',
},

resolve: {
extensions: ['.js'],
modules: [path.resolve('node_modules'), path.resolve('src')],
},

module: {
loaders: [
{
use: ['babel-loader'],
test: /\.js$/,
exclude: [path.resolve('node_modules')],
},
{
use: 'file-loader',
test: /.*/,
exclude: [/\.js$/],
},
],
},

watchOptions: {
ignored: /node_modules/,
},

devServer: {
port: 3030,
contentBase: path.resolve('src'),
stats: 'errors-only',
overlay: {
warnings: true,
errors: true,
},
},
}

0 comments on commit a304759

Please sign in to comment.