Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest dependencies #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ results
npm-debug.log
node_modules
coverage
.nyc_output/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from the istanbul->nyc change

21 changes: 21 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
node_modules
coverage
.jshintrc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from .gitignore, then adding a few things that probably shouldn't be in the tarfile sent to the npm repo.

.travis.yml
.nyc_output/
test/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some people really like their tests in the package, but if the goal here is "small and tight" then they should be excluded IMO.

CHANGES.md
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be totally fine if you prefer CHANGES.md in the npm package.

7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "6"
- "8"
- "10"
- "14"
- "16"
- "18"
- "19"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 90% sure that travis isn't going to run. Assuming it doesn't, I'd be happy to add GitHub actions to the repo.

17 changes: 17 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
TBD, Version 2.0.0
=========================

* Update truncate from 2.x to 3.x

* Update dev dependencies to latest

* Replace deprecated package istanbul with nyc

* Require Node.js 14+ (Breaking change)

* Travis: add Node.js 14,16,18,19 support, remove legacy versions

* Remove instances of deprecated `new Buffer`

* Ensure extraneous files are not bundled into package with .npmignore

2018-05-31, Version 1.0.6
=========================

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ uri = dataUri.encode('foo');
console.log(uri);
// data:text/plain;charset=UTF-8;base64,Zm9v

uri = dataUri.encode(new Buffer('<foo/>', 'utf8'), 'text/xml');
uri = dataUri.encode(Buffer.from('<foo/>', 'utf8'), 'text/xml');
console.log(uri);
// data:text/xml;base64,PGZvby8+
```
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function decode(uri) {
}

if (b64) {
result = new Buffer(body, 'base64');
result = Buffer.from(body, 'base64');
} else {
result = new Buffer(decodeURIComponent(body), 'ascii');
result = Buffer.from(decodeURIComponent(body), 'ascii');
}

result.mimetype = mimetype;
Expand All @@ -100,7 +100,7 @@ function encode(input, mediatype) {
buf = input;
mediatype = mediatype || 'application/octet-stream';
} else if (typeof(input) == 'string') {
buf = new Buffer(input, 'utf8');
buf = Buffer.from(input, 'utf8');
mediatype = mediatype || 'text/plain;charset=UTF-8';
} else {
// TODO: support streams?
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"main": "index.js",
"scripts": {
"pretest": "jshint *.js test",
"test": "istanbul test -- _mocha -R spec",
"posttest": "test -z $npm_config_coverage || istanbul report"
"test": "nyc -r lcov _mocha -R spec"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

istanbul is deprecated, as is npm_config_coverage, which doesn't get set anymore. nyc is fast enough that it doesn't add enough overhead to the test loop to matter.

},
"repository": {
"type": "git",
Expand All @@ -18,15 +17,15 @@
"email": "miroslav@strongloop.com"
},
"dependencies": {
"truncate": "^2.0.1"
"truncate": "^3.0.0"
},
"devDependencies": {
"mocha": "~1.17.1",
"jshint": "~2.4.3",
"istanbul": "~0.2.4",
"chai": "~1.8.1"
"chai": "~4.3.7",
"jshint": "~2.13.6",
"mocha": "~10.2.0",
"nyc": "15.1.0"
},
"engines": {
"node": ">=0.8.0"
"node": ">=14"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the breaking change, requiring a major version bump IMO. See https://github.com/nodejs/Release for justification.

}
}
4 changes: 2 additions & 2 deletions test/encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ var dataUri = require('..');

describe('encode', function() {
it('creates from buffer', function() {
var uri = dataUri.encode(new Buffer('foo', 'utf8'), 'text/plain');
var uri = dataUri.encode(Buffer.from('foo', 'utf8'), 'text/plain');
expect(uri).to.be.a('string');
expect(uri).to.equal('data:text/plain;base64,Zm9v');
});

it('creates from buffer with default mediatype', function() {
var uri = dataUri.encode(new Buffer('foo', 'utf8'));
var uri = dataUri.encode(Buffer.from('foo', 'utf8'));
expect(uri).to.be.a('string');
expect(uri).to.equal('data:application/octet-stream;base64,Zm9v');
});
Expand Down