Skip to content

Commit

Permalink
remove transpile stuff (babel)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklrs committed Apr 16, 2019
1 parent 901a409 commit 2f64dd4
Show file tree
Hide file tree
Showing 13 changed files with 799 additions and 746 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## 1.1.0 2019-04-16
* remove transpile stuff (babel), use native js with CommonJS modules
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

### It will create/setup minimum package structure to support
* eslint
* babel transpiler
* testing via express and mocha

### Install it global
Expand Down
5 changes: 2 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ module.exports = class extends Generator {
install(){
this.log('Install packages ...')
this.npmInstall([
'babel-cli', 'babel-plugin-transform-object-rest-spread',
'babel-preset-env', 'chai', 'chai-http', 'eslint',
'eslint-plugin-mocha', 'express', 'mocha', 'nyc'
'chai', 'chai-http', 'eslint', 'eslint-plugin-mocha', 'express',
'mocha', 'nyc'
], {'save-dev': true })
}
}
3 changes: 1 addition & 2 deletions app/templates/_gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules/
.npm
js
.npm
mydb.sqlite
.nyc_output
13 changes: 1 addition & 12 deletions app/templates/package_json
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
{
"scripts": {
"test": "nyc --reporter=text mocha --inspect --require babel-register --require source-map-support --recursive",
"build": "babel src --out-dir js",
"prepare": "npm run build",
"watch": "babel --watch src --out-dir js",
"test": "nyc --reporter=text mocha --inspect --recursive",
"coverage": "nyc report --reporter=text-lcov"
},
"main": "js/index.js",
"license": "<%= license %>",
"babel": {
"presets": [
"env"
],
"plugins": [
"transform-object-rest-spread"
]
},
"name": "<%= name %>",
"version": "1.0.0",
"description": "<%= description %>",
Expand Down
1 change: 0 additions & 1 deletion app/templates/static/.eslintignore

This file was deleted.

4 changes: 1 addition & 3 deletions app/templates/static/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true,
"mocha": true
Expand All @@ -10,8 +9,7 @@ module.exports = {
],
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
"ecmaVersion": 2018
},
"rules": {
"indent": [
Expand Down
5 changes: 5 additions & 0 deletions app/templates/static/js/getWelcome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

module.exports = (req, res) => {
res.send('Welcome')
}
11 changes: 11 additions & 0 deletions app/templates/static/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'
const getWelcome = require('./getWelcome')

exports.default = {
http : [{
routePath: '/',
map: getWelcome,
method: 'GET',
accepted: ['application/json']
}]
}
3 changes: 0 additions & 3 deletions app/templates/static/src/getWelcome.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/templates/static/src/index.js

This file was deleted.

14 changes: 6 additions & 8 deletions app/templates/static/test/_scaffold-http-test.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import chai, {expect} from 'chai'
import chaiHttp from 'chai-http'
import express from 'express'

chai.use(chaiHttp)

const app = express(),
'use strict'
const {expect, request} = require('chai').use(require('chai-http')),
express = require('express'),
app = express(),
error = err => {throw err}

app.use((req, res, next) => {
//add some test data to req object ..
next()
Expand All @@ -14,7 +12,7 @@ app.use((req, res) => res.send('Hello World example'))

describe('stub', () => {
it('response with Hello World', () => {
return chai.request(app).get('/foo').send().then(
return request(app).get('/foo').send().then(
res => {
expect(res).to.have.status(200)
expect(res.text).to.contain('Hello World example')
Expand Down
Loading

0 comments on commit 2f64dd4

Please sign in to comment.