bundo-appgen 0.0.1-beta.7
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/README.md +253 -0
- package/bin.mjs +21 -0
- package/lib/bin/bin.mjs +1141 -0
- package/lib/bin/plugin-sandbox-runner.mjs +105 -0
- package/lib/commonjs/index.js +125 -0
- package/lib/module/chunk-bhc5nymd.js +12 -0
- package/lib/module/chunk-dvyy3g4j.js +25 -0
- package/lib/module/chunk-ynqw05p0.js +70 -0
- package/lib/module/config/apple/create-osx-appiconset.js +6 -0
- package/lib/module/config/apple/index.js +7 -0
- package/lib/module/config/index.js +8 -0
- package/lib/module/index.js +8 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/index.d.ts +3 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/set-type.d.ts +42 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/set-type.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/size.d.ts +21 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/size.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/appearances.d.ts +13 -0
- package/lib/typescript/config/apple/asset-catalog-format/appearances.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/idiom.d.ts +5 -0
- package/lib/typescript/config/apple/asset-catalog-format/idiom.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/color-space.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/color-space.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/compression-type.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/compression-type.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/display-gamut.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/display-gamut.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/index.d.ts +6 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/language-direction.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/language-direction.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/scale.d.ts +9 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/scale.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/set-type.d.ts +58 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/set-type.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/index.d.ts +5 -0
- package/lib/typescript/config/apple/asset-catalog-format/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalogs-namespaced.d.ts +5 -0
- package/lib/typescript/config/apple/asset-catalogs-namespaced.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalogs.d.ts +73 -0
- package/lib/typescript/config/apple/asset-catalogs.d.ts.map +1 -0
- package/lib/typescript/config/apple/create-osx-appiconset.d.mts +72 -0
- package/lib/typescript/config/apple/create-osx-appiconset.d.mts.map +1 -0
- package/lib/typescript/config/apple/data.d.ts +103 -0
- package/lib/typescript/config/apple/data.d.ts.map +1 -0
- package/lib/typescript/config/apple/index.d.mts +8 -0
- package/lib/typescript/config/apple/index.d.mts.map +1 -0
- package/lib/typescript/config/apple/info-plist-value.d.ts +8 -0
- package/lib/typescript/config/apple/info-plist-value.d.ts.map +1 -0
- package/lib/typescript/config/apple/info-plist.d.ts +4 -0
- package/lib/typescript/config/apple/info-plist.d.ts.map +1 -0
- package/lib/typescript/config/apple/string-catalog.d.ts +2 -0
- package/lib/typescript/config/apple/string-catalog.d.ts.map +1 -0
- package/lib/typescript/config/data.d.ts +50 -0
- package/lib/typescript/config/data.d.ts.map +1 -0
- package/lib/typescript/config/index.d.mts +5 -0
- package/lib/typescript/config/index.d.mts.map +1 -0
- package/lib/typescript/config/plugin-item.d.ts +2 -0
- package/lib/typescript/config/plugin-item.d.ts.map +1 -0
- package/lib/typescript/config/plugin-registry.d.ts +3 -0
- package/lib/typescript/config/plugin-registry.d.ts.map +1 -0
- package/lib/typescript/index.d.mts +3 -0
- package/lib/typescript/index.d.mts.map +1 -0
- package/lib/typescript/plugin/apple/context.d.ts +28 -0
- package/lib/typescript/plugin/apple/context.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/files.d.ts +7 -0
- package/lib/typescript/plugin/apple/files.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/index.d.ts +6 -0
- package/lib/typescript/plugin/apple/index.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-cocoapods.d.ts +5 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-cocoapods.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-git.d.ts +11 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-git.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-local.d.ts +7 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-local.d.ts.map +1 -0
- package/lib/typescript/plugin/context.d.ts +9 -0
- package/lib/typescript/plugin/context.d.ts.map +1 -0
- package/lib/typescript/plugin/index.d.ts +3 -0
- package/lib/typescript/plugin/index.d.ts.map +1 -0
- package/package.json +49 -0
- package/src/_bin/_global-vars/_global-vars.mts +47 -0
- package/src/_bin/_global-vars/index.mts +30 -0
- package/src/_bin/_main/_check-config-validity.mts +94 -0
- package/src/_bin/_main/_evaluate-plugin-registry.mts +181 -0
- package/src/_bin/_main/_exec-plugin-runner/_spawn-plugin-sandbox-runner.mts +149 -0
- package/src/_bin/_main/_exec-plugin-runner/exec-plugin-runner.mts +92 -0
- package/src/_bin/_main/_exec-plugin-runner/index.mts +1 -0
- package/src/_bin/_main/_get-config.mts +64 -0
- package/src/_bin/_main/_helpers/config/get-name.mts +24 -0
- package/src/_bin/_main/_helpers/config/get-project-name.mts +27 -0
- package/src/_bin/_main/_helpers/config/index.mts +2 -0
- package/src/_bin/_main/_helpers/index.mts +2 -0
- package/src/_bin/_main/_helpers/platform/compatibility-error.mts +7 -0
- package/src/_bin/_main/_helpers/platform/data.ts +9 -0
- package/src/_bin/_main/_helpers/platform/get-data.mts +48 -0
- package/src/_bin/_main/_helpers/platform/index.mts +4 -0
- package/src/_bin/_main/_helpers/platform/is-compatible.mts +30 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-appiconsets.mts +223 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-imagesets.mts +241 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/appearances.mts +24 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/idiom.mts +22 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/compression-type.mts +15 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/display-gamut.mts +12 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/index.mts +3 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/language-direction.mts +12 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/index.mts +3 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts +54 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-string-catalogs/create-string-catalog.mts +134 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-string-catalogs/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_app-delegate-swift.mts +62 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile.mts +31 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/mod-files.mts +17 -0
- package/src/_bin/_main/_init-template/_init-apple/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/init-apple.mts +81 -0
- package/src/_bin/_main/_init-template/index.mts +1 -0
- package/src/_bin/_main/_init-template/init-template.mts +39 -0
- package/src/_bin/_main/_mod-plugin/index.mts +1 -0
- package/src/_bin/_main/_mod-plugin/mod-plugin.mts +77 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/_init-resources.mts +86 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/create-project-spec.mts +216 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/index.mts +1 -0
- package/src/_bin/_main/_xcodegen/_mod-known-regions/index.ts +1 -0
- package/src/_bin/_main/_xcodegen/_mod-known-regions/mod-known-regions.mts +52 -0
- package/src/_bin/_main/_xcodegen/index.mts +1 -0
- package/src/_bin/_main/_xcodegen/xcodegen.mts +46 -0
- package/src/_bin/_main/index.mts +1 -0
- package/src/_bin/_main/main.mts +160 -0
- package/src/_bin/bin.mts +68 -0
- package/src/_bin/plugin-sandbox-runner/_exec-plugins.mts +135 -0
- package/src/_bin/plugin-sandbox-runner/argv-json.ts +20 -0
- package/src/_bin/plugin-sandbox-runner/evaluated-plugin-registry.ts +12 -0
- package/src/_bin/plugin-sandbox-runner/index.ts +3 -0
- package/src/_bin/plugin-sandbox-runner/plugin-runner-context-result.ts +33 -0
- package/src/_bin/plugin-sandbox-runner/plugin-sandbox-runner.mts +68 -0
- package/src/config/apple/asset-catalog-format/app-icon/index.ts +2 -0
- package/src/config/apple/asset-catalog-format/app-icon/set-type.ts +59 -0
- package/src/config/apple/asset-catalog-format/app-icon/size.ts +37 -0
- package/src/config/apple/asset-catalog-format/appearances.ts +10 -0
- package/src/config/apple/asset-catalog-format/idiom.ts +16 -0
- package/src/config/apple/asset-catalog-format/image/color-space.ts +3 -0
- package/src/config/apple/asset-catalog-format/image/compression-type.ts +6 -0
- package/src/config/apple/asset-catalog-format/image/display-gamut.ts +3 -0
- package/src/config/apple/asset-catalog-format/image/index.ts +6 -0
- package/src/config/apple/asset-catalog-format/image/language-direction.ts +3 -0
- package/src/config/apple/asset-catalog-format/image/scale.ts +11 -0
- package/src/config/apple/asset-catalog-format/image/set-type.ts +85 -0
- package/src/config/apple/asset-catalog-format/index.ts +4 -0
- package/src/config/apple/asset-catalogs-namespaced.ts +13 -0
- package/src/config/apple/asset-catalogs.ts +76 -0
- package/src/config/apple/create-osx-appiconset.mts +135 -0
- package/src/config/apple/data.ts +123 -0
- package/src/config/apple/index.mts +7 -0
- package/src/config/apple/info-plist-value.ts +16 -0
- package/src/config/apple/info-plist.ts +6 -0
- package/src/config/apple/string-catalog.ts +0 -0
- package/src/config/data.ts +59 -0
- package/src/config/index.mts +4 -0
- package/src/config/plugin-item.ts +4 -0
- package/src/config/plugin-registry.ts +5 -0
- package/src/index.mts +2 -0
- package/src/plugin/apple/context.ts +68 -0
- package/src/plugin/apple/files.ts +14 -0
- package/src/plugin/apple/index.ts +5 -0
- package/src/plugin/apple/pod-spec-source-from-cocoapods.ts +9 -0
- package/src/plugin/apple/pod-spec-source-from-git.ts +13 -0
- package/src/plugin/apple/pod-spec-source-from-local.ts +6 -0
- package/src/plugin/context.ts +12 -0
- package/src/plugin/index.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# bundo-appgen
|
|
2
|
+
|
|
3
|
+
Generate native app project for React Native app host easily with a single JavaScript configuration, and a CLI.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Requirements](#requirements)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Usage](#usage)
|
|
10
|
+
- [Configuration File](#configuration-file)
|
|
11
|
+
- [Command Execution](#command-execution)
|
|
12
|
+
- [Background](#background)
|
|
13
|
+
- [Sandboxed Plugin](#sandboxed-plugin)
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Node.js v22 or latest
|
|
18
|
+
- **macOS**
|
|
19
|
+
- [XcodeGen](https://github.com/yonaskolb/xcodegen) latest version for macOS .xcodeproj generator. You can install XcodeGen with Homebrew
|
|
20
|
+
- Ruby v3 or latest
|
|
21
|
+
- [CocoaPods](https://cocoapods.org) dependency manager
|
|
22
|
+
- (Optional) [tsx](https://github.com/privatenumber/tsx) if you want to use TypeScript configuration for `bundo-appgen`
|
|
23
|
+
|
|
24
|
+
Technically, you can use [Bun](https://github.com/oven-sh/bun), but `bundo-appgen` is depending on [Node.js Permission Model](https://nodejs.org/api/permissions.html) for `bundo-appgen` plugins. We may support for [Bun](https://github.com/over-sh/bun) fully until the permission model is supported. See [Bun #6617 issue](https://github.com/oven-sh/bun/issues/6617). You can still use [Bun](https://github.com/oven-sh/bun) for local app development later.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install `bundo-appgen` in your project
|
|
29
|
+
|
|
30
|
+
Bun
|
|
31
|
+
```
|
|
32
|
+
bun install bundo-appgen
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
pnpm
|
|
36
|
+
```
|
|
37
|
+
pnpm install bundo-appgen
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
npm
|
|
41
|
+
```
|
|
42
|
+
npm install bundo-appgen
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Fortunately, you can install `bundo-appgen` in your existing [`react-native-macos`](https://github.com/microsoft/react-native-macos) app, because `bundo-appgen` is a single independent package.
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Configuration File
|
|
50
|
+
|
|
51
|
+
Create `bundo.config.mjs` file that lives beside of your package.json project
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
/**
|
|
55
|
+
* @type {import("bundo-appgen").Config.Data}
|
|
56
|
+
*/
|
|
57
|
+
const config = {
|
|
58
|
+
|
|
59
|
+
name: "Your App Name",
|
|
60
|
+
|
|
61
|
+
macos: {
|
|
62
|
+
bundleIdentifier: "com.yourcompany",
|
|
63
|
+
buildVersion: "1",
|
|
64
|
+
version: "1.0.0",
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default config
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### TypeScript Configuration File
|
|
73
|
+
|
|
74
|
+
You can also use TypeScript config file, but you need [tsx](https://github.com/privatenumber/tsx) installed in your project as development dependency. Create `bundo.config.mts` or `bundo.config.ts` that lives beside of your package.json project
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import {
|
|
78
|
+
Config,
|
|
79
|
+
} from "bundo-appgen"
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
|
|
83
|
+
name: "Your App Name",
|
|
84
|
+
|
|
85
|
+
macos: {
|
|
86
|
+
bundleIdentifier: "com.yourcompany",
|
|
87
|
+
buildVersion: "1",
|
|
88
|
+
version: "1.0.0",
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
} satisfies Config.Data
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Explore other options in the [`Config.Data` type definitions](https://github.com/RakaDoank/bundo.rn/blob/main/packages/bundo-appgen/src/config/data.ts), such as changing app icon, app fonts, Info Plist, etc. We will provide a well documentation later regarding this. You can visit our [development playground](https://github.com/RakaDoank/bundo.rn/blob/main/playground) for your references.
|
|
95
|
+
|
|
96
|
+
### Command Execution
|
|
97
|
+
|
|
98
|
+
`bundo-appgen` provides a command line interface to generate native project directory as a React Native app host. If you have experience with [Expo Continuous Native Generation](https://docs.expo.dev/workflow/continuous-native-generation), this is really similar to the `expo prebuild` command.
|
|
99
|
+
|
|
100
|
+
> :warning: If you are using `bundo-appgen` in your existing [`react-native-macos`](https://github.com/microsoft/react-native-macos) app, backup your entire project first, and remove the "macos" folder.
|
|
101
|
+
|
|
102
|
+
Now, generate your native app project by running this command
|
|
103
|
+
|
|
104
|
+
with Bun
|
|
105
|
+
```bash
|
|
106
|
+
bunx bundo-appgen
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
with pnpm
|
|
110
|
+
```bash
|
|
111
|
+
pnpx bundo-appgen
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
with npm
|
|
115
|
+
```bash
|
|
116
|
+
npx bundo-appgen
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This command is doing these execution steps in order
|
|
120
|
+
|
|
121
|
+
1. Retrieve and evaluate the configuration file
|
|
122
|
+
2. Copy the [native macos template from `bundo-appgen`](https://github.com/RakaDoank/bundo.rn/tree/main/packages/bundo-appgen/template/macos) to your project
|
|
123
|
+
3. Modifying some files to the native template files, such as project renaming
|
|
124
|
+
4. Run `bundo-appgen` plugin runner, and evaluating the result from plugins through IPC child process
|
|
125
|
+
5. Modify some template files, because a plugin may want to customize it
|
|
126
|
+
6. Execute `xcodegen` command to generate .xcodeproj directory
|
|
127
|
+
|
|
128
|
+
Now, you should see "macos" generated folder by the appgen command.
|
|
129
|
+
|
|
130
|
+
Run `bunx bundo-appgen --help` for more informations.
|
|
131
|
+
|
|
132
|
+
## Running the App
|
|
133
|
+
|
|
134
|
+
Register your React entry with `AppRegistry` in your `index.js` file with "**main**" name
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import {
|
|
138
|
+
AppRegistry,
|
|
139
|
+
} from "react-native"
|
|
140
|
+
|
|
141
|
+
import App from "./App"
|
|
142
|
+
|
|
143
|
+
AppRegistry.registerComponent("main", () => App)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Finally, you can run Metro server `bun run start`, and run the app via Xcode.
|
|
147
|
+
|
|
148
|
+
You can also run your app with command
|
|
149
|
+
```
|
|
150
|
+
bunx react-native run-macos --scheme HelloWorld
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The target name ("HelloWorld") is the .xcworkspace folder name without the .xcworkspace in the /macos directory.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Background
|
|
158
|
+
|
|
159
|
+
We want to wrap a native project as a React Native app host easily without hurting so much times by touching the native code or native platform tooling e.g. changing app icon, app metadata, touching native C++, Swift & Objective-C code for upgrading React Native, etc.
|
|
160
|
+
|
|
161
|
+
This package is heavily inspired by the [Expo Continuous Native Generation](https://docs.expo.dev/workflow/continuous-native-generation). Expo does a heavy lifting, and can make developers focus more on providing and delivering the actual product.
|
|
162
|
+
|
|
163
|
+
`bundo-appgen` is also wants to get the same experience like Expo, but the main differentiation from Expo is **keeping each platform configurations separated**, instead of merging the configuration data in a single object configuration. We choose to do this way because it is too difficult to support other platforms such as macOS and Windows, and probably other platforms (like Android) in a single object. What we mean a single object is `bundo-appgen` provides a configuration for macOS and Windows not within the same kind of data or field, instead `bundo-appgen` provides platform configurations individually. This is much easier for prototyping the native app project because each platform have some unique configurations that other platforms don't have, and we can follow each platform requirements much easier.
|
|
164
|
+
|
|
165
|
+
For an example, you can see a configuration file example below
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
import {
|
|
169
|
+
Config,
|
|
170
|
+
} from "bundo-appgen"
|
|
171
|
+
|
|
172
|
+
export default {
|
|
173
|
+
|
|
174
|
+
// the `name` is shared, but overwriting through
|
|
175
|
+
// the platform configuration is still possible,
|
|
176
|
+
// e.g. CFBundleDisplayName in macOS Info.plist
|
|
177
|
+
name: "Hello World App",
|
|
178
|
+
|
|
179
|
+
macos: {
|
|
180
|
+
|
|
181
|
+
appicon: "MyAppIcon",
|
|
182
|
+
|
|
183
|
+
assetCatalog: {
|
|
184
|
+
appiconset: [
|
|
185
|
+
Config.Apple.createOSXappiconset({
|
|
186
|
+
name: "MyAppIcon",
|
|
187
|
+
images: {
|
|
188
|
+
"1024x1024": "./path/to/your-image-1024.png",
|
|
189
|
+
"512x512": "./path/to/your-image-512.png",
|
|
190
|
+
"256x256": "./path/to/your-image-256.png",
|
|
191
|
+
"128x128": "./path/to/your-image-128.png",
|
|
192
|
+
"64x64": "./path/to/your-image-64.png",
|
|
193
|
+
"32x32": "./path/to/your-image-32.png",
|
|
194
|
+
"16x16": "./path/to/your-image-16.png",
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
resources: [
|
|
201
|
+
"./node_modules/ui-module/assets/fonts",
|
|
202
|
+
],
|
|
203
|
+
infoPlist: {
|
|
204
|
+
ATSApplicationFontsPath: "fonts/",
|
|
205
|
+
NSMicrophoneUsageDescription: "We need to access your microphone, no questions!",
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
locales: ["en", "de"]
|
|
209
|
+
|
|
210
|
+
stringCatalogs: {
|
|
211
|
+
InfoPlist: {
|
|
212
|
+
NSMicrophoneUsageDescription: {
|
|
213
|
+
en: "We need to access your microphone, no questions!",
|
|
214
|
+
de: "Wir mussen auf ihr Mikrofon zugreiefen, ohne Wenn und Aber!"
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
windows: {
|
|
222
|
+
// later
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
android: {
|
|
226
|
+
// later
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
plugins: [],
|
|
230
|
+
|
|
231
|
+
} satisfies Config.Data
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`bundo-appgen` is currently supporting macOS. Right after we are sure that our appgen (App Generator) for macOS is fully-ready-stabily, `bundo-appgen` will support the Windows platform, because it is really our primary main focus initially.
|
|
235
|
+
|
|
236
|
+
For Android and iOS, it is better to use [Expo](https://github.com/expo/expo) right now. It provides variety of first party packages in its ecosystem.
|
|
237
|
+
|
|
238
|
+
### Sandboxed Plugin
|
|
239
|
+
|
|
240
|
+
Not to mention, `bundo-appgen` is also sandboxing the plugin invocation. We do not allow a plugin to perform an unrestricted action such as File System, Networking, Child Process, and other actions in Node.js. See [Node.js Permission Model](https://nodejs.org/api/permissions.html).
|
|
241
|
+
|
|
242
|
+
We only allow plugins to run their main function in restricted permission. Currently, we only allow this listed permission for plugin
|
|
243
|
+
- **File System** - **Read only** access to these directories and/or files
|
|
244
|
+
- <project>/macos/HelloWorld/AppDelegate.swift
|
|
245
|
+
- <project>/macos/Podfile
|
|
246
|
+
- node_modules directory lookup relatively from your project and global modules
|
|
247
|
+
- Their own plugin directory
|
|
248
|
+
|
|
249
|
+
A plugin can still modify the templated files, such as `AppDelegate.swift` file for the macOS, but a plugin will only be allowed to modify in a manner way through a raw JavaScript string that `bundo-appgen` gives to their main function, instead of using file system to write. For your references, you can see our [`bundo-window` plugin main function](https://github.com/RakaDoank/bundo.rn/blob/main/packages/bundo-window/_plugin/bundo.plugin.mts) to modify the `AppDelegate.swift` to make the macOS app has no title bar.
|
|
250
|
+
|
|
251
|
+
We create a module that what we called "plugin runner". From the `bundo-appgen` command, it will spawn another Node.js child process with restricted permission to run the plugin runner. The plugin runner will invoke all the plugins main function provided with a JavaScript object (context) argument given. When all the plugin invocation have finished, we send the result to the main process through **Inter Process Communication**, and then, the main process will be responsible to do the actual writing to the template files.
|
|
252
|
+
|
|
253
|
+
We choose this model because we choose the Zero Trust approach. We do not want a plugin performs a malicious action in your machine with reading and writing to any directories (file system), networking, and spawning a child process.
|
package/bin.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const
|
|
4
|
+
isBun =
|
|
5
|
+
typeof Bun !== "undefined"
|
|
6
|
+
|
|
7
|
+
if(isBun) {
|
|
8
|
+
// The ./src/bin/bin.mts is not using an actual Bun specific APIs.
|
|
9
|
+
// This specific condition allows user with Bun runtime and with --bun flag
|
|
10
|
+
// to run the source TypeScript files, such as
|
|
11
|
+
// `bunx --bun bundo appgen` or
|
|
12
|
+
// `bunx --bun bundo-appgen`
|
|
13
|
+
|
|
14
|
+
console.log("> Using bundo-appgen TypeScript source files with Bun 🧄")
|
|
15
|
+
require("./src/_bin/bin.mts").bin(import.meta.dirname)
|
|
16
|
+
} else {
|
|
17
|
+
// @ts-expect-error Use transpiled file
|
|
18
|
+
import("./lib/bin/bin.mjs").then(module => {
|
|
19
|
+
module.bin(import.meta.dirname)
|
|
20
|
+
})
|
|
21
|
+
}
|