Skip to content

Commit 3d4c442

Browse files
authored
Merge pull request #180 from mapbox/v0.8.0
Adds support for node16
2 parents 0af71f6 + 8faffea commit 3d4c442

11 files changed

Lines changed: 2487 additions & 464 deletions

File tree

.travis.yml

Lines changed: 51 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
dist: focal
12
language: node_js
23

34
sudo: false
45

56
# enable c++11/14 builds
67
addons:
78
apt:
8-
sources: [ 'ubuntu-toolchain-r-test' ]
9-
packages: [ 'libstdc++-4.9-dev' ]
9+
sources:
10+
- sourceline: "ppa:ubuntu-toolchain-r/test"
11+
packages:
12+
- "libstdc++-9-dev"
1013

1114
install:
1215
# set up the environment by installing mason and clang++
@@ -27,70 +30,39 @@ install:
2730
# For this reason, we disable the 'script' section below, since we prefer using 'before_script'.
2831
before_script:
2932
- npm test
30-
# after successful tests, publish binaries if specified in commit message
31-
- ./scripts/publish.sh --toolset=${TOOLSET:-} --debug=$([ "${BUILDTYPE}" == 'debug' ] && echo "true" || echo "false")
3233

3334
# We set 'script' here to an empty array to prevent this section from automatically running 'npm test'
3435
# The reason we do this is mentioned above in the comment about the 'before_script' stage.
3536
# For reference, the default travis behavior which we override comes from https://github.com/travis-ci/travis-build/blob/e5a45cbf49e0d9e27398e76e5f25dd7706feb6aa/lib/travis/build/script/node_js.rb#L62-L69.
3637
script:
3738

38-
# the matrix allows you to specify different operating systems and environments to
39-
# run your tests and build binaries
40-
matrix:
41-
include:
42-
# linux publishable node v8
43-
- os: linux
44-
env: BUILDTYPE=release
45-
node_js: 8
46-
# linux publishable node v8/debug
47-
- os: linux
48-
env: BUILDTYPE=debug
49-
node_js: 8
50-
# linux publishable node v10
51-
- os: linux
52-
env: BUILDTYPE=release
53-
node_js: 10
54-
# linux publishable node v10/debug
55-
- os: linux
56-
env: BUILDTYPE=debug
57-
node_js: 10
58-
# linux publishable node v12
59-
- os: linux
60-
env: BUILDTYPE=release
61-
node_js: 12
62-
# linux publishable node v10/debug
63-
- os: linux
64-
env: BUILDTYPE=debug
65-
node_js: 14
66-
# linux publishable node v14
67-
- os: linux
68-
env: BUILDTYPE=release
69-
node_js: 14
70-
# linux publishable node v10/debug
71-
- os: linux
72-
env: BUILDTYPE=debug
73-
node_js: 12
74-
# osx publishable node v8
75-
- os: osx
76-
osx_image: xcode11
77-
env: BUILDTYPE=release
78-
node_js: 8
79-
# osx publishable node v10
80-
- os: osx
81-
osx_image: xcode11
82-
env: BUILDTYPE=release
83-
node_js: 10
84-
# osx publishable node v12
85-
- os: osx
86-
osx_image: xcode11
87-
env: BUILDTYPE=release
88-
node_js: 12
89-
# osx publishable node v12
39+
# Node versions for the job matrix
40+
node_js:
41+
- 8
42+
- 10
43+
- 12
44+
- 14
45+
- 16
46+
47+
# Env variables for the job matrix
48+
env:
49+
- BUILDTYPE=debug
50+
- BUILDTYPE=release
51+
52+
# OS for build
53+
os:
54+
- linux
55+
- osx
56+
57+
osx_image:
58+
- xcode11
59+
60+
# Build all binaries and if all succeed then publish based on the commit message
61+
jobs:
62+
exclude:
9063
- os: osx
91-
osx_image: xcode11
92-
env: BUILDTYPE=release
93-
node_js: 14
64+
env: BUILDTYPE=debug
65+
include:
9466
# Sanitizer build node v10/Debug
9567
- os: linux
9668
env: BUILDTYPE=debug TOOLSET=asan
@@ -120,15 +92,15 @@ matrix:
12092
- os: linux
12193
# Note: -fext-numeric-literals is needed to workaround gcc bug:
12294
# boost/math/constants/constants.hpp:269:3: error: unable to find numeric literal operator 'operatorQ'
123-
env: BUILDTYPE=debug CXX="g++-6" CC="gcc-6" CXXFLAGS="-fext-numeric-literals"
95+
env: BUILDTYPE=debug CXX="g++-9" CC="gcc-9" CXXFLAGS="-fext-numeric-literals"
12496
node_js: 10
12597
addons:
12698
apt:
12799
sources:
128-
- ubuntu-toolchain-r-test
100+
- sourceline: "ppa:ubuntu-toolchain-r/test"
129101
packages:
130-
- libstdc++-6-dev
131-
- g++-6
102+
- libstdc++-9-dev
103+
- g++-9
132104
# Overrides `install` to avoid initializing clang toolchain
133105
install:
134106
- make ${BUILDTYPE}
@@ -176,3 +148,19 @@ matrix:
176148
# - make tidy
177149
# # Overrides `script`, no need to run tests
178150
# before_script:
151+
- stage: publish
152+
name: "Publish Darwin Release"
153+
script: ./scripts/publish.sh --debug=false
154+
env: BUILDTYPE=release
155+
node_js: 16
156+
os: osx
157+
- name: "Publish Linux Release"
158+
script: ./scripts/publish.sh --debug=false
159+
env: BUILDTYPE=release
160+
node_js: 16
161+
os: linux
162+
- name: "Publish Debug"
163+
script: ./scripts/publish.sh --debug=true
164+
env: BUILDTYPE=debug
165+
node_js: 16
166+
os: linux

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.7.0
2+
3+
- Adds node v16 support
4+
- Updates vulnerable dependencies
5+
16
# 0.6.0
27

