nwinread 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +64 -0
- package/NAPI-SETUP.md +179 -27
- package/README.md +61 -11
- package/index.js +1 -25
- package/package.json +7 -6
- package/prebuilds/win32-x64/nwinread.node +0 -0
- package/scripts/verify-setup.js +2 -1
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Contributing to nwinread
|
|
2
|
+
|
|
3
|
+
¡Gracias por tu interés en contribuir a **nwinread**!
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start for Contributors
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Fork & Clone
|
|
9
|
+
git clone https://github.com/your-username/nwinread.git
|
|
10
|
+
cd nwinread
|
|
11
|
+
|
|
12
|
+
# 2. Setup Development Environment
|
|
13
|
+
npm install
|
|
14
|
+
npm run build
|
|
15
|
+
npm test
|
|
16
|
+
|
|
17
|
+
# 3. Verify Setup
|
|
18
|
+
npm run verify
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 📋 Development Workflow
|
|
22
|
+
|
|
23
|
+
1. **Make your changes** to the C++ code in `native/` or JavaScript in `index.js`
|
|
24
|
+
2. **Test locally**: `npm run build && npm test`
|
|
25
|
+
3. **Generate prebuilds**: `npm run prebuildify` (optional)
|
|
26
|
+
4. **Submit PR** with clear description
|
|
27
|
+
|
|
28
|
+
## 🔧 Available Scripts
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run build # Compile native module locally
|
|
32
|
+
npm run prebuildify # Generate precompiled binary for current platform
|
|
33
|
+
npm run clean # Clean build artifacts
|
|
34
|
+
npm test # Run functionality tests
|
|
35
|
+
npm run verify # Comprehensive setup verification
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 📚 Documentation
|
|
39
|
+
|
|
40
|
+
For detailed information about:
|
|
41
|
+
- **N-API setup and configuration** → See [NAPI-SETUP.md](NAPI-SETUP.md)
|
|
42
|
+
- **Release process and CI/CD** → See [NAPI-SETUP.md](NAPI-SETUP.md)
|
|
43
|
+
- **Supported Node.js versions** → See [README.md](README.md)
|
|
44
|
+
|
|
45
|
+
## 🐛 Reporting Issues
|
|
46
|
+
|
|
47
|
+
When reporting issues, please include:
|
|
48
|
+
- Node.js version (`node --version`)
|
|
49
|
+
- Windows version
|
|
50
|
+
- Error message and stack trace
|
|
51
|
+
- Minimal reproduction code
|
|
52
|
+
|
|
53
|
+
## 💡 Feature Requests
|
|
54
|
+
|
|
55
|
+
Feel free to suggest new features via GitHub Issues. Popular requests:
|
|
56
|
+
- Support for additional event log channels
|
|
57
|
+
- Performance optimizations
|
|
58
|
+
- Additional filtering options
|
|
59
|
+
|
|
60
|
+
## 🙏 Questions?
|
|
61
|
+
|
|
62
|
+
- Check existing issues
|
|
63
|
+
- Read [NAPI-SETUP.md](NAPI-SETUP.md) for technical details
|
|
64
|
+
- Open a discussion for general questions
|
package/NAPI-SETUP.md
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
# Guía de Binarios Universales con N-API
|
|
2
2
|
|
|
3
|
-
Este documento explica cómo se configuró **nwinread** para distribuir binarios universales usando N-API y prebuildify.
|
|
3
|
+
Este documento explica cómo se configuró **nwinread** para distribuir binarios universales usando N-API, node-gyp-build y prebuildify.
|
|
4
4
|
|
|
5
5
|
## ✨ ¿Qué se logró?
|
|
6
6
|
|
|
7
7
|
- **Binarios Universales**: Compatible con múltiples versiones de Node.js sin recompilación
|
|
8
8
|
- **Distribución Precompilada**: Los usuarios no necesitan herramientas de compilación
|
|
9
9
|
- **CI/CD Automatizado**: GitHub Actions compila binarios para múltiples plataformas
|
|
10
|
-
- **Carga Inteligente**:
|
|
10
|
+
- **Carga Inteligente**: `node-gyp-build` maneja automáticamente la selección de binarios
|
|
11
|
+
- **Soporte Amplio**: Node.js 16+ con binarios precompilados, 10+ con compilación local
|
|
12
|
+
|
|
13
|
+
## 📊 Versiones de Node.js Soportadas
|
|
14
|
+
|
|
15
|
+
### ✅ **Soporte Principal (Binarios Precompilados)**
|
|
16
|
+
| Node.js | N-API | Estado | Instalación |
|
|
17
|
+
|---------|--------|--------|-------------|
|
|
18
|
+
| 16.x | 8 | ✅ LTS | Instantánea |
|
|
19
|
+
| 18.x | 8-9 | ✅ LTS | Instantánea |
|
|
20
|
+
| 20.x | 8-9 | ✅ LTS | Instantánea |
|
|
21
|
+
| 22.x | 8-9 | ✅ Current | Instantánea |
|
|
22
|
+
|
|
23
|
+
### ⚠️ **Soporte Retrocompatible (Compilación Local)**
|
|
24
|
+
| Node.js | N-API | Estado | Instalación |
|
|
25
|
+
|---------|--------|--------|-------------|
|
|
26
|
+
| 10.x-14.x | 3-7 | ⚠️ EOL | Requiere Build Tools |
|
|
11
27
|
|
|
12
28
|
## 🏗️ Configuración Implementada
|
|
13
29
|
|
|
14
|
-
### 1. Package.json
|
|
30
|
+
### 1. Package.json Configuración Actual
|
|
15
31
|
```json
|
|
16
32
|
{
|
|
17
33
|
"dependencies": {
|
|
18
|
-
"node-
|
|
34
|
+
"node-gyp-build": "^4.8.0"
|
|
19
35
|
},
|
|
20
36
|
"devDependencies": {
|
|
37
|
+
"node-addon-api": "^8.0.0",
|
|
21
38
|
"prebuildify": "^6.0.0",
|
|
22
39
|
"prebuildify-cross": "^5.0.0"
|
|
23
40
|
},
|
|
@@ -25,6 +42,7 @@ Este documento explica cómo se configuró **nwinread** para distribuir binarios
|
|
|
25
42
|
"napi_versions": [3, 4, 5, 6, 7, 8, 9]
|
|
26
43
|
},
|
|
27
44
|
"scripts": {
|
|
45
|
+
"install": "node-gyp-build",
|
|
28
46
|
"prebuildify": "prebuildify --napi --strip",
|
|
29
47
|
"prebuild": "npm run prebuildify",
|
|
30
48
|
"prepublishOnly": "npm run prebuild"
|
|
@@ -32,45 +50,179 @@ Este documento explica cómo se configuró **nwinread** para distribuir binarios
|
|
|
32
50
|
}
|
|
33
51
|
```
|
|
34
52
|
|
|
53
|
+
**Cambios Clave:**
|
|
54
|
+
- ✅ `node-gyp-build` como dependencia principal (carga automática)
|
|
55
|
+
- ✅ `node-addon-api` movido a devDependencies
|
|
56
|
+
- ✅ Script `install` para manejo automático de binarios
|
|
57
|
+
- ❌ Removido `gypfile: true` (causaba compilación forzada)
|
|
58
|
+
|
|
35
59
|
### 2. Binding.gyp Optimizado
|
|
36
60
|
- Configuración N-API con `NAPI_VERSION=8`
|
|
37
61
|
- Headers de `node-addon-api` incluidos
|
|
38
62
|
- Configuración para excluir excepciones C++
|
|
39
63
|
|
|
40
|
-
### 3. Index.js con
|
|
64
|
+
### 3. Index.js Simplificado con node-gyp-build
|
|
41
65
|
```javascript
|
|
42
|
-
//
|
|
43
|
-
const
|
|
44
|
-
native = require(prebuiltPath);
|
|
45
|
-
|
|
46
|
-
// Fallback a compilación local si falla
|
|
47
|
-
native = require('./build/Release/eventlog.node');
|
|
66
|
+
// Carga automática de binario (precompilado o local)
|
|
67
|
+
const native = require('node-gyp-build')(__dirname);
|
|
48
68
|
```
|
|
49
69
|
|
|
70
|
+
**Ventajas de node-gyp-build:**
|
|
71
|
+
- 🔍 **Detección automática** de plataforma y arquitectura
|
|
72
|
+
- 📦 **Prioriza binarios precompilados** en `prebuilds/`
|
|
73
|
+
- 🔄 **Fallback automático** a compilación local si no hay binario
|
|
74
|
+
- ⚡ **Sin lógica manual** de detección de plataformas
|
|
75
|
+
- 🛡️ **Manejo de errores robusto** incorporado
|
|
76
|
+
|
|
50
77
|
### 4. CI/CD con GitHub Actions
|
|
51
78
|
- Compila automáticamente para Windows x64 y ARM64
|
|
52
79
|
- Compatible con Node.js 16, 18, 20, 22
|
|
53
80
|
- Publica automáticamente cuando se hace un tag
|
|
54
81
|
|
|
55
|
-
## 🚀
|
|
82
|
+
## 🚀 Proceso Completo de Release y Distribución
|
|
56
83
|
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm run build # Compila localmente
|
|
60
|
-
npm run prebuildify # Genera binario precompilado
|
|
61
|
-
npm test # Verifica funcionamiento
|
|
62
|
-
npm run verify # Verifica configuración completa
|
|
63
|
-
```
|
|
84
|
+
### 📋 **PASO 1: Preparación Pre-Release (Local)**
|
|
64
85
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
```bash
|
|
87
|
+
# 1. Verificar que todo funcione
|
|
88
|
+
npm test
|
|
89
|
+
npm run verify
|
|
90
|
+
|
|
91
|
+
# 2. Limpiar builds anteriores
|
|
92
|
+
npm run clean
|
|
93
|
+
|
|
94
|
+
# 3. Generar binarios precompilados para tu plataforma
|
|
95
|
+
npm run prebuildify
|
|
96
|
+
|
|
97
|
+
# 4. Verificar que se crearon los binarios
|
|
98
|
+
ls -la prebuilds/
|
|
99
|
+
# Deberías ver: prebuilds/win32-x64/nwinread.node
|
|
100
|
+
|
|
101
|
+
# 5. Probar carga automática
|
|
102
|
+
node -e "console.log('✅', require('./index.js'))"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 🏷️ **PASO 2: Crear Release**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 1. Incrementar versión (automáticamente ejecuta prepublishOnly)
|
|
109
|
+
npm version patch # 1.1.0 -> 1.1.1 (bug fixes)
|
|
110
|
+
npm version minor # 1.1.0 -> 1.2.0 (nuevas features)
|
|
111
|
+
npm version major # 1.1.0 -> 2.0.0 (breaking changes)
|
|
112
|
+
|
|
113
|
+
# 2. Subir tag al repositorio (dispara CI/CD)
|
|
114
|
+
git push origin --tags
|
|
115
|
+
|
|
116
|
+
# 3. Opcional: subir cambios también
|
|
117
|
+
git push origin main
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 🤖 **PASO 3: CI/CD Automático (GitHub Actions)**
|
|
121
|
+
|
|
122
|
+
Una vez que pushes el tag, GitHub Actions automáticamente:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
# Matriz de compilación automática:
|
|
126
|
+
- Windows x64 + Node.js [16, 18, 20, 22]
|
|
127
|
+
- Windows ARM64 + Node.js [16, 18, 20, 22]
|
|
128
|
+
|
|
129
|
+
# Proceso automático:
|
|
130
|
+
1. ✅ Checkout código fuente
|
|
131
|
+
2. ✅ Setup entorno para cada combinación
|
|
132
|
+
3. ✅ npm ci (instalar dependencias)
|
|
133
|
+
4. ✅ npm run prebuildify (generar binario)
|
|
134
|
+
5. ✅ Collect artifacts (recopilar binarios)
|
|
135
|
+
6. ✅ npm publish (solo en releases)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 📦 **PASO 4: Verificación Post-Release**
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Esperar ~5-10 minutos después del push del tag
|
|
142
|
+
|
|
143
|
+
# 1. Verificar que el package se publicó
|
|
144
|
+
npm info nwinread
|
|
70
145
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
146
|
+
# 2. Probar instalación en proyecto limpio
|
|
147
|
+
mkdir test-install && cd test-install
|
|
148
|
+
npm init -y
|
|
149
|
+
npm install nwinread@latest
|
|
150
|
+
|
|
151
|
+
# 3. Verificar funcionamiento
|
|
152
|
+
node -e "const n=require('nwinread'); console.log('✅ Funciona:', n.readEvents('System',0,0,1).records.length)"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 🛠️ Comandos de Desarrollo
|
|
156
|
+
|
|
157
|
+
### **Para Desarrollo Diario:**
|
|
158
|
+
```bash
|
|
159
|
+
npm run build # Compilación local tradicional
|
|
160
|
+
npm test # Probar funcionamiento
|
|
161
|
+
npm run verify # Verificar configuración completa
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### **Para Release Local (Opcional):**
|
|
165
|
+
```bash
|
|
166
|
+
npm run prebuildify # Generar binario para plataforma actual
|
|
167
|
+
npm run prebuild # Alias para prebuildify
|
|
168
|
+
npm pack # Crear tarball para pruebas
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### **Para Release de Producción:**
|
|
172
|
+
```bash
|
|
173
|
+
npm version [patch|minor|major] # Incrementa versión + prebuild
|
|
174
|
+
git push origin --tags # Dispara CI/CD
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## 🔍 Estructura de Binarios Generados
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
prebuilds/
|
|
181
|
+
├── win32-x64/
|
|
182
|
+
│ └── nwinread.node # Windows 64-bit (generado localmente)
|
|
183
|
+
│
|
|
184
|
+
# Después del CI/CD automático:
|
|
185
|
+
├── win32-x64/
|
|
186
|
+
│ ├── nwinread.node.16 # Para Node.js 16.x
|
|
187
|
+
│ ├── nwinread.node.18 # Para Node.js 18.x
|
|
188
|
+
│ ├── nwinread.node.20 # Para Node.js 20.x
|
|
189
|
+
│ └── nwinread.node.22 # Para Node.js 22.x
|
|
190
|
+
└── win32-arm64/
|
|
191
|
+
├── nwinread.node.16 # ARM64 builds
|
|
192
|
+
├── nwinread.node.18
|
|
193
|
+
├── nwinread.node.20
|
|
194
|
+
└── nwinread.node.22
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## ⚠️ **Solución de Problemas Comunes**
|
|
198
|
+
|
|
199
|
+
### **❌ "npm install sigue compilando"**
|
|
200
|
+
```bash
|
|
201
|
+
# Verificar configuración:
|
|
202
|
+
npm run verify
|
|
203
|
+
|
|
204
|
+
# Problemas comunes:
|
|
205
|
+
- ✅ Asegurar que existe `prebuilds/` con binarios
|
|
206
|
+
- ✅ Verificar `"install": "node-gyp-build"` en package.json
|
|
207
|
+
- ✅ Confirmar que no está `"gypfile": true`
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### **❌ "CI/CD no genera binarios"**
|
|
211
|
+
```bash
|
|
212
|
+
# Verificar:
|
|
213
|
+
1. Push del tag: git push origin --tags
|
|
214
|
+
2. Workflow habilitado en GitHub repo
|
|
215
|
+
3. Secrets configurados (NPM_TOKEN si autoPublish)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### **❌ "Binario no compatible"**
|
|
219
|
+
```bash
|
|
220
|
+
# El usuario puede forzar compilación:
|
|
221
|
+
npm rebuild nwinread
|
|
222
|
+
|
|
223
|
+
# O solicitar soporte para su plataforma
|
|
224
|
+
# agregando su combinación OS-ARCH al CI/CD
|
|
225
|
+
```
|
|
74
226
|
- Publica automáticamente a npm
|
|
75
227
|
|
|
76
228
|
4. **Usuario Final**:
|
package/README.md
CHANGED
|
@@ -12,32 +12,43 @@ A native Node.js module for reading Windows event logs using the Windows Event L
|
|
|
12
12
|
## Requirements
|
|
13
13
|
|
|
14
14
|
- Windows Vista/7/8/10/11 or Windows Server 2008/2012/2016/2019/2022
|
|
15
|
-
- Node.js (
|
|
15
|
+
- **Node.js 16+** (recommended for precompiled binaries)
|
|
16
|
+
- **Node.js 10-14** (requires local compilation)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
### 🐎 **Node.js Version Support:**
|
|
19
|
+
|
|
20
|
+
| Node.js | Status | Installation |
|
|
21
|
+
|---------|--------|-------------|
|
|
22
|
+
| **16.x** | ✅ **LTS** | Instant (precompiled) |
|
|
23
|
+
| **18.x** | ✅ **LTS** | Instant (precompiled) |
|
|
24
|
+
| **20.x** | ✅ **LTS** | Instant (precompiled) |
|
|
25
|
+
| **22.x** | ✅ **Current** | Instant (precompiled) |
|
|
26
|
+
| 10-14 | ⚠️ **EOL** | Requires build tools |
|
|
27
|
+
|
|
28
|
+
**Build requirements (only for Node.js 10-14 or development):**
|
|
18
29
|
- Visual Studio Build Tools or Visual Studio Community
|
|
19
30
|
- Python (for node-gyp)
|
|
20
31
|
|
|
21
32
|
## Installation
|
|
22
33
|
|
|
23
|
-
###
|
|
34
|
+
### 🚀 **Quick Install (Recommended)**
|
|
24
35
|
|
|
25
36
|
```bash
|
|
26
37
|
npm install nwinread
|
|
27
38
|
```
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
**✅ For Node.js 16+**: Installs instantly using precompiled binaries
|
|
41
|
+
**⚠️ For Node.js 10-14**: Automatically compiles from source (requires build tools)
|
|
42
|
+
|
|
43
|
+
### 🔧 **Development Install**
|
|
30
44
|
|
|
31
45
|
```bash
|
|
32
46
|
git clone https://github.com/solzimer/nwinread.git
|
|
33
47
|
cd nwinread
|
|
34
48
|
npm install
|
|
35
49
|
npm run build
|
|
50
|
+
npm test
|
|
36
51
|
```
|
|
37
|
-
|
|
38
|
-
### Manual compilation
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
52
|
# Install dependencies
|
|
42
53
|
npm install
|
|
43
54
|
|
|
@@ -131,6 +142,31 @@ const noFilter = nwinread.readEvents('System', nwinread.START_MODE.BEGINNING, 0,
|
|
|
131
142
|
- **4624**: Successful account logon (Security log)
|
|
132
143
|
- **4625**: Failed account logon (Security log)
|
|
133
144
|
|
|
145
|
+
## Development & Release Process
|
|
146
|
+
|
|
147
|
+
### 🏗️ **For Contributors/Maintainers:**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Development workflow
|
|
151
|
+
npm run build # Compile locally
|
|
152
|
+
npm run prebuildify # Generate precompiled binary for current platform
|
|
153
|
+
npm test # Run tests
|
|
154
|
+
npm run verify # Verify complete setup
|
|
155
|
+
|
|
156
|
+
# Release new version
|
|
157
|
+
npm version [patch|minor|major] # Auto-generates prebuilds
|
|
158
|
+
git push origin --tags # Triggers CI/CD for multi-platform builds
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 📦 **Publishing Process:**
|
|
162
|
+
|
|
163
|
+
1. **Local Testing**: `npm test && npm run verify`
|
|
164
|
+
2. **Version Bump**: `npm version patch` (auto-runs prebuildify)
|
|
165
|
+
3. **Push Release**: `git push origin --tags`
|
|
166
|
+
4. **CI/CD Magic**: GitHub Actions builds for all platforms & publishes automatically
|
|
167
|
+
|
|
168
|
+
**Note**: The `prepublishOnly` script ensures binaries are generated before any npm publish.
|
|
169
|
+
|
|
134
170
|
## Testing
|
|
135
171
|
|
|
136
172
|
```bash
|
|
@@ -139,9 +175,23 @@ npm test
|
|
|
139
175
|
|
|
140
176
|
## Troubleshooting
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
178
|
+
### **Installation Issues**
|
|
179
|
+
|
|
180
|
+
1. **"Still compiling on install"**:
|
|
181
|
+
- ✅ Update to Node.js 16+ for precompiled binaries
|
|
182
|
+
- ✅ Check `npm ls nwinread` shows correct version
|
|
183
|
+
- ✅ Try `npm cache clean --force && npm install`
|
|
184
|
+
|
|
185
|
+
2. **"Module not found"**:
|
|
186
|
+
- ✅ Ensure Windows platform (module is Windows-only)
|
|
187
|
+
- ✅ Try `npm rebuild nwinread`
|
|
188
|
+
- ✅ Check administrator privileges if needed
|
|
189
|
+
|
|
190
|
+
### **Runtime Issues**
|
|
191
|
+
|
|
192
|
+
3. **Permission error**: Some logs require administrator privileges
|
|
193
|
+
4. **Channel not found**: Verify that the channel name is correct
|
|
194
|
+
5. **Old Node.js**: Update to Node.js 16+ for best experience
|
|
145
195
|
|
|
146
196
|
## Common channels
|
|
147
197
|
|
package/index.js
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
let native;
|
|
4
|
-
|
|
5
|
-
// Intentar cargar el binario precompilado
|
|
6
|
-
try {
|
|
7
|
-
// Detectar la plataforma y arquitectura
|
|
8
|
-
const platform = process.platform;
|
|
9
|
-
const arch = process.arch;
|
|
10
|
-
|
|
11
|
-
// Intentar cargar binario precompilado (prebuildify naming convention)
|
|
12
|
-
const prebuiltPath = join(__dirname, 'prebuilds', `${platform}-${arch}`, 'nwinread.node');
|
|
13
|
-
native = require(prebuiltPath);
|
|
14
|
-
|
|
15
|
-
} catch (error) {
|
|
16
|
-
// Fallback al binario compilado localmente
|
|
17
|
-
try {
|
|
18
|
-
native = require('./build/Release/eventlog.node');
|
|
19
|
-
} catch (buildError) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
`Failed to load native module. Please run 'npm run build' or install from npm: ${buildError.message}\n` +
|
|
22
|
-
`Original prebuild error: ${error.message}`
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
const native = require('node-gyp-build')(__dirname);
|
|
26
2
|
|
|
27
3
|
const START_MODE = {
|
|
28
4
|
BEGINNING: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nwinread",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node-gyp configure && node-gyp build",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"prebuildify-cross": "prebuildify-cross",
|
|
12
12
|
"prebuild": "npm run prebuildify",
|
|
13
13
|
"verify": "node scripts/verify-setup.js",
|
|
14
|
-
"prepublishOnly": "npm run prebuild"
|
|
14
|
+
"prepublishOnly": "npm run prebuild",
|
|
15
|
+
"install": "node-gyp-build"
|
|
15
16
|
},
|
|
16
17
|
"author": "solzimer",
|
|
17
18
|
"license": "MIT",
|
|
@@ -30,10 +31,11 @@
|
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"node-gyp": "^10.0.0",
|
|
32
33
|
"prebuildify": "^6.0.0",
|
|
33
|
-
"prebuildify-cross": "^5.0.0"
|
|
34
|
+
"prebuildify-cross": "^5.0.0",
|
|
35
|
+
"node-addon-api": "^8.0.0"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"node-
|
|
38
|
+
"node-gyp-build": "^4.8.0"
|
|
37
39
|
},
|
|
38
40
|
"binary": {
|
|
39
41
|
"napi_versions": [
|
|
@@ -45,6 +47,5 @@
|
|
|
45
47
|
8,
|
|
46
48
|
9
|
|
47
49
|
]
|
|
48
|
-
}
|
|
49
|
-
"gypfile": true
|
|
50
|
+
}
|
|
50
51
|
}
|
|
Binary file
|
package/scripts/verify-setup.js
CHANGED
|
@@ -35,7 +35,8 @@ try {
|
|
|
35
35
|
|
|
36
36
|
console.log('✅ N-API configurado:', pkg.binary?.napi_versions ? 'Sí' : 'No');
|
|
37
37
|
console.log('✅ Scripts prebuildify:', pkg.scripts?.prebuildify ? 'Sí' : 'No');
|
|
38
|
-
console.log('✅ node-
|
|
38
|
+
console.log('✅ node-gyp-build:', pkg.dependencies?.['node-gyp-build'] ? 'Sí' : 'No');
|
|
39
|
+
console.log('✅ node-addon-api:', (pkg.dependencies?.['node-addon-api'] || pkg.devDependencies?.['node-addon-api']) ? 'Sí' : 'No');
|
|
39
40
|
|
|
40
41
|
} catch (e) {
|
|
41
42
|
console.log('❌ Error leyendo package.json:', e.message);
|