Skip to content

Commit

Permalink
Update dependencies to latest (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
helloyou2012 authored and kannappanr committed Aug 6, 2019
1 parent 6c4a9f3 commit a962efa
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 102 deletions.
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ node_modules

/src/
/dist/test/
/examples/
/docs/

.eslintrc.yml
.travis.yml
appveyor.yml
CONTRIBUTING.md
gulpfile.js
*.js.map
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ env:
- ARCH=i686

node_js:
- '6'
- '5'
- '4'
- '12'
- '10'
- '8'

script:
- gulp browserify
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: "{build}"
os: Windows Server 2012 R2

environment:
nodejs_version: "0.12"
nodejs_version: "8"

# to run your custom scripts instead of automatic MSBuild
build_script:
Expand Down
113 changes: 49 additions & 64 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,83 +14,68 @@
* limitations under the License.
*/

var babel = require('gulp-babel')
var gulp = require('gulp')
var sourcemaps = require('gulp-sourcemaps')
var notify = require('gulp-notify');
const babel = require('gulp-babel')
const gulp = require('gulp')
const sourcemaps = require('gulp-sourcemaps')

var fs = require("fs");
var browserify = require("browserify");
var mocha = require('gulp-mocha')
var eslint = require('gulp-eslint')
const fs = require('fs')
const browserify = require('browserify')
const mocha = require('gulp-mocha')
const eslint = require('gulp-eslint')

gulp.task('browserify', ['compile'], function() {
browserify("./dist/main/minio.js", {
standalone: 'MinIO'
})
.bundle()
.on("error", function (err) { console.log("Error : " + err.message); })
.pipe(fs.createWriteStream("./dist/main/minio-browser.js"));
})

gulp.task('default', ['test', 'browserify'], function() {})
const compileJS = (src, dest) => {
return gulp.src(src)
.pipe(sourcemaps.init())
.pipe(babel({
presets: [['@babel/env', {
targets: { node: 4 }
}]]
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dest))
}

gulp.task('compile', function(cb) {
compile('src/main/**/*.js', 'minio.js', 'dist/main', cb)
const compile = () => compileJS('src/main/**/*.js', 'dist/main')
const testCompile = gulp.series(compile, () => {
return compileJS('src/test/**/*.js', 'dist/test')
})

gulp.task('test:compile', ['compile'], function(cb) {
compile('src/test/**/*.js', 'minio-test.js', 'dist/test', cb)
exports.browserify = gulp.series(compile, () => {
return browserify('./dist/main/minio.js', {
standalone: 'MinIO'
})
.bundle()
.on('error', (err) => console.log('Error : ' + err.message))
.pipe(fs.createWriteStream('./dist/main/minio-browser.js'))
})

gulp.task('test', ['compile', 'test:compile'], function() {
gulp.src('dist/test/**/*.js', {
exports.test = gulp.series(testCompile, () => {
return gulp.src('dist/test/**/*.js', {
read: false
})
.pipe(mocha({
reporter: 'spec',
ui: 'bdd',
}))
.once('error', () => {
process.exit(1);
})
.once('end', () => {
process.exit();
})
}).pipe(mocha({
exit: true,
reporter: 'spec',
ui: 'bdd',
}))
})

gulp.task('lint', function() {
gulp.src('src/**/*.js')
exports.lint = () => {
return gulp.src(['src/**/*.js', 'gulpfile.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
})
}

gulp.task('functional-test', ['compile'], function() {
compile('src/test/functional/*.js', 'functional', 'dist/test/functional/', function() {
gulp.src('dist/test/functional/*.js', {
read: false
})
.pipe(mocha({
reporter: 'spec',
ui: 'bdd',
}))
.once('error', () => {
process.exit(1);
})
.once('end', () => {
process.exit();
})
})
exports.functionalTest = gulp.series(testCompile, () => {
return gulp.src('dist/test/functional/*.js', {
read: false
}).pipe(mocha({
exit: true,
reporter: 'spec',
ui: 'bdd',
}))
})

function compile(src, name, dest, cb) {
gulp.src(src)
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dest))
.on('end', function() {
cb()
})
}
exports.compile = compile
exports.testCompile = testCompile
exports.default = gulp.series(exports.test, exports.browserify)
47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"compile": "gulp compile",
"test": "gulp test",
"prepublish": "gulp test",
"functional": "gulp functional-test",
"lint": "gulp lint",
"prepublishOnly": "gulp test",
"functional": "gulp functionalTest",
"browserify": "gulp browserify",
"prepare": "npm run compile"
},
Expand All @@ -21,7 +22,7 @@
"url": "https://min.io"
},
"engines": {
"node": ">= 0.10.0"
"node": ">= 4"
},
"license": "Apache-2.0",
"bugs": {
Expand All @@ -30,36 +31,36 @@
},
"homepage": "https://github.com/minio/minio-js#readme",
"dependencies": {
"async": "^1.5.2",
"block-stream2": "^1.0.0",
"concat-stream": "^1.4.8",
"es6-error": "^2.0.2",
"async": "^3.1.0",
"block-stream2": "^2.0.0",
"es6-error": "^4.1.1",
"json-stream": "^1.0.0",
"lodash": "^4.14.2",
"mime-types": "^2.1.14",
"mkdirp": "^0.5.1",
"querystring": "0.2.0",
"through2": "^0.6.5",
"uuid": "^3.1.0",
"through2": "^3.0.1",
"xml": "^1.0.0",
"xml2js": "^0.4.15"
},
"devDependencies": {
"browserify": "^12.0.1",
"chai": "^3.5.0",
"eslint": "^4.1.1",
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-eslint": "^4.0.0",
"gulp-mocha": "^2.1.0",
"gulp-notify": "^2.2.0",
"gulp-sourcemaps": "^1.5.2",
"mocha": "^2.3.2",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babelify": "^10.0.0",
"browserify": "^16.3.0",
"chai": "^4.2.0",
"eslint": "^6.1.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-eslint": "^6.0.0",
"gulp-mocha": "^6.0.0",
"gulp-sourcemaps": "^2.6.5",
"mocha": "^6.2.0",
"mocha-steps": "^1.1.0",
"nock": "^2.12.0",
"rewire": "^2.3.3",
"source-map-support": "^0.4.12",
"superagent": "^3.7.0"
"nock": "^10.0.6",
"source-map-support": "^0.5.13",
"superagent": "^5.1.0",
"uuid": "^3.3.2"
},
"keywords": [
"api",
Expand Down
2 changes: 1 addition & 1 deletion src/main/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function promisify(fn) {
// Reference https://tools.ietf.org/html/rfc3986#section-2.2
export function uriEscape(string) {
return string.split('').reduce((acc, elem) => {
let buf = new Buffer(elem)
let buf = Buffer.from(elem)
if (buf.length === 1) {
// length 1 indicates that elem is not a unicode character.
// Check if it is an unreserved characer.
Expand Down
8 changes: 4 additions & 4 deletions src/main/minio.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ export class Client {
// verify md5sum of each part
pipesetup(fs.createReadStream(filePath, options), hash)
.on('data', data => {
var md5sumHex = (new Buffer(data.md5sum, 'base64')).toString('hex')
var md5sumHex = (Buffer.from(data.md5sum, 'base64')).toString('hex')
if (part && (md5sumHex === part.etag)) {
//md5 matches, chunk already uploaded
partsDone.push({part: partNumber, etag: part.etag})
Expand Down Expand Up @@ -1073,7 +1073,7 @@ export class Client {
// s3 requires that all non-end chunks be at least `this.partSize`,
// so we chunk the stream until we hit either that size or the end before
// we flush it to s3.
let chunker = BlockStream2({size, zeroPadding: false})
let chunker = new BlockStream2({size, zeroPadding: false})

// This is a Writable stream that can be written to in order to upload
// to the specified bucket and object automatically.
Expand Down Expand Up @@ -1524,7 +1524,7 @@ export class Client {
this.makeRequest({method, bucketName, query}, '', 200, '', true, (e, response) => {
if (e) return cb(e)

let policy = new Buffer('')
let policy = Buffer.from('')
pipesetup(response, transformers.getConcater())
.on('data', data => policy = data)
.on('error', cb)
Expand Down Expand Up @@ -1712,7 +1712,7 @@ export class Client {
postPolicy.policy.conditions.push(["eq", "$x-amz-credential", this.accessKey + "/" + getScope(region, date)])
postPolicy.formData['x-amz-credential'] = this.accessKey + "/" + getScope(region, date)

var policyBase64 = new Buffer(JSON.stringify(postPolicy.policy)).toString('base64')
var policyBase64 = Buffer.from(JSON.stringify(postPolicy.policy)).toString('base64')

postPolicy.formData.policy = policyBase64

Expand Down
12 changes: 6 additions & 6 deletions src/test/functional/functional-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ describe('functional tests', function() {
var objectName = uuid.v4()

var _1byteObjectName = 'datafile-1-b'
var _1byte = dataDir ? fs.readFileSync(dataDir + '/' + _1byteObjectName) : (new Buffer(1)).fill(0)
var _1byte = dataDir ? fs.readFileSync(dataDir + '/' + _1byteObjectName) : Buffer.alloc(1, 0)

var _100kbObjectName = 'datafile-100-kB'
var _100kb = dataDir ? fs.readFileSync(dataDir + '/' + _100kbObjectName) : (new Buffer(100 * 1024)).fill(0)
var _100kb = dataDir ? fs.readFileSync(dataDir + '/' + _100kbObjectName) : Buffer.alloc(100 * 1024, 0)
var _100kbObjectNameCopy = _100kbObjectName + '-copy'

var _100kbObjectBufferName = `${_100kbObjectName}.buffer`
Expand All @@ -86,12 +86,12 @@ describe('functional tests', function() {
var _100kb1kboffsetmd5 = crypto.createHash('md5').update(_100kb.slice(1024)).digest('hex')

var _6mbObjectName = 'datafile-6-MB'
var _6mb = dataDir ? fs.readFileSync(dataDir + '/' + _6mbObjectName) : (new Buffer(6 * 1024 * 1024)).fill(0)
var _6mb = dataDir ? fs.readFileSync(dataDir + '/' + _6mbObjectName) : Buffer.alloc(6 * 1024 * 1024, 0)
var _6mbmd5 = crypto.createHash('md5').update(_6mb).digest('hex')
var _6mbObjectNameCopy = _6mbObjectName + '-copy'

var _5mbObjectName = 'datafile-5-MB'
var _5mb = dataDir ? fs.readFileSync(dataDir + '/' + _5mbObjectName) : (new Buffer(5 * 1024 * 1024)).fill(0)
var _5mb = dataDir ? fs.readFileSync(dataDir + '/' + _5mbObjectName) : Buffer.alloc(5 * 1024 * 1024, 0)
var _5mbmd5 = crypto.createHash('md5').update(_5mb).digest('hex')

var metaData = {
Expand Down Expand Up @@ -677,7 +677,7 @@ describe('functional tests', function() {
.catch(done)
})
step(`fGetObject(bucketName, objectName, filePath, callback)_bucketName:${bucketName}, objectName:${_5mbObjectName}, filePath:${localFile}`, done => {
var bufPart = new Buffer(_100kb.length)
var bufPart = Buffer.alloc(_100kb.length)
_5mb.copy(bufPart, 0, 0, _100kb.length)
var tmpFile = `${tmpDir}/${_5mbObjectName}.${etag}.part.minio`
// create a partial file
Expand Down Expand Up @@ -938,7 +938,7 @@ describe('functional tests', function() {
if (e) return done(e)
var req = superagent.post(data.postURL)
_.each(data.formData, (value, key) => req.field(key, value))
req.attach('file', new Buffer([_1byte]), 'test')
req.attach('file', Buffer.from([_1byte]), 'test')
req.end(function(e) {
if (e) return done(e)
done()
Expand Down

0 comments on commit a962efa

Please sign in to comment.