Skip to content

Commit

Permalink
Convert code to es2015, es2016 using babel, swap jshint with eslint, …
Browse files Browse the repository at this point in the history
…swap testing tools with jest
  • Loading branch information
noosxe committed Aug 21, 2017
1 parent 4295b94 commit d469d8c
Show file tree
Hide file tree
Showing 17 changed files with 4,970 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "es2016"]
}
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
insert_final_newline = true

[*.{js,json}]
charset = utf-8
indent_style = space
indent_size = 2
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
"no-underscore-dangle": 0,
"global-require": 0,
"import/no-dynamic-require": 0
},
}
39 changes: 36 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,60 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules
# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# built library directory
lib/
4 changes: 0 additions & 4 deletions .jshintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- "4.1"
- "4.0"
- "4.8"
- "6.11"
sudo: false
script: "npm run-script test-ci"
script: "npm run test-ci"
after_script: "npm install coveralls@2.11.4 && cat ./coverage/lcov.info | coveralls"
5 changes: 5 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.2.0 / 2017-08-20
==================
* Convert to ES6 module
* Use jest for tests instead of mocha, chai

0.1.1 / 2015-10-10
==================

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(The MIT License)

Copyright (c) 2015 Levon Kirakosyan <noosx.e@gmail.com>
Copyright (c) 2015-2017 Levon Kirakosyan <noosx.e@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

67 changes: 44 additions & 23 deletions lib/hugla-config.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,60 @@
"use strict";

const _ = require('lodash');
Object.defineProperty(exports, "__esModule", {
value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
* HuglaConfig - config module for hugla web framework's node back-end
*/
class HuglaConfig {
constructor() {
var HuglaConfig = function () {
function HuglaConfig() {
_classCallCheck(this, HuglaConfig);

this.config = {};
}

/**
* Merges given object into config
* @param {object} config Configuration object to merge
*/
addConfig(config) {
this.config = _.merge(this.config, config);
}

/**
* Merges env variables into config
*/
addEnv() {
this.config = _.merge(this.config, process.env);
}

/**
* Merges given js or json file contents into config
*
* @param {string} path Path to config file (json or js)
*/
addFile(path) {
const fileConfig = require(path);
this.config = _.merge(this.config, fileConfig);
}
}
_createClass(HuglaConfig, [{
key: "addConfig",
value: function addConfig(config) {
this.config = Object.assign(this.config, config);
}

/**
* Merges env variables into config
*/

}, {
key: "addEnv",
value: function addEnv() {
this.config = Object.assign(this.config, process.env);
}

/**
* Merges given js or json file contents into config
*
* @param {string} path Path to config file (json or js)
*/

}, {
key: "addFile",
value: function addFile(path) {
var fileConfig = require(path);
this.config = Object.assign(this.config, fileConfig);
}
}]);

return HuglaConfig;
}();

module.exports = HuglaConfig;
exports.default = HuglaConfig;
Loading

0 comments on commit d469d8c

Please sign in to comment.