Skip to content

Commit b864362

Browse files
authored
[+] Technical - Add babel (#217)
1 parent 29e3ab3 commit b864362

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1595
-112
lines changed

.babelrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": ["env"],
3+
"plugins": [
4+
[
5+
"transform-runtime",
6+
{
7+
"polyfill": false,
8+
"regenerator": true
9+
}
10+
]
11+
]
12+
}

.githooks/pre-commit/jshint

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ build/Release
2525
# Dependency directory
2626
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2727
node_modules
28+
29+
# Build
30+
dist

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src

CHANGELOG.md

Lines changed: 2 additions & 0 deletions

bin/.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
'rules': {
3+
'no-console': 0
4+
}
5+
};

bin/deploy.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
const moment = require('moment');
3+
const fs = require('fs');
4+
const simpleGit = require('simple-git')();
5+
const semver = require('semver');
6+
7+
const BRANCH_MASTER = 'master';
8+
const BRANCH_DEVEL = 'devel';
9+
10+
let numberToIncrement = 'patch';
11+
if (process.argv && process.argv[3]) {
12+
const option = process.argv[3].replace('--', '');
13+
if (['major', 'minor', 'patch'].indexOf(option) !== -1) {
14+
numberToIncrement = option;
15+
}
16+
}
17+
18+
// VERSION
19+
const versionFile = fs.readFileSync('package.json').toString().split('\n');
20+
let version = versionFile[3].match(/\w*"version": "(.*)",/)[1];
21+
version = semver.inc(version, numberToIncrement);
22+
versionFile[3] = ' "version": "' + version + '",';
23+
fs.writeFileSync('package.json', versionFile.join('\n'));
24+
25+
// CHANGELOG
26+
const data = fs.readFileSync('CHANGELOG.md').toString().split('\n');
27+
const today = moment().format('YYYY-MM-DD');
28+
29+
data.splice(3, 0, '\n## RELEASE ' + version + ' - ' + today);
30+
const text = data.join('\n');
31+
32+
simpleGit
33+
.checkout(BRANCH_DEVEL)
34+
.then(function() { console.log('Starting pull on ' + BRANCH_DEVEL + '...'); })
35+
.pull(function(error) { if (error) { console.log(error); } })
36+
.then(function() { console.log(BRANCH_DEVEL + ' pull done.'); })
37+
.then(function() { fs.writeFileSync('CHANGELOG.md', text); })
38+
.add(['CHANGELOG.md', 'package.json'])
39+
.commit('Release ' + version)
40+
.push()
41+
.checkout(BRANCH_MASTER)
42+
.then(function() { console.log('Starting pull on ' + BRANCH_MASTER + '...'); })
43+
.pull(function(error) { if (error) { console.log(error); } })
44+
.then(function() { console.log(BRANCH_MASTER + ' pull done.'); })
45+
.mergeFromTo(BRANCH_DEVEL, BRANCH_MASTER)
46+
.push();

gulpfile.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

package.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
"type": "git",
2222
"url": "git://github.com/ForestAdmin/forest-express-sequelize.git"
2323
},
24-
"main": "index.js",
24+
"main": "dist/index.js",
2525
"dependencies": {
26+
"babel-runtime": "6.26.0",
2627
"bluebird": "2.9.25",
2728
"forest-express": "2.15.4",
2829
"http-errors": "1.6.1",
@@ -31,22 +32,33 @@
3132
"moment-timezone": "0.5.14"
3233
},
3334
"devDependencies": {
35+
"babel-cli": "6.26.0",
36+
"babel-core": "6.26.0",
37+
"babel-plugin-transform-runtime": "6.23.0",
38+
"babel-preset-env": "1.6.1",
3439
"chai": "2.3.0",
3540
"eslint": "4.1.1",
36-
"git-hooks": "1.1.9",
3741
"gulp": "3.9.1",
3842
"mocha": "2.2.5",
3943
"mysql": "2.13.0",
4044
"nsp": "2.8.1",
45+
"onchange": "4.0.0",
4146
"pg": "6.3.1",
47+
"pre-commit": "1.2.2",
4248
"semver": "5.4.1",
4349
"sequelize": "3.29.0",
4450
"sequelize-fixtures": "0.6.0",
4551
"simple-git": "1.65.0"
4652
},
4753
"scripts": {
54+
"build": "./node_modules/babel-cli/bin/babel.js src --out-dir dist && echo '\n\\033[0;34m[+] \\033[0;32mBuild done\\033[0m'",
55+
"build:watch": "onchange 'src/**/*.js' -i -- yarn build",
56+
"deploy": "yarn build && node ./bin/deploy.js",
4857
"test": "./node_modules/mocha/bin/mocha test/**",
49-
"lint": "./node_modules/eslint/bin/eslint.js services/ adapters/ utils/",
50-
"detect-vulnerabilities": "./node_modules/nsp/bin/nsp check --output summary"
51-
}
58+
"detect-vulnerabilities": "./node_modules/nsp/bin/nsp check --output summary",
59+
"lint": "./node_modules/eslint/bin/eslint.js src"
60+
},
61+
"pre-commit": [
62+
"lint"
63+
]
5264
}
File renamed without changes.

0 commit comments

Comments
 (0)