Browse Source

#12 Node 6.14 support (#17)

* node 6.14 build
pull/1/head
Alexey Velikiy 7 years ago committed by GitHub
parent
commit
3aa1eb854a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      server/.babelrc
  2. 10
      server/BUILD_6_14.md
  3. 26
      server/build/webpack.base.conf.js
  4. 3
      server/build/webpack.dev.conf.js
  5. 1
      server/build/webpack.prod.conf.js
  6. 45
      server/package.json
  7. 1
      server/tsconfig.json

9
server/.babelrc

@ -1,8 +1,9 @@
{
"presets": [
"es2015"
],
"plugins": [
"transform-runtime"
["env", {
"targets": {
"node": "6.14"
}
}]
]
}

10
server/BUILD_6_14.md

@ -0,0 +1,10 @@
# Node.js 6.14 build
If you want to use old version of Node.js, then do:
```
cd server
npm run 6-14-install
npm run 6-14-build
npm run 6-14-start
```

26
server/build/webpack.base.conf.js

@ -5,7 +5,7 @@ const webpack = require('webpack');
function resolve(p) {
return path.join(__dirname, '/../', p);
return path.resolve(__dirname, './../', p);
}
module.exports = {
@ -14,14 +14,16 @@ module.exports = {
__dirname: false,
__filename: false,
},
context: resolve('./src'),
entry: './index',
entry: [ './src/index.ts' ],
output: {
filename: "server.js",
path: resolve('dist')
},
optimization: {
minimize: false
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin()
],
resolve: {
extensions: [".ts", ".js"],
@ -30,17 +32,13 @@ module.exports = {
}
},
module: {
loaders: [
rules: [
{
test: /\.ts?$/,
loaders: ['babel-loader', 'ts-loader'],
exclude: [ /node_modules/ ]
},
// babel-loader for pure javascript (es6) => javascript (es5)
{
test: /\.(jsx?)$/,
loaders: ['babel'],
exclude: [ /node_modules/ ]
test: /\.ts$/,
use: [
{ loader: 'babel-loader' },
{ loader: 'ts-loader' }
]
}
]
}

3
server/build/webpack.dev.conf.js

@ -2,6 +2,7 @@ const base = require('./webpack.base.conf');
const webpack = require('webpack');
base.mode = 'development';
base.watch = true;
base.devtool = 'inline-source-map';
@ -9,7 +10,7 @@ base.devtool = 'inline-source-map';
base.externals = base.externals ? base.externals : [];
base.externals.push(
function(context, request, callback) {
if(request[0] == '.') {
if(request[0] == '.' || request.indexOf('koa') == 0) {
callback();
} else {
callback(null, "require('" + request + "')");

1
server/build/webpack.prod.conf.js

@ -1,3 +1,4 @@
var base = require('./webpack.base.conf');
base.mode = 'production';
module.exports = base;

45
server/package.json

@ -5,43 +5,44 @@
"scripts": {
"start": "node dist/server.js",
"dev": "node build/dev-server.js",
"build": "webpack --config build/webpack.prod.conf.js"
"build": "webpack --config build/webpack.prod.conf.js",
"6-14-start": "node dist/server-6-14.js",
"6-14-install": "npm install && npm install babel-cli",
"6-14-copyserver": "echo \"require('babel-polyfill'); \" > dist/server-6-14-prebuild.js && cat dist/server.js >> dist/server-6-14-prebuild.js",
"6-14-prebuild": "npm run build && npm run 6-14-copyserver",
"6-14-build": "npm run 6-14-prebuild && babel --presets es2015 dist/server-6-14-prebuild.js -o dist/server-6-14.js "
},
"repository": {
"type": "git",
"url": "git+https://github.com/hastic/hastic-server.git"
},
"author": "CorpGlory",
"license": "ISC",
"author": "Hastic Core Team",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/hastic/hastic-server/issues"
},
"homepage": "https://github.com/hastic/hastic-server#readme",
"dependencies": {},
"dependencies": {
"axios": "^0.18.0",
"es6-promise": "^4.2.4",
"event-stream": "^3.3.4",
"koa": "^2.5.1",
"koa-bodyparser": "^4.2.1",
"koa-router": "^7.4.0"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/koa": "^2.0.45",
"@types/koa-bodyparser": "^4.2.0",
"@types/koa-router": "^7.0.28",
"axios": "^0.18.0",
"babel-core": "^6.26.3",
"babel-loader": "^6.4.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-runtime": "^6.26.0",
"encoding": "^0.1.12",
"es6-promise": "^4.2.4",
"event-stream": "^3.3.4",
"fast-csv": "^2.4.1",
"koa": "^2.5.1",
"koa-bodyparser": "^4.2.1",
"koa-router": "^7.4.0",
"nodemon": "^1.17.3",
"ts-loader": "^3.5.0",
"nodemon": "^1.17.5",
"ts-loader": "^4.4.1",
"typescript": "^2.8.3",
"webpack": "^3.5.6"
"webpack": "^4.12.0",
"webpack-cli": "^3.0.8"
}
}

1
server/tsconfig.json

@ -1,6 +1,5 @@
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": false,
"module": "commonjs",

Loading…
Cancel
Save