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": [ "presets": [
"es2015" ["env", {
], "targets": {
"plugins": [ "node": "6.14"
"transform-runtime" }
}]
] ]
} }

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) { function resolve(p) {
return path.join(__dirname, '/../', p); return path.resolve(__dirname, './../', p);
} }
module.exports = { module.exports = {
@ -14,14 +14,16 @@ module.exports = {
__dirname: false, __dirname: false,
__filename: false, __filename: false,
}, },
context: resolve('./src'), entry: [ './src/index.ts' ],
entry: './index',
output: { output: {
filename: "server.js", filename: "server.js",
path: resolve('dist') path: resolve('dist')
}, },
optimization: {
minimize: false
},
plugins: [ plugins: [
new webpack.optimize.OccurrenceOrderPlugin()
], ],
resolve: { resolve: {
extensions: [".ts", ".js"], extensions: [".ts", ".js"],
@ -30,17 +32,13 @@ module.exports = {
} }
}, },
module: { module: {
loaders: [ rules: [
{
test: /\.ts?$/,
loaders: ['babel-loader', 'ts-loader'],
exclude: [ /node_modules/ ]
},
// babel-loader for pure javascript (es6) => javascript (es5)
{ {
test: /\.(jsx?)$/, test: /\.ts$/,
loaders: ['babel'], use: [
exclude: [ /node_modules/ ] { 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'); const webpack = require('webpack');
base.mode = 'development';
base.watch = true; base.watch = true;
base.devtool = 'inline-source-map'; base.devtool = 'inline-source-map';
@ -9,7 +10,7 @@ base.devtool = 'inline-source-map';
base.externals = base.externals ? base.externals : []; base.externals = base.externals ? base.externals : [];
base.externals.push( base.externals.push(
function(context, request, callback) { function(context, request, callback) {
if(request[0] == '.') { if(request[0] == '.' || request.indexOf('koa') == 0) {
callback(); callback();
} else { } else {
callback(null, "require('" + request + "')"); callback(null, "require('" + request + "')");

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

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

45
server/package.json

@ -5,43 +5,44 @@
"scripts": { "scripts": {
"start": "node dist/server.js", "start": "node dist/server.js",
"dev": "node build/dev-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": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/hastic/hastic-server.git" "url": "git+https://github.com/hastic/hastic-server.git"
}, },
"author": "CorpGlory", "author": "Hastic Core Team",
"license": "ISC", "license": "Apache-2.0",
"bugs": { "bugs": {
"url": "https://github.com/hastic/hastic-server/issues" "url": "https://github.com/hastic/hastic-server/issues"
}, },
"homepage": "https://github.com/hastic/hastic-server#readme", "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": { "devDependencies": {
"@types/axios": "^0.14.0",
"@types/koa": "^2.0.45", "@types/koa": "^2.0.45",
"@types/koa-bodyparser": "^4.2.0", "@types/koa-bodyparser": "^4.2.0",
"@types/koa-router": "^7.0.28", "@types/koa-router": "^7.0.28",
"axios": "^0.18.0",
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
"babel-loader": "^6.4.1", "babel-loader": "^7.1.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", "babel-preset-env": "^1.7.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-runtime": "^6.26.0", "nodemon": "^1.17.5",
"encoding": "^0.1.12", "ts-loader": "^4.4.1",
"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",
"typescript": "^2.8.3", "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": { "compilerOptions": {
"outDir": "./dist/",
"sourceMap": true, "sourceMap": true,
"noImplicitAny": false, "noImplicitAny": false,
"module": "commonjs", "module": "commonjs",

Loading…
Cancel
Save