Skip to content

Commit

Permalink
Bump nodejs version to 6+ (parse-community#4272)
Browse files Browse the repository at this point in the history
* let travis build against 3.x

* Cleanup dependencies and bump min version to current LTS

* Makes npm-git push all branches to -preview

* restores releases

* Bumps mime to 2.0.3 (requires node 6+)

* Bumps express to latest version

* Fixes linting issue after upgrade

* Use travis-branch for partial releases
  • Loading branch information
flovilmart committed Nov 25, 2017
1 parent 04683e2 commit aa6269f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
7 changes: 3 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"plugins": [
"transform-flow-strip-types"
"transform-flow-strip-types",
"transform-object-rest-spread"
],
"presets": [
"es2015",
"stage-3",
["env", {
"targets": {
"node": "4.6"
"node": "6.11.4"
}
}]
]
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ stage: test
env:
global:
- COVERAGE_OPTION='./node_modules/.bin/nyc'
- NODE_VERSION=6.10
- NODE_VERSION=6.11.4
matrix:
- MONGODB_VERSION=3.2.13
- MONGODB_VERSION=3.4.4
- PARSE_SERVER_TEST_DB=postgres
- PARSE_SERVER_TEST_CACHE=redis
- NODE_VERSION=8.5
- NODE_VERSION=8.7
before_install:
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
Expand All @@ -48,7 +48,7 @@ jobs:
include:
# release on github latest branch
- stage: release
node_js: '4.6'
node_js: '6.11.4'
env:
before_script: skip
after_script: skip
Expand All @@ -58,7 +58,9 @@ jobs:
skip_cleanup: true
script: ./resources/npm-git.sh
on:
branch: master
branch:
- master
- 3.x
- provider: npm
skip_cleanup: true
email:
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"body-parser": "1.18.2",
"commander": "2.12.1",
"deepcopy": "0.6.3",
"express": "4.16.0",
"express": "4.16.2",
"intersect": "1.0.1",
"lodash": "4.17.4",
"lru-cache": "4.1.1",
"mime": "1.4.1",
"mime": "2.0.3",
"mongodb": "2.2.33",
"multer": "1.3.0",
"parse": "1.10.2",
Expand All @@ -48,12 +48,9 @@
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "^8.0.0",
"babel-plugin-syntax-flow": "6.18.0",
"babel-plugin-transform-flow-strip-types": "6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "1.6.1",
"babel-preset-es2015": "6.24.1",
"babel-preset-stage-3": "6.24.1",
"babel-register": "6.26.0",
"bcrypt-nodejs": "0.0.3",
"cross-env": "5.1.1",
"deep-diff": "0.3.8",
Expand All @@ -80,7 +77,7 @@
"prepublish": "npm run build"
},
"engines": {
"node": ">=4.6"
"node": ">=6.11.4"
},
"bin": {
"parse-server": "./bin/parse-server"
Expand Down
10 changes: 8 additions & 2 deletions resources/npm-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
# From: https://github.com/graphql/graphql-js/blob/master/resources/npm-git.sh

BUILD_DIR=latest
BRANCH="${TRAVIS_BRANCH}"
TARGET="latest"
if [ "$BRANCH" != "master" ];
then
TARGET="$BRANCH-preview"
fi

npm run build

Expand All @@ -29,5 +35,5 @@ git init
git config user.name "Travis CI"
git config user.email "github@fb.com"
git add .
git commit -m "Deploy master to LATEST branch"
git push --force --quiet "https://${GH_TOKEN}@github.com/parse-community/parse-server.git" master:latest
git commit -m "Deploy $BRANCH to $TARGET branch"
git push --force --quiet "https://${GH_TOKEN}@github.com/parse-community/parse-server.git" master:$TARGET
6 changes: 3 additions & 3 deletions src/Controllers/FilesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export class FilesController extends AdaptableController {

const hasExtension = extname.length > 0;

if (!hasExtension && contentType && mime.extension(contentType)) {
filename = filename + '.' + mime.extension(contentType);
if (!hasExtension && contentType && mime.getExtension(contentType)) {
filename = filename + '.' + mime.getExtension(contentType);
} else if (hasExtension && !contentType) {
contentType = mime.lookup(filename);
contentType = mime.getType(filename);
}

filename = randomHexString(32) + '_' + filename;
Expand Down
2 changes: 1 addition & 1 deletion src/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export interface ParseServerOptions {
enableSingleSchemaCache: ?boolean; // = false
/* Sets the number of characters in generated object id's, default 10 */
objectIdSize: ?number; // = 10
/* The port to run the ParseServer. defaults to 1337.@parse/gcs-adapter
/* The port to run the ParseServer. defaults to 1337.
:ENV: PORT */
port: ?number; // = 1337
/* The host to serve ParseServer on. defaults to 0.0.0.0 */
Expand Down
2 changes: 1 addition & 1 deletion src/Routers/FilesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class FilesRouter {
const config = Config.get(req.params.appId);
const filesController = config.filesController;
const filename = req.params.filename;
const contentType = mime.lookup(filename);
const contentType = mime.getType(filename);
if (isFileStreamable(req, filesController)) {
filesController.getFileStream(config, filename).then((stream) => {
handleFileStream(stream, req, res, contentType);
Expand Down

0 comments on commit aa6269f

Please sign in to comment.