Commit 8de29d5a authored by Jonathan Cunanan's avatar Jonathan Cunanan

Remove files for simplification

parent 77c26b96
# bin folder
bin
# build folder
build
dist
# test files
/__tests__/**
*.test.js
*.spec.js
# config files
*.config.js
module.exports = {
env: {
es6: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module'
},
rules: {
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['warn', 'always'],
'import/no-commonjs': 'error'
}
};
module.exports = api => {
const isTest = api.env('test');
api.cache(true);
// configs to load when testing environment
if (isTest)
return {
presets: ['@babel/preset-env']
};
return {
presets: ['@babel/preset-env'],
ignore: ['**/__tests__/**', '*.test.js', '*.spec.js']
};
};
module.exports = {
setupFiles: ['<rootDir>/node_modules/regenerator-runtime/runtime']
};
{
"execMap": {
"js": "babel-node"
},
"watch": ["src/*", "public/*"],
"ext": "js, html, css, json"
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "express-es6-sample", "name": "your-project-name",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "npm run prod", "start": "npm run prod",
"dev": "NODE_ENV=development npm run watch ./src/bin/www", "server": "babel-node ./src/bin/www",
"prod": "npm run build && NODE_ENV=production node ./dist/bin/www", "server:prod": "node ./dist/bin/www",
"build": "npm run clean && babel ./src --config-file ./babel.config.js --out-dir dist", "dev": "NODE_ENV=development npm-run-all server",
"clean": "rimraf dist", "clean": "rimraf dist",
"watch": "nodemon --config ./nodemon.json --", "build": "babel ./src --out-dir dist",
"test": "jest", "prod": "NODE_ENV=production npm-run-all clean build server:prod"
"test:watch": "npm run test -- --watch"
}, },
"dependencies": { "dependencies": {
"cookie-parser": "~1.4.3", "cookie-parser": "~1.4.3",
"debug": "~2.6.9", "debug": "~2.6.9",
"express": "~4.16.0", "express": "~4.16.0",
"morgan": "~1.9.0", "morgan": "~1.9.0",
"npm-run-all": "^4.1.5",
"rimraf": "^2.6.3" "rimraf": "^2.6.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.2.3", "@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2", "@babel/core": "^7.2.2",
"@babel/node": "^7.2.2", "@babel/node": "^7.2.2",
"@babel/polyfill": "^7.2.5", "@babel/preset-env": "^7.3.1"
"@babel/preset-env": "^7.3.1",
"eslint": "^5.13.0",
"eslint-plugin-import": "^2.16.0",
"jest": "^24.1.0",
"nodemon": "^1.18.9",
"supertest": "^3.4.2"
} }
} }
import request from 'supertest';
import app from '../app';
describe('sample test', () => {
it('jest works', () => {
expect(true).toBe(true);
});
});
describe('index route', () => {
it('responds 200', async () => {
const response = await request(app).get('/');
expect(response.statusCode).toBe(200);
});
});
...@@ -8,20 +8,20 @@ import app from '../app'; ...@@ -8,20 +8,20 @@ import app from '../app';
import debugLib from 'debug'; import debugLib from 'debug';
import http from 'http'; import http from 'http';
const debug = debugLib('express-es6-sample:server'); const debug = debugLib('your-project-name:server');
/** /**
* Get port from environment and store in Express. * Get port from environment and store in Express.
*/ */
const port = normalizePort(process.env.PORT || '3000'); var port = normalizePort(process.env.PORT || '3000');
app.set('port', port); app.set('port', port);
/** /**
* Create HTTP server. * Create HTTP server.
*/ */
const server = http.createServer(app); var server = http.createServer(app);
/** /**
* Listen on provided port, on all network interfaces. * Listen on provided port, on all network interfaces.
...@@ -65,7 +65,6 @@ function onError(error) { ...@@ -65,7 +65,6 @@ function onError(error) {
// handle specific listen errors with friendly messages // handle specific listen errors with friendly messages
switch (error.code) { switch (error.code) {
case 'EACCES': case 'EACCES':
/* eslint-disable no-console */
console.error(bind + ' requires elevated privileges'); console.error(bind + ' requires elevated privileges');
process.exit(1); process.exit(1);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment