Skip to content

Commit

Permalink
refactor: migrate to es6
Browse files Browse the repository at this point in the history
  • Loading branch information
lykmapipo committed Aug 19, 2021
1 parent 613a4d0 commit 5292c96
Show file tree
Hide file tree
Showing 24 changed files with 25,548 additions and 5,837 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js}]
charset = utf-8
Empty file added .eslintignore
Empty file.
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": [
"airbnb-base",
"plugin:prettier/recommended",
"plugin:jsdoc/recommended"
],
"plugins": ["prettier", "jsdoc"],
"rules": {
"prettier/prettier": "error"
}
}
107 changes: 97 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,117 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

#Temporary data
.tmp
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

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

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

# Coverage directory used by tools like istanbul
coverage
*.lcov

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# nyc test coverage
.nyc_output

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

# Compiled binary addons (http://nodejs.org/api/addons.html)
# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

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

# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
doc
startup.sh
# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
8 changes: 0 additions & 8 deletions .jsbeautifyrc

This file was deleted.

21 changes: 0 additions & 21 deletions .jshintrc

This file was deleted.

55 changes: 37 additions & 18 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
node_modules
ssl
.DS_STORE
*~
.idea
nbproject
test
.git
.gitignore
.tmp
*.swo
*.swp
*.swn
*.swm
# Logs
logs
*.log
.jshintrc
.editorconfig

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

# Intermediate data
.grunt
.husky
.nyc_output
coverage
libcov
lib-cov
*.lcov

# Dependency directories
node_modules/

# Package files
docs
doc.html
examples
test
CODE_OF_CONDUCT.md
CONTRIBUTING.md

# Configuration files
.babelrc
.editorconfig
.eslintignore
.eslintrc
.prettierignore
.prettierrc
.travis.yml
Gruntfile.js
Gruntfile.js
rollup.config.js
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
libcov
coverage
.nyc_output
package.json
package-lock.json
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 80,
"singleQuote": true,
"semi": true,
"trailingComma": "es5"
}
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
language: node_js
# services:
# - mongodb
# - redis-server
node_js:
- "11.12.0"
before_script:
- npm install -g grunt-cli
- node
# before_script:
# - redis-cli config set notify-keyspace-events Ex
script:
- commitlint-travis
- npm test
after_success: npm run coverage
50 changes: 0 additions & 50 deletions Gruntfile.js

This file was deleted.

Empty file added docs/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions examples/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"no-console": "off"
}
}
Empty file added examples/.gitkeep
Empty file.
26 changes: 26 additions & 0 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { merge } from 'lodash';
import express from 'express';
import mquery from '../src';

const PORT = 3000;

// prepare express app
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.json({ limit: '2mb' }));
app.use(mquery());

// handle requests
app.get('/', (request, response) => {
const options = merge({}, request.mquery);
response.json(options);
});

// run express app
app.listen(PORT, (error) => {
if (error) {
throw error;
} else {
console.log(`visit http://0.0.0.0:${PORT}`);
}
});
Loading

0 comments on commit 5292c96

Please sign in to comment.