diff --git a/.gitignore b/.gitignore index e920c16..8f9ef6c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ node_modules # Optional REPL history .node_repl_history + +# Lockfile +package-lock.json diff --git a/example.js b/example.js index d135044..49c9e6c 100644 --- a/example.js +++ b/example.js @@ -1,3 +1,7 @@ +'use strict' + +/* eslint-disable no-console */ + const http = require('http') const IPFSMultipart = require('.') diff --git a/package.json b/package.json index cd42219..e59636b 100644 --- a/package.json +++ b/package.json @@ -3,15 +3,17 @@ "version": "0.1.0", "description": "A set of utilities to help dealing with IPFS multipart.", "leadMaintainer": "Hugo Dias ", - "main": "lib/index.js", + "main": "src/index.js", "scripts": { - "test": "mocha test/index.js", - "lint": "standard --verbose | snazzy" + "lint": "aegir lint", + "build": "aegir build", + "test": "aegir test -t node", + "release": "aegir release --target node", + "release-minor": "aegir release --type minor --target node", + "release-major": "aegir release --type major --target node", + "coverage": "aegir coverage", + "coverage-publish": "aegir coverage --provider codecov" }, - "pre-commit": [ - "test", - "lint" - ], "repository": { "type": "git", "url": "git+https://github.com/xicombd/ipfs-multipart.git" @@ -28,16 +30,13 @@ }, "homepage": "https://github.com/xicombd/ipfs-multipart#readme", "devDependencies": { - "chai": "^3.5.0", + "aegir": "^14.0.0", + "chai": "^4.1.2", "ipfs-api": "github:ipfs/js-ipfs-api#1fd9749", - "mocha": "^2.4.5", - "pre-commit": "^1.1.2", - "request": "^2.69.0", - "snazzy": "^3.0.0", - "standard": "^6.0.7" + "request": "^2.87.0" }, "dependencies": { - "content": "^3.0.0", - "dicer": "^0.2.5" + "content": "^4.0.5", + "dicer": "~0.2.5" } } diff --git a/lib/index.js b/src/index.js similarity index 95% rename from lib/index.js rename to src/index.js index 279e0bf..bfc1e31 100644 --- a/lib/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ +'use strict' + const content = require('content') const Parser = require('./parser') diff --git a/lib/parser.js b/src/parser.js similarity index 97% rename from lib/parser.js rename to src/parser.js index 00118c2..045e739 100644 --- a/lib/parser.js +++ b/src/parser.js @@ -16,7 +16,7 @@ const parseDisposition = (disposition) => { const details = {} details.type = disposition.split(';')[0] if (details.type === 'file' || details.type === 'form-data') { - const namePattern = /\ filename=\"(.[^\"]+)\"/ + const namePattern = / filename="(.[^"]+)"/ const matches = disposition.match(namePattern) details.name = matches ? matches[1] : '' } diff --git a/test/index.js b/test/node.js similarity index 94% rename from test/index.js rename to test/node.js index 489aaa7..7f91264 100644 --- a/test/index.js +++ b/test/node.js @@ -1,4 +1,7 @@ +'use strict' + /* eslint-env mocha */ + const fs = require('fs') describe('multipart', () => { diff --git a/test/parser.js b/test/parser.js index a36adb4..fa28f17 100644 --- a/test/parser.js +++ b/test/parser.js @@ -1,6 +1,8 @@ -/* eslint-env mocha */ 'use strict' +/* eslint-env mocha */ +/* eslint-disable no-unused-expressions */ + const expect = require('chai').expect const APIctl = require('ipfs-api') const http = require('http') @@ -187,7 +189,7 @@ describe('parser', () => { }) it('parses ctl.add buffer correctly', (done) => { - ctl.add(new Buffer('hello world'), (err, res) => { + ctl.add(Buffer.from('hello world'), (err, res) => { expect(err).to.not.exist expect(files.length).to.equal(1)