Skip to content

Commit

Permalink
New: initialize npm boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovitDmytro committed Aug 1, 2019
0 parents commit 5f9269a
Show file tree
Hide file tree
Showing 16 changed files with 293 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"module-resolver",
{
"root": ["./src"],
"alias": {
"tests": "./tests",
"package": "./package.json",
}
}
],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining"
],
"ignore": [
"node_modules"
]
}

13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "webbylab",
"env": {
"browser": true
},
"rules": {
"import/no-commonjs": 0,
"func-names": 0,
"func-style": 0,
"prefer-arrow-callback": 0,
"linebreak-style": 0
}
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package-lock.json
node_modules
etc/*.js
etc/*.json
lib/*
coverage/*
13 changes: 13 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"diff": true,
"extension": ["js"],
"reporter": "spec",
"slow": 100,
"timeout": 30000,
"ui": "qunit",
"exit": true,
"color": true,
"full-trace": true,
"recursive": true,
"require": ["./tests/test.env.js", "@babel/register"]
}
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
src
tests
.travis.yml
.eslintrc
.eslintignore
.babelrc
21 changes: 21 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"include": [
"src"
],
"exclude": [],
"reporter": [
"html",
"lcovonly"
],
"require": [
"@babel/register",
"@babel/polyfill"
],
"report-dir": "./coverage",
"temp-dir": "./coverage",
"lines": 95,
"statements": 90,
"functions": 90,
"branches": 85,
"check-coverage": true
}
31 changes: 31 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"branch": "master",
"ci": false,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
[
"@semantic-release/git", {
"message": "Chore: (release) add version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
],
"preset": "eslint",
"releaseRules": [
{ "type": "Fix", "release": "patch" },
{ "type": "Update", "release": "minor" },
{ "type": "New", "release": "minor" },
{ "type": "Breaking", "release": "major" },
{ "type": "Docs", "release": "patch" },
{ "type": "Upgrade", "release": "patch" }
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
}
}
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: node_js
node_js: lts/*
before_script:
- "npm run build"
after_success:
- "npm run coveralls"
jobs:
include:
- stage: test
script: "npm run test:lint"
- stage: test
script: "npm run test:coverage"
- stage: test
script: "npm run test:security"
- stage: release
node_js: lts/*
deploy:
provider: script
skip_cleanup: true
script:
- npx semantic-release
notifications:
email:
recipients: dipustovit@gmail.com
on_success: change
on_failure: always
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# npm-boilerplate
**npm-boilerplate** boilerplate for creating npm packages.

[![Version][badge-vers]][npm]
[![Dependencies][badge-deps]][npm]
[![Vulnerabilities][badge-vuln]](https://snyk.io/)
[![Build Status][badge-tests]][travis]
[![Coverage Status][badge-coverage]](https://coveralls.io/github/pustovitDmytro/npm-boilerplate?branch=master)
[![License][badge-lic]][github]

## Table of Contents
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Contribute](#contribute)

## Requirements
To use library you need to have [node](https://nodejs.org) and [npm](https://www.npmjs.com) installed in your machine:

* node `6.0+`
* npm `3.0+`

## Installation

To install the library run following command

```bash
npm i --save npm-boilerplate
```

## Usage

```javascript

```

## Contribute

Make the changes to the code and tests and then commit to your branch. Be sure to follow the commit message conventions.

Commit message summaries must follow this basic format:
```
Tag: Message (fixes #1234)
```

The Tag is one of the following:
* **Fix** - for a bug fix.
* **Update** - for a backwards-compatible enhancement.
* **Breaking** - for a backwards-incompatible enhancement.
* **Docs** - changes to documentation only.
* **Build** - changes to build process only.
* **New** - implemented a new feature.
* **Upgrade** - for a dependency upgrade.
* **Chore** - for tests, refactor, style, etc.

The message summary should be a one-sentence description of the change. The issue number should be mentioned at the end.


[npm]: https://www.npmjs.com/package/npm-boilerplate
[github]: https://github.com/pustovitDmytro/npm-boilerplate
[travis]: https://travis-ci.org/pustovitDmytro/npm-boilerplate
[coveralls]: https://coveralls.io/github/pustovitDmytro/npm-boilerplate?branch=master
[badge-deps]: https://img.shields.io/david/pustovitDmytro/npm-boilerplate.svg
[badge-tests]: https://img.shields.io/travis/pustovitDmytro/npm-boilerplate.svg
[badge-vuln]: https://img.shields.io/snyk/vulnerabilities/npm/npm-boilerplate.svg?style=popout
[badge-vers]: https://img.shields.io/npm/v/npm-boilerplate.svg
[badge-lic]: https://img.shields.io/github/license/pustovitDmytro/npm-boilerplate.svg
[badge-coverage]: https://coveralls.io/repos/github/pustovitDmytro/npm-boilerplate/badge.svg?branch=master
60 changes: 60 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "npm-boilerplate",
"version": "0.0.1",
"description": "boilerplate for creating npm packages",
"main": "./lib",
"scripts": {
"build": "babel src --out-dir ./lib",
"prepare": "npm run build",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"test:security": "npm audit",
"test:lint": "eslint src",
"test:mocha": "mocha --config .mocharc.json tests/**/*.js",
"test:coverage": "MODE=test nyc mocha --config .mocharc.json tests/**/*.js",
"coverage-check": "MODE=test nyc check-coverage",
"test": "npm run test:lint && npm run test:security && npm run test:coverage",
"semantic-release": "semantic-release"
},
"repository": {
"type": "git",
"url": "https://github.com/pustovitDmytro/npm-boilerplate.git"
},
"author": "Dmytro Pustovit",
"license": "MIT",
"bugs": {
"url": "https://github.com/pustovitDmytro/npm-boilerplate/issues"
},
"homepage": "https://github.com/pustovitDmytro/npm-boilerplate#readme",
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/node": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/runtime": "^7.3.4",
"@semantic-release/changelog": "^3.0.4",
"@semantic-release/commit-analyzer": "^6.1.0",
"@semantic-release/git": "^7.0.8",
"@semantic-release/npm": "^5.1.7",
"@semantic-release/release-notes-generator": "^7.1.4",
"babel-eslint": "^10.0.1",
"babel-plugin-module-resolver": "^3.2.0",
"chai": "^4.2.0",
"conventional-changelog-eslint": "^3.0.1",
"coveralls": "^3.0.3",
"eslint": "^5.16.0",
"eslint-config-webbylab": "^4.0.0",
"eslint-plugin-fetch": "0.0.1",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-more": "^0.3.2",
"eslint-plugin-no-require-lodash": "^1.1.0",
"eslint-plugin-prefer-spread": "^1.0.3",
"eslint-plugin-react": "^7.12.4",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"semantic-release": "^15.13.19"
}
}
Empty file added src/index.js
Empty file.
Empty file added src/utils.js
Empty file.
4 changes: 4 additions & 0 deletions tests/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = process.env.BUILD
? require('../lib')
: require('../src');

8 changes: 8 additions & 0 deletions tests/package/configurations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { assert } from 'chai';
import logger from '../entry';
import { verifyStdout } from '../utils';

suite('Configurations');

test('Default configuration', function () {
});
1 change: 1 addition & 0 deletions tests/test.env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.env.MODE = 'test';
Empty file added tests/utils.js
Empty file.

0 comments on commit 5f9269a

Please sign in to comment.