react-native-electron-platform 0.0.3 → 0.0.4
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/CHANGELOG.md +34 -0
- package/CODE_OF_CONDUCT.md +83 -0
- package/CONTRIBUTING.md +39 -0
- package/README.md +77 -77
- package/electron-builder.json +94 -0
- package/package.json +7 -2
- package/test/electron/index.js +18 -0
- package/test/electron/nonmodules.mjs +34 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-02-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of react-native-electron boilerplate
|
|
12
|
+
- Electron main process with auto-updater
|
|
13
|
+
- Preload script for secure IPC communication
|
|
14
|
+
- Webpack configuration helper for React Native web builds
|
|
15
|
+
- Network service integration
|
|
16
|
+
- PDF generation and preview functionality
|
|
17
|
+
- File selection dialogs
|
|
18
|
+
- HTML preview functionality
|
|
19
|
+
- Comprehensive documentation and examples
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- N/A
|
|
23
|
+
|
|
24
|
+
### Deprecated
|
|
25
|
+
- N/A
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
- N/A
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- N/A
|
|
32
|
+
|
|
33
|
+
### Security
|
|
34
|
+
- N/A
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
- Demonstrating empathy and kindness toward other people
|
|
14
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
- Giving and gracefully accepting constructive feedback
|
|
16
|
+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
- Public or private harassment
|
|
24
|
+
- Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Enforcement Guidelines
|
|
44
|
+
|
|
45
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
+
|
|
47
|
+
### 1. Correction
|
|
48
|
+
|
|
49
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
+
|
|
51
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
+
|
|
53
|
+
### 2. Warning
|
|
54
|
+
|
|
55
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
+
|
|
57
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
+
|
|
59
|
+
### 3. Temporary Ban
|
|
60
|
+
|
|
61
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
+
|
|
63
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
+
|
|
65
|
+
### 4. Permanent Ban
|
|
66
|
+
|
|
67
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
+
|
|
69
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
+
|
|
71
|
+
## Attribution
|
|
72
|
+
|
|
73
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
74
|
+
|
|
75
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
76
|
+
|
|
77
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
78
|
+
|
|
79
|
+
[homepage]: https://www.contributor-covenant.org
|
|
80
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
81
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
82
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
83
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to react-native-electron
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to react-native-electron! We welcome contributions from the community.
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
1. Fork the repository
|
|
8
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
9
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
10
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
11
|
+
5. Open a Pull Request
|
|
12
|
+
|
|
13
|
+
## Development Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install
|
|
17
|
+
npm start
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Code Style
|
|
21
|
+
|
|
22
|
+
- Use ES6+ syntax
|
|
23
|
+
- Follow existing code patterns
|
|
24
|
+
- Add comments for complex logic
|
|
25
|
+
- Ensure code is well-tested
|
|
26
|
+
|
|
27
|
+
## Reporting Issues
|
|
28
|
+
|
|
29
|
+
When reporting issues, please include:
|
|
30
|
+
- Node.js version
|
|
31
|
+
- Electron version
|
|
32
|
+
- React Native version
|
|
33
|
+
- Operating system
|
|
34
|
+
- Steps to reproduce
|
|
35
|
+
- Expected vs actual behavior
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/README.md
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
# react-native-electron
|
|
2
|
-
|
|
3
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[;
|
|
38
|
-
// Use the categorized packages for your build configuration
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Running the Example
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm start
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
This will start the Electron app with the included example.
|
|
48
|
-
|
|
49
|
-
## API
|
|
50
|
-
|
|
51
|
-
### WebpackConfigHelper
|
|
52
|
-
|
|
53
|
-
- `getAllPackages()`: Get all dependencies from package.json
|
|
54
|
-
- `categorizePackages()`: Separate packages into web-supported and unsupported
|
|
55
|
-
- `isWebSupported(packageName)`: Check if a package supports web platform
|
|
56
|
-
|
|
57
|
-
## Building
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
npm run build
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Contributing
|
|
64
|
-
|
|
65
|
-
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
66
|
-
|
|
67
|
-
## Code of Conduct
|
|
68
|
-
|
|
69
|
-
Please read our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our community guidelines.
|
|
70
|
-
|
|
71
|
-
## Changelog
|
|
72
|
-
|
|
73
|
-
See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.
|
|
74
|
-
|
|
75
|
-
## License
|
|
76
|
-
|
|
77
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
1
|
+
# react-native-electron
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/react-native-electron)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/dpraful/react-native-electron/actions)
|
|
6
|
+
|
|
7
|
+
A boilerplate and utility library for running React Native applications in Electron, supporting both desktop and web platforms.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Electron main process setup with auto-updater
|
|
12
|
+
- Preload script for secure IPC communication
|
|
13
|
+
- Webpack configuration helper for React Native web builds
|
|
14
|
+
- Network service integration
|
|
15
|
+
- PDF generation and preview
|
|
16
|
+
- File selection dialogs
|
|
17
|
+
- HTML preview functionality
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install react-native-electron
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### As a Boilerplate
|
|
28
|
+
|
|
29
|
+
1. Copy the `src/main.mjs` and `src/preload.js` to your Electron project.
|
|
30
|
+
2. Use the `src/webpackConfigHelper.mjs` to configure your webpack build for React Native web.
|
|
31
|
+
|
|
32
|
+
### As a Library
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
import { categorizePackages, isWebSupported } from 'react-native-electron';
|
|
36
|
+
|
|
37
|
+
const packages = categorizePackages();
|
|
38
|
+
// Use the categorized packages for your build configuration
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Running the Example
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm start
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This will start the Electron app with the included example.
|
|
48
|
+
|
|
49
|
+
## API
|
|
50
|
+
|
|
51
|
+
### WebpackConfigHelper
|
|
52
|
+
|
|
53
|
+
- `getAllPackages()`: Get all dependencies from package.json
|
|
54
|
+
- `categorizePackages()`: Separate packages into web-supported and unsupported
|
|
55
|
+
- `isWebSupported(packageName)`: Check if a package supports web platform
|
|
56
|
+
|
|
57
|
+
## Building
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm run build
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Contributing
|
|
64
|
+
|
|
65
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
66
|
+
|
|
67
|
+
## Code of Conduct
|
|
68
|
+
|
|
69
|
+
Please read our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our community guidelines.
|
|
70
|
+
|
|
71
|
+
## Changelog
|
|
72
|
+
|
|
73
|
+
See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"appId": "com.${name}.desktop",
|
|
3
|
+
"productName": "${name}",
|
|
4
|
+
"name": "${name}",
|
|
5
|
+
"asar": {
|
|
6
|
+
"smartUnpack": true
|
|
7
|
+
},
|
|
8
|
+
"compression": "maximum",
|
|
9
|
+
"electronLanguages": ["en-US"],
|
|
10
|
+
"removePackageScripts": true,
|
|
11
|
+
"removePackageKeywords": true,
|
|
12
|
+
"buildDependenciesFromSource": false,
|
|
13
|
+
"npmRebuild": false,
|
|
14
|
+
"nodeGypRebuild": false,
|
|
15
|
+
"directories": {
|
|
16
|
+
"output": "../../dist",
|
|
17
|
+
"buildResources": "electron"
|
|
18
|
+
},
|
|
19
|
+
"publish": [
|
|
20
|
+
{
|
|
21
|
+
"provider": "generic",
|
|
22
|
+
"url": "https://yourdomain.com/updates/"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"electron/**/*",
|
|
27
|
+
"web-build/**/*",
|
|
28
|
+
"package.json",
|
|
29
|
+
"!**/*.map",
|
|
30
|
+
"!**/*.md",
|
|
31
|
+
"!**/*.ts",
|
|
32
|
+
"!**/*.tsx",
|
|
33
|
+
"!**/*.log",
|
|
34
|
+
"!**/test/**",
|
|
35
|
+
"!**/__tests__/**",
|
|
36
|
+
"!**/tests/**",
|
|
37
|
+
"!**/docs/**",
|
|
38
|
+
"!**/example/**",
|
|
39
|
+
"!**/examples/**",
|
|
40
|
+
"!**/.vscode/**",
|
|
41
|
+
"!**/.github/**",
|
|
42
|
+
"!**/node_modules/.bin",
|
|
43
|
+
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md}",
|
|
44
|
+
"!**/node_modules/*/{test,__tests__,tests,example,examples}",
|
|
45
|
+
"!**/node_modules/**/*.d.ts",
|
|
46
|
+
"!**/android/**",
|
|
47
|
+
"!**/ios/**",
|
|
48
|
+
"!**/build/**",
|
|
49
|
+
"!**/*.gradle",
|
|
50
|
+
"!**/*.java",
|
|
51
|
+
"!**/*.kt",
|
|
52
|
+
"!**/node_modules/**/android/**",
|
|
53
|
+
"!**/node_modules/**/ios/**",
|
|
54
|
+
"!**/node_modules/**/build/**",
|
|
55
|
+
"!**/node_modules/react-native/**",
|
|
56
|
+
"!**/node_modules/react-native-*/*",
|
|
57
|
+
"!**/node_modules/rn-fetch-blob/**",
|
|
58
|
+
"!**/locales/**"
|
|
59
|
+
],
|
|
60
|
+
"asarUnpack": [
|
|
61
|
+
"**/*.node"
|
|
62
|
+
],
|
|
63
|
+
"extraMetadata": {
|
|
64
|
+
"main": "electron/main.js"
|
|
65
|
+
},
|
|
66
|
+
"win": {
|
|
67
|
+
"target": [
|
|
68
|
+
{
|
|
69
|
+
"target": "nsis",
|
|
70
|
+
"arch": ["x64"]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"target": "msi",
|
|
74
|
+
"arch": ["x64"]
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"icon": "electron/icon.ico"
|
|
78
|
+
},
|
|
79
|
+
"nsis": {
|
|
80
|
+
"oneClick": false,
|
|
81
|
+
"allowToChangeInstallationDirectory": true,
|
|
82
|
+
"createDesktopShortcut": true,
|
|
83
|
+
"createStartMenuShortcut": true,
|
|
84
|
+
"shortcutName": "${name}",
|
|
85
|
+
"artifactName": "${productName} Setup ${version}.${ext}"
|
|
86
|
+
},
|
|
87
|
+
"msi": {
|
|
88
|
+
"oneClick": false,
|
|
89
|
+
"perMachine": true,
|
|
90
|
+
"createDesktopShortcut": true,
|
|
91
|
+
"createStartMenuShortcut": true,
|
|
92
|
+
"warningsAsErrors": false
|
|
93
|
+
}
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-electron-platform",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A boilerplate and utilities for running React Native applications in Electron",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"scripts": {
|
|
@@ -44,7 +44,12 @@
|
|
|
44
44
|
"index.mjs",
|
|
45
45
|
"webpack.config.mjs",
|
|
46
46
|
"src/",
|
|
47
|
+
"test/",
|
|
47
48
|
"README.md",
|
|
48
|
-
"LICENSE"
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"CHANGELOG.md",
|
|
51
|
+
"CODE_OF_CONDUCT.md",
|
|
52
|
+
"CONTRIBUTING.md",
|
|
53
|
+
"electron-builder.json"
|
|
49
54
|
]
|
|
50
55
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppRegistry } from 'react-native';
|
|
2
|
+
import App from '../src/App';
|
|
3
|
+
|
|
4
|
+
console.log('Registering App with AppRegistry...');
|
|
5
|
+
|
|
6
|
+
AppRegistry.registerComponent('App', () => App);
|
|
7
|
+
|
|
8
|
+
console.log('Running App...');
|
|
9
|
+
|
|
10
|
+
const root = document.getElementById('root');
|
|
11
|
+
if (root) {
|
|
12
|
+
AppRegistry.runApplication('App', {
|
|
13
|
+
rootTag: root,
|
|
14
|
+
});
|
|
15
|
+
console.log('App is running!');
|
|
16
|
+
} else {
|
|
17
|
+
console.error('Root element not found!');
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Packages that don't support web platform
|
|
2
|
+
export const WEB_UNSUPPORTED_PACKAGES = [
|
|
3
|
+
'@kichiyaki/react-native-barcode-generator',
|
|
4
|
+
'@react-native-async-storage/async-storage',
|
|
5
|
+
'@react-native-community/datetimepicker',
|
|
6
|
+
'@terrylinla/react-native-sketch-canvas',
|
|
7
|
+
'@react-native-ml-kit/text-recognition',
|
|
8
|
+
'react-native-blob-util',
|
|
9
|
+
'react-native-fs',
|
|
10
|
+
'react-native-document-picker',
|
|
11
|
+
'react-native-exit-app',
|
|
12
|
+
'react-native-file-viewer',
|
|
13
|
+
'react-native-gesture-handler',
|
|
14
|
+
'react-native-html-to-pdf',
|
|
15
|
+
'react-native-image-pan-zoom',
|
|
16
|
+
'react-native-modal-overlay',
|
|
17
|
+
'react-native-pdf',
|
|
18
|
+
'react-native-pell-rich-editor',
|
|
19
|
+
'react-native-photo-editor',
|
|
20
|
+
'react-native-pie-chart',
|
|
21
|
+
'react-native-print',
|
|
22
|
+
'react-native-progress-circle',
|
|
23
|
+
'react-native-biometric-verifier',
|
|
24
|
+
'react-native-snap-carousel',
|
|
25
|
+
'react-native-sound',
|
|
26
|
+
'react-native-stopwatch-timer',
|
|
27
|
+
'react-native-vision-camera',
|
|
28
|
+
'react-native-video-controls',
|
|
29
|
+
'rn-fetch-blob',
|
|
30
|
+
'rn-harold-test',
|
|
31
|
+
'@react-navigation/native',
|
|
32
|
+
'@react-navigation/native-stack',
|
|
33
|
+
'react-native-share',
|
|
34
|
+
];
|