Skip to content

Commit

Permalink
Merge pull request #6 from Prasunjais/feat/husky/init
Browse files Browse the repository at this point in the history
feat(husky): Added Husky for initial commit
  • Loading branch information
Prasunjais committed May 16, 2021
2 parents ce44577 + 5712534 commit cc85ae8
Show file tree
Hide file tree
Showing 11 changed files with 7,433 additions and 2,883 deletions.
13 changes: 12 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"presets": ["es2015", "stage-2"]
"presets": [
"env",
"es2015",
"stage-2"
],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread"
],
"test": [
"jest"
]
}
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
echo \"Pre Commit Check\"

npm test
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
echo \"Pre Push Check\"

npm test
3 changes: 3 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"testRegex": "((\\.|/*.)(spec))\\.js?$"
}
10,209 changes: 7,330 additions & 2,879 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
"description": "",
"main": "app.js",
"scripts": {
"test": "mocha src/test --timeout 10000",
"test": "jest --config ./jest.config.json",
"test:watch": "npm run test -- --watch",
"start": "if-env NODE_ENV=production ?? npm run start:prod || npm run start:dev",
"start:dev": "nodemon server.js .env.dev",
"start:prod": "node server.js .env.prod"
"start:prod": "node server.js .env.prod",
"clean": "rm -rf node_modules",
"reinstall": "npm run clean && npm install",
"rebuild": "npm run clean && npm install && npm run dev",
"prepare": "husky install"
},
"keywords": [
"express",
Expand Down Expand Up @@ -39,6 +44,7 @@
"helmet": "^3.21.2",
"if-env": "^1.0.4",
"ipware": "^2.0.0",
"jest": "^26.6.3",
"joi": "^14.3.1",
"joi-date-extensions": "^1.2.0",
"knex": "^0.19.5",
Expand All @@ -55,6 +61,7 @@
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"nodemon": "^1.19.4",
"node-env-run": "^2.0.1"
"node-env-run": "^2.0.1",
"husky": "^6.0.0"
}
}
50 changes: 50 additions & 0 deletions src/components/user/models/user.mongo.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const mongoose = require('mongoose');
const autopopulate = require('mongoose-autopopulate');
require('mongoose-type-email');
const Schema = mongoose.Schema;

// schema
const alerts = new Schema({
name: {
type: String,
required: true
},
nameToDisplay: {
type: String,
required: true
},
stateId: {
type: 'Number',
required: true
},
districtId: [{
type: 'Number',
required: true
}],
email: {
type: mongoose.SchemaTypes.Email,
unique: true
},
status: {
type: Number,
default: 1,
enum: [0, 1]
},
isDeleted: {
type: Number,
default: 0,
enum: [0, 1]
},
}, {
timestamps: true
});

// creating indexes
alerts.index({
'status': 1
});

alerts.plugin(autopopulate);

// exporting the entire module
module.exports = mongoose.model('alerts', alerts);
6 changes: 6 additions & 0 deletions src/hooks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* All your Hooks Comes here
*/
module.exports = {

};
5 changes: 5 additions & 0 deletions src/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('My Test Suite', () => {
it('My Test Case', () => {
expect(true).toEqual(true);
});
});
6 changes: 6 additions & 0 deletions src/third_party_apis/dummy/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* All the third party apis comes here
*/
module.exports = {

};

0 comments on commit cc85ae8

Please sign in to comment.