Skip to content

Commit

Permalink
feat: First version of this project
Browse files Browse the repository at this point in the history
This is the first version of this project. It's working but it's more for testing everything.
  • Loading branch information
Ziv-Barber committed Oct 7, 2018
0 parents commit e2d4b9c
Show file tree
Hide file tree
Showing 25 changed files with 640 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-flow"
]
}
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
indent_size = 2
48 changes: 48 additions & 0 deletions .esdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"source": "./src",
"destination": "./docs",
"includes": [
"\\.js$"
],
"excludes": [
"\\.config\\.js$"
],
"plugins": [
{
"name": "esdoc-standard-plugin"
},
{
"name": "esdoc-flow-type-plugin",
"option": {
"enable": true
}
},
{
"name": "esdoc-brand-plugin"
}
],
"option": {
"lint": {
"enable": true
},
"coverage": {
"enable": true
},
"test": {
"source": "./test/",
"interfaces": [
"describe",
"it",
"context",
"suite",
"test"
],
"includes": [
"(spec|Spec|test|Test)\\.js$"
],
"excludes": [
"\\.config\\.js$"
]
}
}
}
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
flow-typed
dist
doc
.DS_Store

\#*#

.vscode
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"parser": "babel-eslint",
"extends": [
"standard",
"plugin:flowtype/recommended"
],
"rules": {},
"parserOptions": {},
"plugins": [
"flowtype"
]
}
14 changes: 14 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[ignore]
.*/node_modules/npm/node_modules/config-chain/.*
.*/dist/.*


[include]

[libs]

[lints]

[options]

[strict]
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.js text eol=lf
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules
doc
dist
.DS_Store
coverage/lcov-report
coverage/coverage-summary.json
coverage/lcov.info
package.json.save
package-lock.json
yarn.lock

\#*#

.vscode
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
.DS_Store/
doc/
flow-typed
package.json.save
package-lock.json
yarn.lock
.vscode
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js

node_js: 8

deploy:
provider: script
skip_cleanup: true
script:
- npm run release
Empty file added CHANGELOG
Empty file.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contributing

- Fork the project and clone your fork.
- Create a local feature branch:

```bash
git checkout -b <branch>
```

- Please add tests in '__tests__/' for each new function that you're adding.
- Make one or more atomic commits using either 'yarn commit' or 'npm run commit' ONLY (this project is commitizen friendly). Do not commit changes to the `dist/` folder.
- Run 'yarn test', 'yarn lint' and 'yarn flow' and address any errors. Preferably, fix commits in place using `git rebase` or `git commit --amend` to make the changes easier to review and to keep the history tidy.
- Push to your fork:

```bash
git push origin <branch>
```

- Open a pull request.
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
library-boilerplate
Copyright (c) 2018 Ziv Barber, contributors.

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.
167 changes: 167 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# library-boilerplate

Rollup based javascript library boilerplate + babel 7, eslint, flow, jest, esdoc and live editing.

[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![coverage statements](./coverage/badge-statements.svg)](https://github.com/pamepeixinho/jest-coverage-badges)
[![coverage lines](./coverage/badge-lines.svg)](https://github.com/pamepeixinho/jest-coverage-badges)
[![coverage functions](./coverage/badge-functions.svg)](https://github.com/pamepeixinho/jest-coverage-badges)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

![library-boilerplate logo](https://cdn-images-1.medium.com/max/1500/1*LQbS9RgHy93y9JH8ltejuQ.jpeg)

- [Getting Started](#getstart)
- [Features](#features)
- [Installation](#inst)
- [Running](#run)
- [API](#ref)
- [The source code](#code)
- [Variations](#other)
- [Credit](#credit)

<a name="getstart"></a>
## Getting Started: ##

This boilerplate including a basic code to start creating a js based library.

Start with cloning the project:

```bash
$ git clone --depth=1 git://github.com/Ziv-Barber/library-boilerplate.git your-project-name
```

Then:

- Remove the .git directory.
- Edit package.json:
- Change the name of the project to your project name.
- Change the version to 0.1.0
- If you want to release a npm package then change:
"release": "npx run-s test release:pre release:post"
to:
"release": "npx run-s test release:pre release:publish release:post"

The boilerplate without any changes supporting creating a library for both CommonJS, es6 modules, amd and browser. If you don't need all of this then just edit the rollup.config.js file and remove the inputs that you don't need.

Now, create a new github project and do:

```bash
$ git init
$ git remote add origin https://github.com/your-name/your-project-name.git
$ git add -A
$ npm run commit
$ git push -u origin master
```

This project is using semantic-release to automatic handling of the version of your library.

<a name="features"></a>
## Features: ##

This project is using the following awesome libraries/utilities/services:

- [babel 7][https://babeljs.io/]
- [better-npm-run][https://github.com/benoror/better-npm-run]
- [commitizen][http://commitizen.github.io/cz-cli]
- [esdoc][https://esdoc.org/]
- [eslint][https://eslint.org/]
- [flow][https://flow.org/]
- [jest][https://jestjs.io/]
- [npm-run-all][https://github.com/mysticatea/npm-run-all]
- [rollup][https://rollupjs.org/]
- [semantic-release][https://github.com/semantic-release/semantic-release]

<a name="inst"></a>
## Installation: ##

via Git:

```bash
$ git clone git://github.com/Ziv-Barber/library-boilerplate.git
```

via yarn:

```bash
$ yarn add library-boilerplate
```

via npm:

```bash
$ npm install library-boilerplate
```

<a name="ref"></a>
## API: ##

???.

<a name="code"></a>
## The source code: ##

- lib - all the sources.
- types - put here all the flow type declarations.
- __tests__ - all the tests.
- .editorconfig - coding style for this project.

### Scripts: ###

- start
- build
- clean
- test
- flow
- lint
### Tests: ###

Tests:

```bash
yarn test
```

or:

```bash
npm test
```

### Flow: ###

Flow check (if you don't have a flow plugin in your IDE):

```bash
yarn flow
```

or:

```bash
npm flow
```

### Lint: ###

Lint check (if you don't have a plugin in your IDE):

```bash
yarn lint
```

or:

```bash
npm lint
```

<a name="other"></a>
## Variations: ##

- library-boilerplate (this project) - Rollup based javascript library boilerplate + babel 7, eslint, flow, jest, esdoc and live editing.
- [react-boilerplate](https://github.com/Ziv-Barber/react-boilerplate) - React 16.5.2 + babel 7 + jest + webpack 4 + flow + eslint + esdoc + live editing boilerplate.

<a name="credits"></a>
## Credit: ##

- Created by Ziv Barber.
8 changes: 8 additions & 0 deletions __tests__/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"../.eslintrc"
],
"env": {
"jest": true
}
}
15 changes: 15 additions & 0 deletions __tests__/someModule-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as someModule from '../lib/someModule'

/** @test {someModule} */
describe('someModule test suits', function () {
// Executed before each test:
beforeEach(done => {
done()
})

test('#test ()', done => {
expect(someModule).toBeDefined()
// assert(123 === 123)
done()
})
})
1 change: 1 addition & 0 deletions coverage/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e2d4b9c

Please sign in to comment.