remove usage of babel, replace import with require

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-12-27 14:11:07 +01:00
parent 5b83042ef8
commit 600d748236
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
12 changed files with 45 additions and 79 deletions

View File

@ -1,11 +0,0 @@
{
"env": {
"test": {
"plugins": [ "istanbul" ]
}
},
"presets": [
["@babel/env", { "targets": {"node": "current"} }]
],
"plugins": ["@babel/plugin-transform-async-to-generator"]
}

View File

@ -1,5 +1,4 @@
const gulp = require('gulp') const gulp = require('gulp')
const babel = require('gulp-babel')
const clean = require('gulp-clean') const clean = require('gulp-clean')
const mocha = require('gulp-mocha') const mocha = require('gulp-mocha')
const print = require('gulp-print').default const print = require('gulp-print').default
@ -10,7 +9,6 @@ gulp.task('devel', () => {
nodemon({ nodemon({
script: 'src/server.js', script: 'src/server.js',
presets: ['env', 'stage-2'], presets: ['env', 'stage-2'],
exec: 'babel-node'
}) })
.on('restart', () => { console.log('>> node restart') }) .on('restart', () => { console.log('>> node restart') })
}) })
@ -21,24 +19,16 @@ gulp.task('clean', () =>
gulp.task('test', () => gulp.task('test', () =>
gulp.src('test/**/*.js', {read: false}) gulp.src('test/**/*.js', {read: false})
.pipe(mocha({ .pipe(mocha({reporter: 'list'}))
reporter: 'list',
require: '@babel/register',
}))
) )
gulp.task('testw', () => gulp.task('testw', () =>
gulp.src('test/**/*.js', {read: false}) gulp.src('test/**/*.js', {read: false})
.pipe(mocha({ .pipe(mocha({reporter: 'list', watch: true}))
reporter: 'list',
require: '@babel/register',
watch: true,
}))
) )
gulp.task('build', ['clean', 'test'], () => gulp.task('build', ['clean', 'test'], () =>
gulp.src('src/**/*.js') gulp.src('src/**/*.js')
.pipe(babel())
.pipe(print()) .pipe(print())
.pipe(gulp.dest('dist/')) .pipe(gulp.dest('dist/'))
) )

View File

@ -18,22 +18,15 @@
"lokijs": "^1.5.5" "lokijs": "^1.5.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/node": "^7.0.0",
"@babel/plugin-transform-async-to-generator": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"babel-core": "^7.0.0-bridge.0",
"babel-plugin-istanbul": "^5.1.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-babel": "^8.0.0-beta.2",
"gulp-clean": "^0.4.0", "gulp-clean": "^0.4.0",
"gulp-exec": "^3.0.2", "gulp-exec": "^3.0.2",
"gulp-mocha": "^6.0.0", "gulp-mocha": "^6.0.0",
"gulp-nodemon": "^2.2.1", "gulp-nodemon": "^2.2.1",
"gulp-print": "^5.0.0", "gulp-print": "^5.0.0",
"gulp-run-command": "^0.0.9",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"nodemon": "^1.18.4", "nodemon": "^1.18.4",
"nyc": "^13.1.0", "nyc": "^13.1.0",
@ -53,12 +46,6 @@
"push": "gulp push", "push": "gulp push",
"release": "release" "release": "release"
}, },
"mocha": [
"@babel/register"
],
"require": [
"@babel/register"
],
"keywords": [ "keywords": [
"github", "github",
"comments", "comments",

View File

@ -1,10 +1,10 @@
import log from 'loglevel' const log = require('loglevel')
import Koa from 'koa' const Koa = require('koa')
import JSON from 'koa-json' const JSON = require('koa-json')
import Logger from 'koa-logger' const Logger = require('koa-logger')
import JsonError from 'koa-json-error' const JsonError = require('koa-json-error')
import JoiRouter from 'koa-joi-router' const JoiRouter = require('koa-joi-router')
import BodyParser from 'koa-bodyparser' const BodyParser = require('koa-bodyparser')
const App = (ghc) => { const App = (ghc) => {
const app = new Koa() const app = new Koa()

View File

@ -1,7 +1,7 @@
import log from 'loglevel' const log = require('loglevel')
import Joi from 'joi' const Joi = require('joi')
import Loki from 'lokijs' const Loki = require('lokijs')
import schema from './schema' const schema = require('./schema')
class Builds { class Builds {
constructor(path, interval) { constructor(path, interval) {

View File

@ -1,6 +1,6 @@
import log from 'loglevel' const log = require('loglevel')
import Handlebars from 'handlebars' const Handlebars = require('handlebars')
import template from './template' const template = require('./template')
/* in theory the jenkins build comment should be the first one */ /* in theory the jenkins build comment should be the first one */
const PER_PAGE = 100 const PER_PAGE = 100

View File

@ -1,4 +1,4 @@
import Joi from 'joi' const Joi = require('joi')
const schema = Joi.object().keys({ const schema = Joi.object().keys({
id: Joi.alternatives().try(Joi.number().positive(), Joi.string()).required(), id: Joi.alternatives().try(Joi.number().positive(), Joi.string()).required(),

View File

@ -1,10 +1,10 @@
import log from 'loglevel' const log = require('loglevel')
import Logger from 'koa-logger' const Logger = require('koa-logger')
import Octokit from '@octokit/rest' const Octokit = require('@octokit/rest')
import App from './app' const App = require('./app')
import Builds from './builds' const Builds = require('./builds')
import Comments from './comments' const Comments = require('./comments')
/* DEFAULTS */ /* DEFAULTS */
const LOG_LEVEL = process.env.LOG_LEVEL || 'INFO' const LOG_LEVEL = process.env.LOG_LEVEL || 'INFO'

View File

@ -1,11 +1,11 @@
import { expect } from 'chai' const expect = require('chai').expect
import sinon from 'sinon' const sinon = require('sinon')
import request from 'supertest' const request = require('supertest')
import sample from './sample' const sample = require('./sample')
import App from '../src/app' const App = require('../src/app')
import Builds from '../src/builds' const Builds = require('../src/builds')
import Comments from '../src/comments' const Comments = require('../src/comments')
let ghc, app let ghc, app

View File

@ -1,9 +1,9 @@
import { expect } from 'chai' const expect = require('chai').expect
import sinon from 'sinon' const sinon = require('sinon')
import sample from './sample' const sample = require('./sample')
import Builds from '../src/builds' const Builds = require('../src/builds')
import Comments from '../src/comments' const Comments = require('../src/comments')
let comments, client, builds let comments, client, builds

View File

@ -1,9 +1,9 @@
import { expect } from 'chai' const expect = require('chai').expect
import sinon from 'sinon' const sinon = require('sinon')
import Joi from 'joi' const Joi = require('joi')
import sample from './sample' const sample = require('./sample')
import Schema from '../src/schema' const Schema = require('../src/schema')
let build let build

View File

@ -1,7 +1,7 @@
import log from 'loglevel' const log = require('loglevel')
import chai from 'chai' const chai = require('chai')
import sinonChai from 'sinon-chai' const sinonChai = require('sinon-chai')
import chaiAsPromised from 'chai-as-promised' const chaiAsPromised = require('chai-as-promised')
/* limit amount of console noise for tests */ /* limit amount of console noise for tests */
log.setDefaultLevel(log.levels.WARN) log.setDefaultLevel(log.levels.WARN)