Skip to content
Merged
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
32 changes: 15 additions & 17 deletions .github/workflows/prebuild-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,40 @@ jobs:
sudo dpkg --add-architecture i386
sudo apt-get update -y -qq
sudo apt-get install -y g++-multilib gcc-multilib libcups2-dev libcups2-dev:i386 libc6-dev-i386 linux-libc-dev linux-libc-dev:i386
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/checkout@v1
node-version: 20.x
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild
run: |
npm run apply-patches
npm run prebuild -- --strip --all --arch ia32 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --all --arch x64 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --arch ia32 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --arch x64 -u ${{ secrets.PREBUILD_TOKEN }}
prebuild-macos:
name: Prebuild Binaries for macOS
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/checkout@v1
node-version: 20.x
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild
run: |
npm run apply-patches
npm run prebuild -- --strip --all --arch x64 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --arch x64 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --arch arm64 -u ${{ secrets.PREBUILD_TOKEN }}
prebuild-windows:
name: Prebuild Binaries for Windows
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/checkout@v1
node-version: 20.x
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild
run: |
npm run apply-patches
npm run prebuild -- --strip --all --arch ia32 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --all --arch x64 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --arch ia32 -u ${{ secrets.PREBUILD_TOKEN }}
npm run prebuild -- --strip --arch x64 -u ${{ secrets.PREBUILD_TOKEN }}
32 changes: 15 additions & 17 deletions .github/workflows/prebuild-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,40 @@ jobs:
sudo dpkg --add-architecture i386
sudo apt-get update -y -qq
sudo apt-get install -y g++-multilib gcc-multilib libcups2-dev libcups2-dev:i386 libc6-dev-i386 linux-libc-dev linux-libc-dev:i386
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/checkout@v1
node-version: 20.x
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild
run: |
npm run apply-patches
npm run prebuild -- --strip --all --arch ia32
npm run prebuild -- --strip --all --arch x64
npm run prebuild -- --strip --arch ia32
npm run prebuild -- --strip --arch x64
prebuild-macos:
name: Prebuild Binaries for macOS
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/checkout@v1
node-version: 20.x
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild
run: |
npm run apply-patches
npm run prebuild -- --strip --all --arch x64
npm run prebuild -- --strip --arch x64
npm run prebuild -- --strip --arch arm64
prebuild-windows:
name: Prebuild Binaries for Windows
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/checkout@v1
node-version: 20.x
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild
run: |
npm run apply-patches
npm run prebuild -- --strip --all --arch ia32
npm run prebuild -- --strip --all --arch x64
npm run prebuild -- --strip --arch ia32
npm run prebuild -- --strip --arch x64
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ node_modules
*.swp
*.log
prebuilds
.prebuildrc
.prebuildrc
.idea
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Native bind printers on POSIX and Windows OS from Node.js, electron and node-web

