Skip to content

Commit 9d60ab0

Browse files
committed
feat(nodeversions): now working for node 10 12 14
1 parent be4241c commit 9d60ab0

File tree

7 files changed

+2710
-31
lines changed

7 files changed

+2710
-31
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,6 @@ $RECYCLE.BIN/
192192
# Windows shortcuts
193193
*.lnk
194194

195-
# End of https://www.gitignore.io/api/node,linux,macos,windows,intellij
195+
# End of https://www.gitignore.io/api/node,linux,macos,windows,intellij
196+
197+
build*

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ os:
66

77
env:
88
matrix:
9-
- NODE_VERSION="10.15"
10-
- NODE_VERSION="8.6"
11-
- NODE_VERSION="6.11"
12-
- NODE_VERSION="4.4"
9+
- NODE_VERSION="14.12"
1310
include:
1411
- os: osx
15-
osx_image: xcode8.3
12+
osx_image: xcode12.2
1613

1714
before_install:
1815
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
@@ -31,10 +28,15 @@ before_install:
3128
- git config --global user.name "MatthD"
3229

3330
install:
34-
# - npm install --build-from-source
35-
- npm i nan
31+
- npm install
32+
- node-pre-gyp clean
3633
- node-pre-gyp configure --enable-build-type=release
3734
- node-pre-gyp build
35+
- mkdir -p Release/build/4 Release/build/5 Release/build/6 Release/build/7
36+
- mv build-tmp-napi-v4/Release/xml.node build/4/
37+
- mv build-tmp-napi-v5/Release/xml.node build/5/
38+
- mv build-tmp-napi-v6/Release/xml.node build/6/
39+
- mv build-tmp-napi-v7/Release/xml.node build/7/
3840
- node-pre-gyp package
3941

4042
script:

Readme.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Node-libxml has been thought differently than [libxmljs](https://github.com/libx
2828
- You want to validate against DTD / schema on multiple documents with just ONE dtd/schema loaded in memory (libxmljs loads it on each validation request), so it's clearly by far fastest!
2929

3030

31-
3231
## Install
3332

3433
```bash
@@ -158,3 +157,13 @@ A function of libxml to free all the memory taken by libxml2
158157
`TAKE nothing & RETURN nothin`
159158
free all memory in all instance in all fork using by libxml.
160159

160+
161+
## Contribute
162+
163+
### Install
164+
- `npm i`
165+
- then move the build-tmp-napi-*{anyversionyougot} as -> `mv build-tmp-napi-v7 build` __(for the moment I did not found how to build directly to buiuld forlder with pre-gyp for n-api)__
166+
- `npm test` should pass 😎
167+
168+
## Important notes
169+
Travis & appveyor cannot be used anymore with n-api because auto-publish from node-pre-gyp-github not working anymore + we have now n release for one node version

binding.gyp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
'MACOSX_DEPLOYMENT_TARGET': '10.7',
2828
'OTHER_CFLAGS': [ '-Wall' ]
2929
},
30+
'defines': [
31+
'NAPI_VERSION=<(napi_build_version)',
32+
],
3033
'sources': [
3134
'libxml.cpp',
3235
'libxml-syntax-error.cpp',

libxml.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,23 @@ Napi::Value Libxml::loadXml(const Napi::CallbackInfo &info)
5454
Napi::TypeError::New(env, "loadXml requires at least 1 argument").ThrowAsJavaScriptException();
5555
return Napi::Boolean::New(env, false);
5656
}
57-
cout << "before libxml" << endl;
5857
int options;
5958
options = (XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NONET);
60-
cout << "after libxml 1" << endl;
6159
Napi::Array errors = Napi::Array::New(env);
6260
xmlResetLastError();
6361
XmlSyntaxError::env = &env;
6462
xmlSetStructuredErrorFunc(reinterpret_cast<void*>(&errors),
6563
XmlSyntaxError::PushToArray);
6664
if (this->docPtr != nullptr)
6765
{
68-
cout << "after libxml 2" << endl;
6966
xmlFreeDoc(this->docPtr);
7067
this->docPtr = nullptr;
7168
}
72-
cout << "after libxml 3" << endl;
7369
Napi::String path = info[0].As<Napi::String>();
7470
this->path = path.ToString();
75-
cout << "after libxml 4" << endl;
76-
cout << this->path.c_str() << endl;
7771
const char *pathToRead = this->path.c_str();
7872
this->docPtr = xmlReadFile(pathToRead, NULL, options);
79-
cout << "after libxml 5" << endl;
8073
xmlSetStructuredErrorFunc(NULL, NULL);
81-
cout << "after libxml 6" << endl;
8274
if (this->docPtr == NULL)
8375
{
8476
this->Value().Set("wellformedErrors", errors);
@@ -513,4 +505,4 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
513505
}
514506

515507
// Register and initialize native add-on
516-
NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init)
508+
NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init)

0 commit comments

Comments
 (0)