@oxy.so/app-preset 1.0.0
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/LICENSE +202 -0
- package/NOTICE +16 -0
- package/README.md +193 -0
- package/app.plugin.js +1 -0
- package/babel/index.js +40 -0
- package/certs/README.md +55 -0
- package/css/base.css +77 -0
- package/eslint/index.js +23 -0
- package/metro/index.js +215 -0
- package/package.json +119 -0
- package/plugin/withOxyAndroidRelease.js +125 -0
- package/plugin/withOxyAndroidWebp.js +198 -0
- package/plugin/withOxyAppPreset.js +74 -0
- package/plugin/withOxyBuildProperties.js +88 -0
- package/plugin/withOxyKeychain.js +35 -0
- package/plugin/withOxyUpdates.js +159 -0
- package/plugin/withSharedUserId.js +36 -0
- package/tsconfig/backend.json +11 -0
- package/tsconfig/base.json +31 -0
- package/tsconfig/frontend.json +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
============================================================================
|
|
2
|
+
NOTICE
|
|
3
|
+
@oxy.so/app-preset
|
|
4
|
+
Copyright (c) 2025-present The Oxy Collective, Inc.
|
|
5
|
+
============================================================================
|
|
6
|
+
|
|
7
|
+
This product is licensed under the Apache License, Version 2.0. See the
|
|
8
|
+
LICENSE file in this directory.
|
|
9
|
+
|
|
10
|
+
----------------------------------------------------------------------------
|
|
11
|
+
THIRD PARTY COMPONENTS
|
|
12
|
+
----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
This package contains no third party source. Its dependencies are resolved
|
|
15
|
+
and installed by the package manager and remain governed by their own
|
|
16
|
+
licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# @oxy.so/app-preset
|
|
2
|
+
|
|
3
|
+
The **Oxy distro of Expo** — the shared configuration every Oxy app (Mention,
|
|
4
|
+
Homiio, Allo, accounts, Commons, …) used to copy-paste, centralized into one
|
|
5
|
+
zero-build package. Apps replace four config-plugin entries, a hand-tuned Metro
|
|
6
|
+
config, a Babel config, an ESLint config, a Tailwind CSS header, and three
|
|
7
|
+
tsconfigs with a single dependency, and pick up ecosystem changes with a version
|
|
8
|
+
bump instead of re-editing every repo.
|
|
9
|
+
|
|
10
|
+
There is no build step: this package ships plain CommonJS config plus static CSS
|
|
11
|
+
and JSON.
|
|
12
|
+
|
|
13
|
+
## What it centralizes
|
|
14
|
+
|
|
15
|
+
| Piece | Import | Replaces |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Config plugin | `['@oxy.so/app-preset', {}]` | `withSharedUserId` + iOS keychain entitlement + `expo-build-properties` + `@oxy.so/services/plugins/withSharedIdentityReader` |
|
|
18
|
+
| Android release build | `@oxy.so/app-preset/plugin/withOxyAndroidRelease` | R8 `-optimize` ProGuard file + shared-keystore release signing (opt-in, see below) |
|
|
19
|
+
| Android WebP resources | `@oxy.so/app-preset/plugin/withOxyAndroidWebp` | re-encoding generated mipmaps/splash bitmaps to real lossless WebP (opt-in, needs `sharp`) |
|
|
20
|
+
| Oxy Updates (OTA) | `@oxy.so/app-preset/plugin/withOxyUpdates` | the `expo-updates` manifest URL, release channel, `runtimeVersion` policy and the shared code-signing certificate (opt-in, see below) |
|
|
21
|
+
| Metro | `@oxy.so/app-preset/metro` | monorepo watch folders, block list, symlink + package-exports resolution, web-font/wasm asset exts, release minifier, NativeWind wrapper |
|
|
22
|
+
| Babel | `@oxy.so/app-preset/babel` | `babel-preset-expo` + `module-resolver` + `react-native-worklets/plugin` |
|
|
23
|
+
| ESLint | `@oxy.so/app-preset/eslint` | `eslint-config-expo/flat` + `dist/*` ignore |
|
|
24
|
+
| CSS base | `@oxy.so/app-preset/base.css` | Tailwind v4 + NativeWind + Bloom design-token imports + SDK `@source` globs |
|
|
25
|
+
| tsconfig | `@oxy.so/app-preset/tsconfig/{base,frontend,backend}.json` | the shared strict/composite TypeScript bases |
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### 1. Config plugin (`app.config.js` / `app.json`)
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
plugins: [
|
|
33
|
+
// …app-specific plugins…
|
|
34
|
+
['@oxy.so/app-preset', {}],
|
|
35
|
+
]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This adds `android:sharedUserId="so.oxy.shared"`, the iOS
|
|
39
|
+
`keychain-access-groups` entitlement (`$(AppIdentifierPrefix)group.so.oxy.shared`),
|
|
40
|
+
the Oxy `expo-build-properties` defaults (iOS `deploymentTarget 16.4`; Android
|
|
41
|
+
`compileSdk 36` / `targetSdk 35` / ProGuard + resource shrinking), and the
|
|
42
|
+
`@oxy.so/services` shared-identity reader plugin (Android signature permission +
|
|
43
|
+
`<queries>` for silent "Sign in with Oxy").
|
|
44
|
+
|
|
45
|
+
Each piece is individually disableable and overridable:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
['@oxy.so/app-preset', {
|
|
49
|
+
sharedUserId: 'so.oxy.shared', // false → skip android:sharedUserId
|
|
50
|
+
keychainGroup: 'group.so.oxy.shared', // false → skip iOS keychain entitlement
|
|
51
|
+
ios: { deploymentTarget: '17.0' }, // deep-merges over defaults; false → skip iOS build props
|
|
52
|
+
android: { targetSdkVersion: 34 }, // deep-merges over defaults; false → skip Android build props
|
|
53
|
+
sharedIdentityReader: true, // false → skip @oxy.so/services reader plugin
|
|
54
|
+
}]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Android release-build plugins (opt-in)
|
|
58
|
+
|
|
59
|
+
These two are deliberately NOT part of `['@oxy.so/app-preset', {}]`: one writes a
|
|
60
|
+
signing config and the other needs `sharp` installed, so both are registered
|
|
61
|
+
explicitly by apps that ship to Play.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
plugins: [
|
|
65
|
+
// FIRST in the array so it RUNS LAST — mods execute in reverse registration
|
|
66
|
+
// order, and this has to run after every image generator (splash included).
|
|
67
|
+
'@oxy.so/app-preset/plugin/withOxyAndroidWebp',
|
|
68
|
+
// …app-specific plugins…
|
|
69
|
+
'@oxy.so/app-preset/plugin/withOxyAndroidRelease',
|
|
70
|
+
]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`withOxyAndroidRelease` reads the release keystore from four Gradle properties
|
|
74
|
+
(`OXY_UPLOAD_STORE_FILE`, `OXY_UPLOAD_STORE_PASSWORD`, `OXY_UPLOAD_KEY_ALIAS`,
|
|
75
|
+
`OXY_UPLOAD_KEY_PASSWORD`) in `~/.gradle/gradle.properties` or CI secrets — never
|
|
76
|
+
from the repo. When they are absent the release buildType falls back to the debug
|
|
77
|
+
keystore, so **always verify the artefact's certificate** (`keytool -printcert
|
|
78
|
+
-jarfile <aab>`, `apksigner verify --print-certs <apk>`) instead of assuming.
|
|
79
|
+
|
|
80
|
+
`withOxyAndroidWebp` requires `sharp` as a devDependency of the app.
|
|
81
|
+
|
|
82
|
+
#### Oxy Updates (OTA) (opt-in)
|
|
83
|
+
|
|
84
|
+
`withOxyUpdates` points `expo-updates` at the self-hosted **Oxy Updates** server
|
|
85
|
+
(`/updates/v1` in oxy-api) and wires the ecosystem code-signing certificate. It is
|
|
86
|
+
opt-in because it needs the app's own registered client id.
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
plugins: [
|
|
90
|
+
['@oxy.so/app-preset/plugin/withOxyUpdates', { clientId: OXY_CLIENT_ID }],
|
|
91
|
+
]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Prerequisites in the app: `expo-updates` as a dependency (at the version
|
|
95
|
+
`expo install expo-updates` resolves for its SDK), and a registered
|
|
96
|
+
`ApplicationCredential` publicKey (`oxy_dk_...`), normally already present as an
|
|
97
|
+
`EXPO_PUBLIC_OXY_CLIENT_ID`-backed constant because the same id identifies the app
|
|
98
|
+
to the session and OAuth flows. `expo-updates` needs no plugin entry of its own:
|
|
99
|
+
prebuild applies its config plugin automatically.
|
|
100
|
+
|
|
101
|
+
| Option | Default | Meaning |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| `clientId` | required | The registered `ApplicationCredential` publicKey |
|
|
104
|
+
| `apiOrigin` | `https://api.oxy.so` | Origin serving `/updates/v1` |
|
|
105
|
+
| `channel` | `production` | Release channel this binary polls |
|
|
106
|
+
| `codeSigning` | `require` | Fails when the certificate is missing; `auto` warns and `false` skips signing (development only) |
|
|
107
|
+
| `certificatePath` | bundled certificate | Only for a key-rotation overlap |
|
|
108
|
+
| `runtimeVersionPolicy` | `appVersion` | `false` leaves whatever the app declared |
|
|
109
|
+
|
|
110
|
+
**runtimeVersion is the `appVersion` policy on purpose.** It is the only policy the
|
|
111
|
+
Oxy toolchain resolves end to end: `oxy-ship` derives the publish runtime from
|
|
112
|
+
`expo config --json --type public`, where `fingerprint` resolves only to the
|
|
113
|
+
sentinel `file:fingerprint` (it is a build-time value), so a fingerprint app would
|
|
114
|
+
need `--runtime-version` passed by hand on every publish. The rule that follows:
|
|
115
|
+
**the app `version` is the OTA compatibility boundary. Bump it whenever native
|
|
116
|
+
code changes.** Installs on the old `version` then correctly stop receiving
|
|
117
|
+
updates published under the new one; installs on an unbumped version would
|
|
118
|
+
receive JS assuming native modules they do not have.
|
|
119
|
+
|
|
120
|
+
**Code signing is one certificate for the whole ecosystem**, shipped in this
|
|
121
|
+
package at `certs/oxy-updates-code-signing.pem` rather than copied into each app
|
|
122
|
+
repo, so a rotation is one preset bump. See `certs/README.md` for how it is
|
|
123
|
+
generated and rotated. Until that file exists, `withOxyUpdates` fails the build
|
|
124
|
+
by default rather than producing a binary that accepts unsigned manifests for
|
|
125
|
+
its whole lifetime. Development builds may explicitly pass
|
|
126
|
+
`{ codeSigning: 'auto' }` to receive platform warnings, or
|
|
127
|
+
`{ codeSigning: false }` to opt out of verification.
|
|
128
|
+
|
|
129
|
+
Publishing is `oxy-ship` (`@oxy.so/ship`); see that package's README and its
|
|
130
|
+
`templates/publish-update.yml` CI workflow.
|
|
131
|
+
|
|
132
|
+
### 2. Metro (`metro.config.js`)
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
const { createOxyMetroConfig } = require('@oxy.so/app-preset/metro');
|
|
136
|
+
|
|
137
|
+
module.exports = createOxyMetroConfig(__dirname, {
|
|
138
|
+
sharedTypesPackage: '@myapp/shared-types', // optional
|
|
139
|
+
cssInput: './global.css', // optional, this is the default
|
|
140
|
+
dropConsole: true, // optional, production web only
|
|
141
|
+
// svgTransformerPath: require.resolve('react-native-svg-transformer/expo'),
|
|
142
|
+
// extraBlockList: [path.join(__dirname, '../../.claude/worktrees')],
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`extraBlockList` accepts regular expressions or directory paths. Directory
|
|
147
|
+
paths are escaped and block only their descendants. `extraNodeModules`,
|
|
148
|
+
`extraWatchFolders`, `extraAssetExts`, and `extraSourceExts` extend the shared
|
|
149
|
+
defaults without replacing them.
|
|
150
|
+
|
|
151
|
+
### 3. Babel (`babel.config.js`)
|
|
152
|
+
|
|
153
|
+
```js
|
|
154
|
+
module.exports = require('@oxy.so/app-preset/babel');
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 4. ESLint (`eslint.config.js`)
|
|
158
|
+
|
|
159
|
+
```js
|
|
160
|
+
const oxyConfig = require('@oxy.so/app-preset/eslint');
|
|
161
|
+
module.exports = [...oxyConfig];
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 5. CSS (`global.css`)
|
|
165
|
+
|
|
166
|
+
```css
|
|
167
|
+
@import "@oxy.so/app-preset/base.css";
|
|
168
|
+
|
|
169
|
+
/* App-specific globs (later rules win on overlap): */
|
|
170
|
+
@source "./app/**/*.{js,jsx,ts,tsx}";
|
|
171
|
+
@source "./components/**/*.{js,jsx,ts,tsx}";
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 6. TypeScript (`tsconfig.json`)
|
|
175
|
+
|
|
176
|
+
```jsonc
|
|
177
|
+
// frontend
|
|
178
|
+
{ "extends": "@oxy.so/app-preset/tsconfig/frontend.json", "compilerOptions": { "paths": { "@/*": ["./*"] } }, "include": ["**/*.ts", "**/*.tsx"] }
|
|
179
|
+
// backend
|
|
180
|
+
{ "extends": "@oxy.so/app-preset/tsconfig/backend.json", "compilerOptions": { "rootDir": "./", "outDir": "dist" }, "include": ["**/*.ts"] }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Peer dependencies
|
|
184
|
+
|
|
185
|
+
All peers are **optional** except `expo` — a piece's peer is only needed when you
|
|
186
|
+
use that piece (e.g. `expo-build-properties` only when build properties are
|
|
187
|
+
enabled, `eslint-config-expo` only for the ESLint config). The config plugin and
|
|
188
|
+
factories throw a clear, actionable error if a required peer is missing.
|
|
189
|
+
|
|
190
|
+
## Compatibility
|
|
191
|
+
|
|
192
|
+
Requires **Expo SDK 56+**; validated against **Expo SDK 57 / React Native 0.86**
|
|
193
|
+
(the current Oxy ecosystem target) via `test-app-expo`.
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/withOxyAppPreset');
|
package/babel/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oxy.so/app-preset — Babel config factory.
|
|
3
|
+
*
|
|
4
|
+
* The standard Babel config every Oxy Expo app shares: babel-preset-expo with
|
|
5
|
+
* `unstable_transformImportMeta`, the `@ → ./` module-resolver alias, and the
|
|
6
|
+
* `react-native-worklets/plugin` LAST (Reanimated 4 re-exports it — it must be
|
|
7
|
+
* the final plugin).
|
|
8
|
+
*
|
|
9
|
+
* Usage — a one-line babel.config.js:
|
|
10
|
+
*
|
|
11
|
+
* module.exports = require('@oxy.so/app-preset/babel');
|
|
12
|
+
*
|
|
13
|
+
* The peer packages (`babel-preset-expo`, `babel-plugin-module-resolver`,
|
|
14
|
+
* `react-native-worklets`) resolve from the consuming app's node_modules, where
|
|
15
|
+
* Expo already installs them.
|
|
16
|
+
*
|
|
17
|
+
* @param {import('@babel/core').ConfigAPI} api
|
|
18
|
+
* @returns {import('@babel/core').TransformOptions}
|
|
19
|
+
*/
|
|
20
|
+
module.exports = function oxyBabelPreset(api) {
|
|
21
|
+
api.cache(true);
|
|
22
|
+
return {
|
|
23
|
+
presets: [
|
|
24
|
+
['babel-preset-expo', { unstable_transformImportMeta: true }],
|
|
25
|
+
],
|
|
26
|
+
plugins: [
|
|
27
|
+
// The module-resolver must come first for correct module resolution.
|
|
28
|
+
[
|
|
29
|
+
'module-resolver',
|
|
30
|
+
{
|
|
31
|
+
root: ['./'],
|
|
32
|
+
alias: { '@': './' },
|
|
33
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.svg'],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
// Must be LAST.
|
|
37
|
+
'react-native-worklets/plugin',
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
};
|
package/certs/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Oxy Updates code-signing certificate
|
|
2
|
+
|
|
3
|
+
`withOxyUpdates` looks for exactly one file in this directory:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
oxy-updates-code-signing.pem
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
It is the **public** half of the Oxy Updates code-signing keypair. It is safe to
|
|
10
|
+
commit, and it lives here rather than in each app repo so that a key rotation is
|
|
11
|
+
one `@oxy.so/app-preset` bump instead of one edit per app.
|
|
12
|
+
|
|
13
|
+
The file is absent until the ecosystem keypair is generated. While it is absent,
|
|
14
|
+
`withOxyUpdates` fails closed by default so an OTA-enabled production binary cannot
|
|
15
|
+
be built without manifest signature verification. Development builds can explicitly
|
|
16
|
+
select `codeSigning: 'auto'` (warning) or `codeSigning: false` (no verification).
|
|
17
|
+
|
|
18
|
+
## Provisioning (one time, by the platform owner)
|
|
19
|
+
|
|
20
|
+
From `packages/api` in the OxyHQServices repo:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun scripts/generate-updates-code-signing.ts \
|
|
24
|
+
../app-preset/certs/oxy-updates-code-signing.pem
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
That writes the certificate here and prints the base64-encoded private key PEM to
|
|
28
|
+
stdout. Then:
|
|
29
|
+
|
|
30
|
+
1. Set the printed value as the GitHub Actions secret
|
|
31
|
+
`UPDATES_CODE_SIGNING_PRIVATE_KEY` on the OxyHQServices repo. The deploy
|
|
32
|
+
workflow syncs it to SSM `/oxy/oxy-api/UPDATES_CODE_SIGNING_PRIVATE_KEY`, and
|
|
33
|
+
oxy-api reads it in `services/updates/signing.service.ts`.
|
|
34
|
+
2. Commit **only** the certificate. The private key is never written to disk by
|
|
35
|
+
the script and must never enter the repo.
|
|
36
|
+
3. Clear the terminal scrollback.
|
|
37
|
+
|
|
38
|
+
Verify the server picked it up: a manifest request that asks for a signature must
|
|
39
|
+
stop returning HTTP 500.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
curl -s -o /dev/null -w '%{http_code}\n' \
|
|
43
|
+
-H 'expo-protocol-version: 1' -H 'expo-platform: ios' \
|
|
44
|
+
-H 'expo-runtime-version: 1.0.0' -H 'expo-channel-name: production' \
|
|
45
|
+
-H 'expo-expect-signature: sig, keyid="main", alg="rsa-v1_5-sha256"' \
|
|
46
|
+
https://api.oxy.so/updates/v1/apps/<clientId>/manifest
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Rotation
|
|
50
|
+
|
|
51
|
+
The certificate is baked into a native binary at build time, so a rotation only
|
|
52
|
+
reaches devices that install a NEW binary carrying the new certificate. Rotate by
|
|
53
|
+
generating a new pair, shipping the new certificate in a store release first, and
|
|
54
|
+
only switching the server's private key once that release has taken over. Devices
|
|
55
|
+
still on the old binary will reject manifests signed by the new key.
|
package/css/base.css
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* @oxy.so/app-preset — Tailwind v4 + NativeWind base stylesheet.
|
|
2
|
+
*
|
|
3
|
+
* The shared CSS header every Oxy Expo app used to copy-paste: the Tailwind v4
|
|
4
|
+
* layer imports, NativeWind's theme, and Bloom's canonical design tokens
|
|
5
|
+
* (RADIUS scale, spacing, typography, color aliases — the single source of
|
|
6
|
+
* truth generated from `bloomThemeCss()`), plus the `@source` globs that scan
|
|
7
|
+
* the Oxy SDK packages for class names.
|
|
8
|
+
*
|
|
9
|
+
* Import it at the TOP of the app's global.css, then add the app-specific
|
|
10
|
+
* `@source` globs and `@theme` overrides below it (later rules win on overlap):
|
|
11
|
+
*
|
|
12
|
+
* @import "@oxy.so/app-preset/base.css";
|
|
13
|
+
*
|
|
14
|
+
* @source "./app/**\/*.{js,jsx,ts,tsx}";
|
|
15
|
+
* @source "./components/**\/*.{js,jsx,ts,tsx}";
|
|
16
|
+
*
|
|
17
|
+
* WIRING (required — two steps, or the WEB build ships ZERO utility CSS):
|
|
18
|
+
* 1. Add `postcss.config.mjs` at the app root:
|
|
19
|
+
* export default { plugins: { "@tailwindcss/postcss": {} } };
|
|
20
|
+
* This is what actually RUNS Tailwind v4 over this file during the Metro/Expo
|
|
21
|
+
* web build. Without it, `@tailwind` / `@utility` / `@theme` pass through
|
|
22
|
+
* UNPROCESSED and no `.flex-row` / `.bg-primary` / `.gap-*` rules are emitted.
|
|
23
|
+
* 2. Import the app's global.css from code (e.g. `import '../global.css'` at the
|
|
24
|
+
* top of `app/_layout.tsx`). The `input`/`cssInput` Metro option is NOT what
|
|
25
|
+
* compiles it — react-native-css keys off the code-level import.
|
|
26
|
+
* Skip either and react-native-css still stamps `className` tokens onto the DOM,
|
|
27
|
+
* but with no backing rules every className layout utility is inert on web and
|
|
28
|
+
* react-native-web's unlayered base View reset shows through (flex-direction:
|
|
29
|
+
* column, flex-shrink:0, padding:0). Colours look "fine" only because Bloom sets
|
|
30
|
+
* those via inline style, not className. Compiled utilities are UNLAYERED and, in
|
|
31
|
+
* an Expo static export, sit AFTER the react-native-web stylesheet in <head>, so
|
|
32
|
+
* they win the cascade over that same-specificity base reset.
|
|
33
|
+
*
|
|
34
|
+
* The SDK `@source` globs below are RELATIVE TO THIS FILE's location. Published,
|
|
35
|
+
* this file lives at `node_modules/@oxy.so/app-preset/css/base.css`, so
|
|
36
|
+
* `../../services/lib` resolves to `node_modules/@oxy.so/services/lib` and
|
|
37
|
+
* `../../bloom/lib` to `node_modules/@oxy.so/bloom/lib` — @oxy.so/app-preset,
|
|
38
|
+
* @oxy.so/services and @oxy.so/bloom are siblings under `@oxy.so/`. In the source
|
|
39
|
+
* monorepo `../../services/lib` still lands on `packages/services/lib`, but
|
|
40
|
+
* `@oxy.so/bloom` is npm-only (no `packages/bloom`), so the extra
|
|
41
|
+
* `../../../node_modules/@oxy.so/bloom/lib` fallback covers that layout. */
|
|
42
|
+
|
|
43
|
+
@import "tailwindcss/theme.css" layer(theme);
|
|
44
|
+
@import "tailwindcss/preflight.css" layer(base);
|
|
45
|
+
@import "tailwindcss/utilities.css";
|
|
46
|
+
@import "nativewind/theme";
|
|
47
|
+
@import "@oxy.so/bloom/design-tokens/theme.css";
|
|
48
|
+
|
|
49
|
+
/* NativeWind's `theme.css` ships an UNLAYERED `:root { @media ios { --font-sans: System } }`.
|
|
50
|
+
Anything an app declares in `@theme` compiles into `@layer theme`, and unlayered
|
|
51
|
+
beats layered — so WITHOUT this block `className="font-sans"` silently resolves to
|
|
52
|
+
the SYSTEM face on native, whatever Bloom or the app says. Restating the family
|
|
53
|
+
here, unlayered and AFTER that import, is the only thing that wins.
|
|
54
|
+
|
|
55
|
+
Native gets the BARE family name on purpose: React Native's `fontFamily` takes ONE
|
|
56
|
+
family, not a CSS stack, so a comma-separated fallback list is invalid there. The
|
|
57
|
+
`var()` fallback is for the web static export's first paint, before Bloom's
|
|
58
|
+
`applyFontFaces()` has injected `--bloom-font-sans` at runtime.
|
|
59
|
+
|
|
60
|
+
This is a deliberate exception to "never restate a token Bloom defines": the
|
|
61
|
+
restatement is not a re-skin, it is what stops NativeWind's own unlayered default
|
|
62
|
+
from overriding Bloom. Do not "tidy" it away. */
|
|
63
|
+
:root {
|
|
64
|
+
--font-sans: var(--bloom-font-sans, BlomusModernus, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
|
|
65
|
+
|
|
66
|
+
@media ios {
|
|
67
|
+
--font-sans: BlomusModernus;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media android {
|
|
71
|
+
--font-sans: BlomusModernus;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@source "../../services/lib/**/*.{js,jsx}";
|
|
76
|
+
@source "../../bloom/lib/**/*.{js,jsx}";
|
|
77
|
+
@source "../../../node_modules/@oxy.so/bloom/lib/**/*.{js,jsx}";
|
package/eslint/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oxy.so/app-preset — flat ESLint config.
|
|
3
|
+
*
|
|
4
|
+
* `eslint-config-expo/flat` plus the shared `dist/*` ignore. Consumers spread
|
|
5
|
+
* it and append their own rules:
|
|
6
|
+
*
|
|
7
|
+
* const oxyConfig = require('@oxy.so/app-preset/eslint');
|
|
8
|
+
* module.exports = [...oxyConfig];
|
|
9
|
+
*
|
|
10
|
+
* `eslint` and `eslint-config-expo` resolve from the consuming app's
|
|
11
|
+
* node_modules (both are optional peers of the preset).
|
|
12
|
+
*
|
|
13
|
+
* @type {import('eslint').Linter.Config[]}
|
|
14
|
+
*/
|
|
15
|
+
const { defineConfig } = require('eslint/config');
|
|
16
|
+
const expoConfig = require('eslint-config-expo/flat');
|
|
17
|
+
|
|
18
|
+
module.exports = defineConfig([
|
|
19
|
+
expoConfig,
|
|
20
|
+
{
|
|
21
|
+
ignores: ['dist/*'],
|
|
22
|
+
},
|
|
23
|
+
]);
|