Skip to content
This repository has been archived by the owner on Feb 28, 2021. It is now read-only.

Commit

Permalink
template content
Browse files Browse the repository at this point in the history
  • Loading branch information
pouc committed Jan 24, 2017
1 parent c6b046f commit ad56713
Show file tree
Hide file tree
Showing 7 changed files with 249 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"preset": "google",
"maxErrors" : 5000,
"validateIndentation": 4,
"maximumLineLength": 512,
"requireCurlyBraces": false,
"jsDoc": {
"checkAnnotations": {
"preset": "closurecompiler",
"extra": {
"module": true,
"typicalname": true,
"copyright": true,
"classdesc": true
}
}
},
"requireCamelCaseOrUpperCaseIdentifiers": false
}
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:
- "7.4.0"
- "6.9.4"
- "6"
- "6.1"
- "5.11"
after_success:
- 'cat ./coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls.js'
90 changes: 90 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

jsdoc2md: {
oneOutputFile: {
src: ['index.js'],
dest: 'README.md'
}
},
jscs: {
src: ['index.js'],
options: {
config: '.jscs.json'
}
},
simplemocha: {
options: {
ui: 'bdd',
reporter: 'tap'
},
all: {src: ['test/**/*.js']}
},
mocha_istanbul: {
coverage: {
src: 'test',
options: {
mask: '*.js',
coverageFolder: 'coverage',
check: {
statements: 20,
branches: 70,
functions: 10,
lines: 20
}
}
}
},
coveralls: {
options: {
force: false
},
default: {
src: 'coverage/*.info',
options: {
}
}
},
bump: {
options: {
push: true,
pushTo: 'origin',
commitFiles: ['-a']
}

},
shell: {
publish: {
command: 'npm publish'
}
}
});

grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-coveralls');

grunt.registerTask('patch', 'patch', function() {
grunt.task.run('bump:patch');
});

grunt.registerTask('commit', 'commit', function() {
grunt.task.run('bump:patch');
});

grunt.registerTask('doc', 'doc', function() {
grunt.task.run('jsdoc2md:oneOutputFile');
});

grunt.registerTask('release', 'Release a new version, push it and publish it', function() {
grunt.task.run('jscs', 'simplemocha:all', 'mocha_istanbul:coverage', 'jsdoc2md:oneOutputFile', 'bump:patch', 'shell:publish');
});

};
6 changes: 6 additions & 0 deletions duplicate.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
git clone --bare https://github.com/pouc/my-node-template.git
cd my-node-template.git
echo repo_token: change-me > .coveralls.yml
git push --mirror https://github.com/pouc/***.git
cd ..
rmdir /s /q my-node-template.git
46 changes: 46 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use strict';

/**
*
* [![GitHub version](https://badge.fury.io/gh/pouc%2Fmy-node-template.svg)](https://badge.fury.io/gh/pouc%2Fmy-node-template)
* [![npm version](https://badge.fury.io/js/my-node-template.svg)](https://badge.fury.io/js/my-node-template)
* [![NPM monthly downloads](https://img.shields.io/npm/dm/my-node-template.svg?style=flat)](https://npmjs.org/package/my-node-template)
* [![Build Status](https://travis-ci.org/pouc/my-node-template.svg?branch=master)](https://travis-ci.org/pouc/my-node-template)
* [![Dependency Status](https://gemnasium.com/badges/github.com/pouc/my-node-template.svg)](https://gemnasium.com/github.com/pouc/my-node-template)
* [![Coverage Status](https://coveralls.io/repos/github/pouc/my-node-template/badge.svg?branch=master)](https://coveralls.io/github/pouc/my-node-template?branch=master)
* [![Known Vulnerabilities](https://snyk.io/test/github/pouc/my-node-template/badge.svg)](https://snyk.io/test/github/pouc/my-node-template)
*
* A template for all my nodejs projects
*
* @module my-node-template
* @typicalname template
* @author Loïc Formont
*
* @license MIT Licensed
*
* @example
* ```javascript
* var template = require("my-node-template");
* ```
*/
module.exports = {};

/**
* Description of the function
*
* @example
* Example of the function
*
* ```javascript
* var code = of.the.function;
* ```
*
* @param {type} name the first parameter
* @returns {*} a value
*/
module.exports.example = function(name) {

return name;

};

39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "my-node-template",
"version": "1.0.1",
"description": "a template for all my node projects",
"main": "index.js",
"scripts": {
"test": "mocha && istanbul cover node_modules/mocha/bin/_mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pouc/my-node-template.git"
},
"author": "pouc",
"license": "MIT",
"bugs": {
"url": "https://github.com/pouc/my-node-template/issues"
},
"homepage": "https://github.com/pouc/my-node-template#readme",
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"chai-things": "^0.2.0",
"coveralls": "^2.11.15",
"grunt": "^1.0.1",
"grunt-bump": "^0.8.0",
"grunt-coveralls": "^1.0.1",
"grunt-jscs": "^3.0.1",
"grunt-jsdoc-to-markdown": "^2.0.0",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-shell": "^2.1.0",
"grunt-simple-mocha": "^0.4.1",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0",
"q": "^1.4.1",
"sinon": "^1.17.7",
"sinon-chai": "^2.8.0"
}
}
40 changes: 40 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
var promise = require('q');
var chai = require('chai');
var sinon = require('sinon');

chai.use(require('chai-as-promised'));
chai.use(require('sinon-chai'));
chai.use(require('chai-things'));

var expect = chai.expect;
var should = chai.should();

var exports = require('../index.js');

function check(done, f) {

return promise().then(() => {
try {
return f();
} catch (e) {
return promise.reject(e);
}
}).then(() => {
done();
}).fail((err) => {
done(err);
});

}

describe('example...', function() {

it('should be defined', function() {
expect(exports.example).to.not.be.undefined;
});

it('should work', function() {
expect(exports.example('hello')).to.equal('hello');
});

});

0 comments on commit ad56713

Please sign in to comment.