[![npm version](https://badge.fury.io/js/@thiagoelg%2Fnode-printer.svg)](https://www.npmjs.com/package/@thiagoelg/node-printer) [![Prebuild Binaries and Publish](https://github.com/thiagoelg/node-printer/actions/workflows/prebuild-main.yml/badge.svg)](https://github.com/thiagoelg/node-printer/actions/workflows/prebuild-main.yml)

> Now compatible with Node.js 20+ with improved native bindings and updated dependencies
> Now compatible with Node.js 20+ and Electron 33+ with improved native bindings and updated dependencies

> It just works with Node 12 because of @thiagoelg in his [PR](https://github.com/tojocky/node-printer/pull/261)

Expand Down
8 changes: 6 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
'include_dirs' : [
"<!(node -e \"require('nan')\")"
],
'cflags_cc+': [
'cflags_cc': [
"-DNOMINMAX",
"-Wno-deprecated-declarations"
],
'conditions': [
Expand All @@ -35,7 +36,10 @@
['OS!="win"', {
'sources/': [['exclude', '_win\\.cc$']]}, {
# else if OS==win, exclude also posix files
'sources/': [['exclude', '_posix\\.cc$']]
'sources/': [['exclude', '_posix\\.cc$']],
'defines': [
'NOMINMAX'
]
}],
# specific settings
['OS!="win"', {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@
"nodeunit": "^0.11.3",
"prebuild": "^13.0.1",
"prebuild-ci": "^4.0.0",
"node-abi": "^3.52.0",
"patch-package": "^8.0.0"
"node-abi": "^3.56.0"
},
"engines": {
"node": ">= 20.0.0"
},
"scripts": {
"install": "prebuild-install || node-gyp rebuild",
"apply-patches": "patch-package",
"prebuild-all": "prebuild --all --force --strip --verbose --openssl_fips=X",
"prebuild": "prebuild",
"prebuild-electron": "prebuild --strip --verbose",
"rebuild": "node-gyp rebuild",
"test": "nodeunit test"
},
Expand Down
13 changes: 0 additions & 13 deletions patches/node-abi+3.8.0.patch

This file was deleted.

26 changes: 13 additions & 13 deletions src/node_printer_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ namespace{
* @param iSizeKbytes size in bytes of required allocating memory
*/
MemValue(const DWORD iSizeKbytes) {
_value = (Type*)malloc(iSizeKbytes);
this->_value = (Type*)malloc(iSizeKbytes);
}

~MemValue () {
free();
}
protected:
virtual void free() {
if(_value != NULL)
if(this->_value != NULL)
{
::free(_value);
_value = NULL;
::free(this->_value);
this->_value = NULL;
}
}
};
Expand Down Expand Up @@ -218,11 +218,11 @@ namespace{
//LPTSTR pPrinterName;
ADD_V8_STRING_PROPERTY(name, pPrinterName)
//LPTSTR pPrinterName;
ADD_V8_STRING_PROPERTY(printerName, pPrinterName);
ADD_V8_STRING_PROPERTY(printerName, pPrinterName)
//LPTSTR pUserName;
ADD_V8_STRING_PROPERTY(user, pUserName);
ADD_V8_STRING_PROPERTY(user, pUserName)
//LPTSTR pDatatype;
ADD_V8_STRING_PROPERTY(format, pDatatype);
ADD_V8_STRING_PROPERTY(format, pDatatype)
//DWORD Priority;
Nan::Set(result_printer_job, V8_STRING_NEW_UTF8("priority"), V8_VALUE_NEW(Number, job->Priority));
//DWORD Size;
Expand All @@ -246,17 +246,17 @@ namespace{

// Specific fields
//LPTSTR pMachineName;
ADD_V8_STRING_PROPERTY(machineName, pMachineName);
ADD_V8_STRING_PROPERTY(machineName, pMachineName)
//LPTSTR pDocument;
ADD_V8_STRING_PROPERTY(document, pDocument);
ADD_V8_STRING_PROPERTY(document, pDocument)
//LPTSTR pNotifyName;
ADD_V8_STRING_PROPERTY(notifyName, pNotifyName);
ADD_V8_STRING_PROPERTY(notifyName, pNotifyName)
//LPTSTR pPrintProcessor;
ADD_V8_STRING_PROPERTY(printProcessor, pPrintProcessor);
ADD_V8_STRING_PROPERTY(printProcessor, pPrintProcessor)
//LPTSTR pParameters;
ADD_V8_STRING_PROPERTY(parameters, pParameters);
ADD_V8_STRING_PROPERTY(parameters, pParameters)
//LPTSTR pDriverName;
ADD_V8_STRING_PROPERTY(driverName, pDriverName);
ADD_V8_STRING_PROPERTY(driverName, pDriverName)
#undef ADD_V8_STRING_PROPERTY
//LPDEVMODE pDevMode;
//PSECURITY_DESCRIPTOR pSecurityDescriptor;
Expand Down