react-native-electron-platform 0.0.13 → 0.0.15
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 +1 -1
- package/README.md +1 -66
- package/electron-builder.json +22 -24
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ Read the **[Complete Setup Guide](SETUP.md)** for step-by-step instructions on:
|
|
|
113
113
|
|
|
114
114
|
## 📖 How to Use
|
|
115
115
|
|
|
116
|
-
###
|
|
116
|
+
### As an NPM Module (Recommended) ⭐
|
|
117
117
|
|
|
118
118
|
The easiest and recommended way - install as a package and use pre-configured setup:
|
|
119
119
|
|
|
@@ -201,76 +201,11 @@ if (root) {
|
|
|
201
201
|
}
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
Create `index.html`:
|
|
205
|
-
```html
|
|
206
|
-
<!DOCTYPE html>
|
|
207
|
-
<html lang="en">
|
|
208
|
-
<head>
|
|
209
|
-
<meta charset="UTF-8" />
|
|
210
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
211
|
-
<title>My App</title>
|
|
212
|
-
<style>
|
|
213
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
214
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif; }
|
|
215
|
-
#root { width: 100%; height: 100vh; }
|
|
216
|
-
</style>
|
|
217
|
-
</head>
|
|
218
|
-
<body>
|
|
219
|
-
<div id="root"></div>
|
|
220
|
-
</body>
|
|
221
|
-
</html>
|
|
222
|
-
```
|
|
223
|
-
|
|
224
204
|
**Run Your App:**
|
|
225
205
|
```bash
|
|
226
206
|
npm run electron
|
|
227
207
|
```
|
|
228
208
|
|
|
229
|
-
### Option 2: As a Boilerplate (Advanced)
|
|
230
|
-
|
|
231
|
-
For custom use cases, copy specific files to your Electron project:
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
# Copy Electron entry point
|
|
235
|
-
cp node_modules/react-native-electron-platform/index.mjs ./
|
|
236
|
-
|
|
237
|
-
# Copy webpack config helper
|
|
238
|
-
cp node_modules/react-native-electron-platform/src/webpackConfigHelper.mjs ./src/
|
|
239
|
-
|
|
240
|
-
# Copy preload script (for security)
|
|
241
|
-
cp node_modules/react-native-electron-platform/src/preload.mjs ./src/
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Option 3: As a Library (Advanced)
|
|
245
|
-
|
|
246
|
-
Use utility functions directly in your project:
|
|
247
|
-
|
|
248
|
-
```javascript
|
|
249
|
-
// Analyze dependencies
|
|
250
|
-
import webpackConfigHelper from 'react-native-electron-platform/src/webpackConfigHelper.mjs';
|
|
251
|
-
const packages = webpackConfigHelper.categorizePackages();
|
|
252
|
-
|
|
253
|
-
// Use modules
|
|
254
|
-
import { windowManager, networkService, autoUpdater } from 'react-native-electron-platform/src/modules/';
|
|
255
|
-
|
|
256
|
-
// Create window
|
|
257
|
-
windowManager.createWindow({ width: 1024, height: 768 });
|
|
258
|
-
|
|
259
|
-
// Make secure network requests
|
|
260
|
-
networkService.fetch('https://api.example.com/data');
|
|
261
|
-
|
|
262
|
-
// Check for updates
|
|
263
|
-
autoUpdater.checkForUpdates();
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
## Example Project
|
|
267
|
-
|
|
268
|
-
See the [example-project](example-project/) folder for a complete, working example with:
|
|
269
|
-
- Pre-configured `package.json`
|
|
270
|
-
- Sample App component
|
|
271
|
-
- Electron configuration
|
|
272
|
-
- HTML entry point
|
|
273
|
-
|
|
274
209
|
## 🔧 Available NPM Scripts
|
|
275
210
|
|
|
276
211
|
All scripts are configured to work with react-native-electron-platform.
|
package/electron-builder.json
CHANGED
|
@@ -11,59 +11,55 @@
|
|
|
11
11
|
"buildDependenciesFromSource": false,
|
|
12
12
|
"npmRebuild": false,
|
|
13
13
|
"nodeGypRebuild": false,
|
|
14
|
+
|
|
14
15
|
"directories": {
|
|
15
16
|
"output": "dist",
|
|
16
17
|
"buildResources": "node_modules/react-native-electron-platform/src"
|
|
17
18
|
},
|
|
19
|
+
|
|
18
20
|
"publish": [
|
|
19
21
|
{
|
|
20
22
|
"provider": "generic",
|
|
21
23
|
"url": "https://yourdomain.com/updates/"
|
|
22
24
|
}
|
|
23
25
|
],
|
|
26
|
+
|
|
24
27
|
"files": [
|
|
25
28
|
"electron/**/*",
|
|
26
29
|
"web-build/**/*",
|
|
27
30
|
"package.json",
|
|
31
|
+
|
|
32
|
+
"node_modules/react-native-electron-platform/src/**/*",
|
|
33
|
+
"node_modules/react-native-electron-platform/index.mjs",
|
|
34
|
+
|
|
28
35
|
"!**/*.map",
|
|
29
36
|
"!**/*.md",
|
|
30
|
-
"!**/*.ts",
|
|
31
|
-
"!**/*.tsx",
|
|
32
|
-
"!**/*.log",
|
|
33
37
|
"!**/test/**",
|
|
34
38
|
"!**/__tests__/**",
|
|
35
|
-
"!**/tests/**",
|
|
36
39
|
"!**/docs/**",
|
|
40
|
+
"!**/locales/**",
|
|
37
41
|
"!**/example/**",
|
|
38
|
-
|
|
39
|
-
"!**/.vscode/**",
|
|
40
|
-
"!**/.github/**",
|
|
41
|
-
"!**/node_modules/.bin",
|
|
42
|
-
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md}",
|
|
43
|
-
"!**/node_modules/*/{test,__tests__,tests,example,examples}",
|
|
44
|
-
"!**/node_modules/**/*.d.ts",
|
|
42
|
+
|
|
45
43
|
"!**/android/**",
|
|
46
44
|
"!**/ios/**",
|
|
47
45
|
"!**/build/**",
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"!**/*.kt",
|
|
51
|
-
"!**/node_modules/**/android/**",
|
|
52
|
-
"!**/node_modules/**/ios/**",
|
|
53
|
-
"!**/node_modules/**/build/**",
|
|
46
|
+
|
|
47
|
+
"!**/node_modules/electron/**",
|
|
54
48
|
"!**/node_modules/react-native/**",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"node_modules
|
|
59
|
-
"node_modules/react-native-electron-platform/index.mjs"
|
|
49
|
+
"!node_modules/**/android/**",
|
|
50
|
+
"!node_modules/**/ios/**",
|
|
51
|
+
"!node_modules/**/build/**",
|
|
52
|
+
"!node_modules/**/example/**"
|
|
60
53
|
],
|
|
54
|
+
|
|
61
55
|
"asarUnpack": [
|
|
62
56
|
"**/*.node"
|
|
63
57
|
],
|
|
58
|
+
|
|
64
59
|
"extraMetadata": {
|
|
65
60
|
"main": "node_modules/react-native-electron-platform/index.mjs"
|
|
66
61
|
},
|
|
62
|
+
|
|
67
63
|
"win": {
|
|
68
64
|
"target": [
|
|
69
65
|
{
|
|
@@ -77,14 +73,16 @@
|
|
|
77
73
|
],
|
|
78
74
|
"icon": "electron/icon.ico"
|
|
79
75
|
},
|
|
76
|
+
|
|
80
77
|
"nsis": {
|
|
81
78
|
"oneClick": false,
|
|
82
79
|
"allowToChangeInstallationDirectory": true,
|
|
83
80
|
"createDesktopShortcut": true,
|
|
84
81
|
"createStartMenuShortcut": true,
|
|
85
|
-
"shortcutName": "
|
|
82
|
+
"shortcutName": "app",
|
|
86
83
|
"artifactName": "${productName} Setup ${version}.${ext}"
|
|
87
84
|
},
|
|
85
|
+
|
|
88
86
|
"msi": {
|
|
89
87
|
"oneClick": false,
|
|
90
88
|
"perMachine": true,
|
|
@@ -92,4 +90,4 @@
|
|
|
92
90
|
"createStartMenuShortcut": true,
|
|
93
91
|
"warningsAsErrors": false
|
|
94
92
|
}
|
|
95
|
-
}
|
|
93
|
+
}
|