38
- Adds node v12 and v14 support

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ See also [TinySDF](https://github.com/mapbox/tiny-sdf), which is a faster but le
1717
By default, installs binaries. On these platforms no external dependencies are needed.
1818

1919
- 64 bit OS X or 64 bit Linux
20-
- Node.js v8-v14
20+
- Node.js v8-v16
2121

2222
Just run:
2323

bench/bench.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var path = require('path');
44
var fontnik = require('../');
5-
var queue = require('queue-async');
5+
var { queue } = require('d3-queue');
66
var fs = require('fs');
77

88
// https://gist.github.com/mourner/96b1335c6a43e68af252
@@ -12,15 +12,15 @@ function now() {
1212
return hr[0] + hr[1] / 1e9;
1313
}
1414

15-
function bench(opts,cb) {
15+
function bench(opts, cb) {
1616
var q = queue(opts.concurrency);
1717
var start = now();
1818
for (var i = 1; i <= opts.iterations; i++) {
19-
q.defer.apply({},opts.args);
19+
q.defer.apply({}, opts.args);
2020
}
21-
q.awaitAll(function(error, results) {
21+
q.awaitAll(function (error, results) {
2222
var seconds = now() - start;
23-
console.log(opts.name, Math.round(opts.iterations / (seconds)),'ops/sec',opts.iterations,opts.concurrency);
23+
console.log(opts.name, Math.round(opts.iterations / (seconds)), 'ops/sec', opts.iterations, opts.concurrency);
2424
return cb();
2525
});
2626
}
@@ -30,18 +30,18 @@ function main() {
3030

3131
var suite = queue(1);
3232
suite.defer(bench, {
33-
name:"fontnik.load",
34-
args:[fontnik.load,opensans],
33+
name: "fontnik.load",
34+
args: [fontnik.load, opensans],
3535
iterations: 10,
3636
concurrency: 10
3737
});
3838
suite.defer(bench, {
39-
name:"fontnik.range",
40-
args:[fontnik.range,{font:opensans,start:0,end:256}],
39+
name: "fontnik.range",
40+
args: [fontnik.range, { font: opensans, start: 0, end: 256 }],
4141
iterations: 1000,
4242
concurrency: 100
4343
});
44-
suite.awaitAll(function(err) {
44+
suite.awaitAll(function (err) {
4545
if (err) throw err;
4646
})
4747
}

bin/build-glyphs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var fontnik = require('../index.js');
44
var path = require('path');
55
var fs = require('fs');
6-
var queue = require('queue-async');
6+
var { queue } = require('d3-queue');
77

88
if (process.argv.length !== 4) {
99
console.log('Usage:');
@@ -33,7 +33,7 @@ for (var i = 0; i < 65536; (i = i + 256)) {
3333
}
3434

3535
function writeGlyphs(opts, done) {
36-
fontnik.range(opts, function(err, zdata) {
36+
fontnik.range(opts, function (err, zdata) {
3737
if (err) {
3838
console.warn(err.toString());
3939
process.exit(1);

bin/font-inspect

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var path = require('path');
44
var fs = require('fs');
5-
var queue = require('queue-async');
5+
var { queue } = require('d3-queue');
66
var glob = require('glob');
77
var argv = require('minimist')(process.argv.slice(2), {
88
boolean: ['verbose', 'help']
@@ -28,9 +28,9 @@ if (argv.face) {
2828
} else {
2929
var register = path.resolve(argv.register);
3030
var pattern = '+(*ttf|*otf)';
31-
faces = glob.sync(pattern,{nodir:true, cwd:register, matchBase:true});
32-
faces = faces.map(function(f) {
33-
return path.join(register,f);
31+
faces = glob.sync(pattern, { nodir: true, cwd: register, matchBase: true });
32+
faces = faces.map(function (f) {
33+
return path.join(register, f);
3434
})
3535
}
3636

@@ -42,9 +42,9 @@ if (argv.verbose) {
4242
var q = queue();
4343

4444
function getCoverage(face, cb) {
45-
fs.readFile(face, function(err, res) {
45+
fs.readFile(face, function (err, res) {
4646
if (err) return cb(err);
47-
fontnik.load(res, function(err, faces) {
47+
fontnik.load(res, function (err, faces) {
4848
if (err) return cb(err);
4949
return cb(null, {
5050
face: [faces[0].family_name, faces[0].style_name].join(' '),
@@ -54,9 +54,9 @@ function getCoverage(face, cb) {
5454
});
5555
}
5656

57-
faces.forEach(function(f) { q.defer(getCoverage, f) });
57+
faces.forEach(function (f) { q.defer(getCoverage, f) });
5858

59-
q.awaitAll(function(err, res) {
59+
q.awaitAll(function (err, res) {
6060
if (err) throw err;
6161
process.stdout.write(JSON.stringify(res, null, 2));
6262
});

binding.gyp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
'compiler_checks': [
1717
'-Wall',
1818
'-Wextra',
19-
'-Weffc++',
2019
'-Wconversion',
2120
'-pedantic-errors',
2221
'-Wconversion',

common.gypi

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22
'target_defaults': {
33
'default_configuration': 'Release',
44
'cflags_cc' : [
5-
'-std=c++14',
6-
# The assumption is that projects based on node-cpp-skel will also
7-
# depend on mason packages. Currently (this will change in future mason versions)
8-
# mason packages default to being built/linked with the CXX11_ABI=0.
9-
# So we need to link this way too. This allows source
10-
# compiling your module on any ubuntu version, even the latest
11-
# where the CXX11_ABI default has flipped to 1
12-
# More details at https://github.com/mapbox/mason/issues/319
13-
'-D_GLIBCXX_USE_CXX11_ABI=0'
5+
'-std=c++14'
146
],
157
'cflags_cc!': ['-std=gnu++0x','-fno-rtti', '-fno-exceptions'],
168
'configurations': {

0 commit comments

Comments
 (0)