Skip to content
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
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
version: 2
updates:
- package-ecosystem: github-actions
directory: /
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
22 changes: 16 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
name: 'Continuous Integration'
on: push
on: [push, pull_request]
jobs:
unit-tests:
runs-on: '${{ matrix.os }}'
continue-on-error: ${{ matrix.status != 'current' }}
strategy:
fail-fast: false
matrix:
status: ['current']
os:
- ubuntu-20.04
- ubuntu-22.04
node-version:
- 12.x
- 14.x
- 16.x
- 18.x
- 20.x
- 22.x
- 23.x
include:
- os: ubuntu-20.04
node-version: 8.x
status: 'deprecated'
- os: ubuntu-20.04
node-version: 10.x
status: 'deprecated'
- os: ubuntu-24.04-arm
node-version: 22.x
status: 'current'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: 'Install apt packages'
shell: bash
run: |
sudo apt-get update
sudo apt-get install curl autoconf automake libtool pkg-config
sudo apt-get install build-essential curl autoconf automake libtool pkg-config
- name: 'Create working directories'
shell: bash
run: |
Expand All @@ -39,11 +47,13 @@ jobs:
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure --datadir=/data --prefix=/deps --bindir=/deps || cat config.log
CONFIGURE_FLAGS=(--datadir=/data --prefix=/deps --bindir=/deps)
if [[ $(uname -m) =~ ^(aarch64|arm64)?$ ]]; then CONFIGURE_FLAGS+=(--disable-sse2); fi
./configure "${CONFIGURE_FLAGS[@]}" || cat config.log
make -j4
make install
- name: 'Install node.js ${{ matrix.node-version }}'
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node-version }}'
- name: 'Install node-postal'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-postal",
"version": "1.1.1",
"version": "1.2.0",
"author": "Al Barrentine (@thatdatabaseguy)",
"description": "International address parsing/normalization at C speed",
"main": "index.js",
Expand All @@ -24,7 +24,7 @@
},
"dependencies": {
"bindings": "^1.5.0",
"nan": "^2.14.0"
"nan": "^2.22.0"
},
"devDependencies": {
"mocha": "^7.1.1",
Expand Down
14 changes: 10 additions & 4 deletions src/expand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ void ExpandAddress(const Nan::FunctionCallbackInfo<v8::Value>& info) {
for (i = 0; i < num_expansions; i++) {
v8::Local<v8::String> e = Nan::New(expansions[i]).ToLocalChecked();
ret->Set(context, i, e);
free(expansions[i]);
}
free(expansions);

// Free expansions
libpostal_expansion_array_destroy(expansions, num_expansions);

info.GetReturnValue().Set(ret);
}
Expand All @@ -133,8 +134,13 @@ static void cleanup(void*) {
}

void init(v8::Local<v8::Object> exports) {
v8::Local<v8::Context> context = exports->CreationContext();

// Check Node.js version
#if NODE_MAJOR_VERSION >= 16
v8::Local<v8::Context> context = exports->GetCreationContext().ToLocalChecked();
#else
v8::Local<v8::Context> context = exports->CreationContext();
#endif

if (!libpostal_setup() || !libpostal_setup_language_classifier()) {
Nan::ThrowError("Could not load libpostal");
return;
Expand Down
7 changes: 6 additions & 1 deletion src/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ static void cleanup(void*) {
}

void init(v8::Local<v8::Object> exports) {
v8::Local<v8::Context> context = exports->CreationContext();
// Check Node.js version
#if NODE_MAJOR_VERSION >= 16
v8::Local<v8::Context> context = exports->GetCreationContext().ToLocalChecked();
#else
v8::Local<v8::Context> context = exports->CreationContext();
#endif

if (!libpostal_setup() || !libpostal_setup_parser()) {
Nan::ThrowError("Could not load libpostal");
Expand Down