@blotch/angular-lynx-native 22.2.19 → 22.2.21
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 +4 -4
- package/dist/android/icon.d.ts +29 -0
- package/dist/android/icon.d.ts.map +1 -0
- package/dist/android/icon.js +142 -0
- package/dist/android/project.d.ts +2 -1
- package/dist/android/project.d.ts.map +1 -1
- package/dist/android/project.js +5 -2
- package/dist/generate.d.ts +2 -2
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +11 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/ios/build.d.ts +55 -12
- package/dist/ios/build.d.ts.map +1 -1
- package/dist/ios/build.js +203 -42
- package/dist/ios/iphone.d.ts +99 -0
- package/dist/ios/iphone.d.ts.map +1 -0
- package/dist/ios/iphone.js +204 -0
- package/dist/ios/project.d.ts +2 -0
- package/dist/ios/project.d.ts.map +1 -1
- package/dist/ios/project.js +10 -1
- package/dist/ios/run.d.ts +17 -2
- package/dist/ios/run.d.ts.map +1 -1
- package/dist/ios/run.js +30 -4
- package/dist/options.d.ts +49 -3
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +33 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +6 -0
- package/dist/png.d.ts +38 -0
- package/dist/png.d.ts.map +1 -1
- package/dist/png.js +167 -0
- package/dist/run.d.ts +12 -4
- package/dist/run.d.ts.map +1 -1
- package/package.json +5 -1
- package/templates/android/README.md +5 -1
- package/templates/android/app/src/main/AndroidManifest.xml +16 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +16 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShareModule.kt +274 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +57 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +95 -0
- package/templates/android/app/src/main/res/mipmap/ic_launcher_round.xml +6 -0
- package/templates/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/templates/android/app/src/main/res/xml/share_paths.xml +8 -0
- package/templates/ios/App/AngularLynxWebGL.h +7 -0
- package/templates/ios/App/AngularLynxWebGL.m +27 -0
- package/templates/ios/App/AngularLynxWebGLContext.m +139 -0
- package/templates/ios/App/LynxViewController.swift +2 -0
- package/templates/ios/App/ShareModule.swift +215 -0
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ User documentation: [Publishing your App](../website/docs/guide/building-for-pro
|
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
|
-
1. **Generates** the native project from `templates/ios` or `templates/android` into the project's folder in Angular's build cache (`.angular/cache/<Angular version>/<project>/lynx-native/<platform>`, which `ng new` already gitignores and `ng cache clean` clears), writing the app options from `angular.json` into the few files the templates mark for it. It regenerates only when a hash of its inputs changes (this package's version, the template, the options, the icon), so Xcode and Gradle keep their incremental state.
|
|
9
|
+
1. **Generates** the native project from `templates/ios` or `templates/android` into the project's folder in Angular's build cache (`.angular/cache/<Angular version>/<project>/lynx-native/<platform>`, which `ng new` already gitignores and `ng cache clean` clears), writing the app options from `angular.json` into the few files the templates mark for it. It regenerates only when a hash of its inputs changes (this package's version, the template, the options, the icon images), so Xcode and Gradle keep their incremental state.
|
|
10
10
|
2. **Copies** `dist/` (without the web bundle) into the project.
|
|
11
11
|
3. **Builds** it with `xcodebuild` or Gradle and copies the binaries to `dist/<platform>/`.
|
|
12
|
-
4. **Runs** it, with `--run` (`src/ios/run.ts`, `src/android/run.ts`): picks a simulator, emulator or phone (`--device`, else a running one, else the newest iPhone simulator or the first AVD) and starts it before step 3, so it boots while the app compiles; then installs the app and opens it. iOS uses `simctl` and shows the simulator in DeviceHub (`devices://device/open?id=<UDID>`) or, before Xcode 27.1, the Simulator app. Android uses the SDK's `adb` and `emulator` and opens the launcher activity by component.
|
|
12
|
+
4. **Runs** it, with `--run` (`src/ios/run.ts`, `src/android/run.ts`): picks a simulator, emulator or phone (`--device`, else a running one, else the newest iPhone simulator or the first AVD) and starts it before step 3, so it boots while the app compiles; then installs the app and opens it. iOS uses `simctl` and shows the simulator in DeviceHub (`devices://device/open?id=<UDID>`) or, before Xcode 27.1, the Simulator app. When `--device` names a paired iPhone (`src/ios/iphone.ts`, found with `devicectl list devices`), step 3 builds a development-signed `-sdk iphoneos` app for it instead (`ios.teamId`, `-allowProvisioningUpdates`), and `devicectl` installs and opens it. Android uses the SDK's `adb` and `emulator` and opens the launcher activity by component.
|
|
13
13
|
|
|
14
14
|
An ejected project (`ios/` or `android/` with a `.angular-lynx-ejected` marker, written by `ng generate @blotch/angular-lynx:eject`) is built as it is and never regenerated.
|
|
15
15
|
|
|
@@ -19,13 +19,13 @@ Both are one full-screen `LynxView` running `main.lynx.bundle`; Angular Router d
|
|
|
19
19
|
|
|
20
20
|
Both send the same global props, which the runtime's services read: `platform`, `theme` (again whenever the phone switches between light and dark), `appLocale` (the phone's language as a BCP 47 tag), `appTimeZone` (its time zone's IANA name, which the `intl` build option's `Intl.DateTimeFormat` uses), `isNotchScreen`, `edgeToEdge`, the safe-area insets `safeAreaTop`, `safeAreaBottom`, `safeAreaLeft` and `safeAreaRight` (again whenever they change), `osVersion` (which Lynx leaves out of the main thread's `SystemInfo`), and the accessibility settings `reduceMotion`, `reduceTransparency` (iOS only) and `increaseContrast`, again whenever the user changes one. Android 12 and later also send `dynamicColors`, the wallpaper's Material 3 color roles in light and dark (`DynamicColors.kt`), again when the user changes their wallpaper or colors. Lynx Explorer sends `theme` and `isNotchScreen` too, but no `appLocale`, `appTimeZone`, `osVersion` or accessibility settings. See [`templates/android/README.md`](templates/android/README.md) for the Android shell's details.
|
|
21
21
|
|
|
22
|
-
Both register the native modules the runtime's services call, which Lynx Explorer doesn't have: `AngularLynxWebAuth` (`WebAuthModule.swift`, `WebAuthModule.kt`) opens `LynxWebAuthSession`'s sign-in page, in `ASWebAuthenticationSession` on iOS and a Custom Tab on Android, and returns the URL it redirects to. `AngularLynxLocalStorage` (`LocalStorageModule.swift`, `LocalStorageModule.kt`) keeps `LynxLocalStorage`'s values in a `UserDefaults` suite and a `SharedPreferences` file of their own. `AngularLynxSecureStorage` (`SecureStorageModule.swift`, `SecureStorageModule.kt`) keeps `LynxSecureStorage`'s in the Keychain on iOS and, on Android, in `SharedPreferences`, each value encrypted with AES-GCM by an Android Keystore key, a file Auto Backup leaves out (`res/xml/backup_rules.xml`, `data_extraction_rules.xml`). `AngularLynxLinking` (`LinkingModule.swift`, `LinkingModule.kt`) opens `LynxLinking`'s links: `openURL` with `UIApplication.open` and an `ACTION_VIEW` intent, `openInApp` in `SFSafariViewController` and a Custom Tab, and `canOpenURL` with `UIApplication.canOpenURL` and `resolveActivity`, which answer only for the schemes the generator writes from angular.json's `canOpenURLSchemes` (with `http`, `https`, `mailto`, `tel` and `sms`) into Info.plist's `LSApplicationQueriesSchemes` and the manifest's `<queries>`. `AngularLynxImagePicker` (`ImagePickerModule.swift`, `ImagePickerModule.kt`) lets the person pick a photo for `LynxImagePicker`, with `PHPickerViewController` on iOS and the Photo Picker on Android, neither of which needs a permission, and calls back with it as base64, re-encoded as an upright JPEG when the app asks for a smaller one or the photo is a format such as HEIC. Android also has `AngularLynxShell`, for the back button.
|
|
22
|
+
Both register the native modules the runtime's services call, which Lynx Explorer doesn't have: `AngularLynxWebAuth` (`WebAuthModule.swift`, `WebAuthModule.kt`) opens `LynxWebAuthSession`'s sign-in page, in `ASWebAuthenticationSession` on iOS and a Custom Tab on Android, and returns the URL it redirects to. `AngularLynxLocalStorage` (`LocalStorageModule.swift`, `LocalStorageModule.kt`) keeps `LynxLocalStorage`'s values in a `UserDefaults` suite and a `SharedPreferences` file of their own. `AngularLynxSecureStorage` (`SecureStorageModule.swift`, `SecureStorageModule.kt`) keeps `LynxSecureStorage`'s in the Keychain on iOS and, on Android, in `SharedPreferences`, each value encrypted with AES-GCM by an Android Keystore key, a file Auto Backup leaves out (`res/xml/backup_rules.xml`, `data_extraction_rules.xml`). `AngularLynxLinking` (`LinkingModule.swift`, `LinkingModule.kt`) opens `LynxLinking`'s links: `openURL` with `UIApplication.open` and an `ACTION_VIEW` intent, `openInApp` in `SFSafariViewController` and a Custom Tab, and `canOpenURL` with `UIApplication.canOpenURL` and `resolveActivity`, which answer only for the schemes the generator writes from angular.json's `canOpenURLSchemes` (with `http`, `https`, `mailto`, `tel` and `sms`) into Info.plist's `LSApplicationQueriesSchemes` and the manifest's `<queries>`. `AngularLynxImagePicker` (`ImagePickerModule.swift`, `ImagePickerModule.kt`) lets the person pick a photo for `LynxImagePicker`, with `PHPickerViewController` on iOS and the Photo Picker on Android, neither of which needs a permission, and calls back with it as base64, re-encoded as an upright JPEG when the app asks for a smaller one or the photo is a format such as HEIC. `AngularLynxShare` (`ShareModule.swift`, `ShareModule.kt`) opens `LynxShare`'s share sheet, `UIActivityViewController` on iOS and an `ACTION_SEND` chooser on Android, with the files written to temporary files on iOS and shared through a `FileProvider` on Android. Save Image on iOS needs `NSPhotoLibraryAddUsageDescription`, which the generator always writes (angular.json's `permissions.savePhotos`, with a default). Android also has `AngularLynxShell`, for the back button.
|
|
23
23
|
|
|
24
24
|
`AngularLynxClipboard` (`ClipboardModule.swift`, `ClipboardModule.kt`) copies `LynxClipboard`'s text to `UIPasteboard.general` on iOS and `ClipboardManager` on Android, and reads it back.
|
|
25
25
|
|
|
26
26
|
Both link Lynx's XElement library, which holds `<input>`, `<textarea>`, `<overlay>`, `<svg>`, `<blur-view>`, `<viewpager>`, `<refresh>`, the `<scroll-coordinator>` family, `<webview>` and `<video>`. Lynx's core doesn't include these, and a host that doesn't register them renders nothing for those tags (on Android, nothing after them either). XElement's AnimaX and Markdown elements are left out: the runtime doesn't support them. On iOS, `<blur-view>` is XElement's with more of UIKit in it (`App/BlurView.swift`): a `blur-material` attribute for UIKit's adaptive blur materials, which the glass components draw their design before iOS 26 on (Lynx's blur-view has only the styles from before iOS 13); Liquid Glass that materializes, dissolves and eases between effects inside a `glass-container`, where Lynx's sets its effect at once; and a `glass-effect-id` attribute that pairs two glass shapes across a change so one morphs into the other (`App/GlassTransitions.swift`).
|
|
27
27
|
|
|
28
|
-
Both have `<canvas>` with WebGL2 (issue #211), which Lynx doesn't: a `canvas` element (`App/AngularLynxWebGL.m`'s `AngularLynxCanvas`, a `CAMetalLayer` view; `CanvasUI.kt`, a `TextureView`) and the `AngularLynxWebGL` module the runtime's WebGL2 context sends its calls to, which runs them on OpenGL ES 3.0 (`App/AngularLynxWebGLContext.m`, `WebGLContext.kt`). On iOS that's [ANGLE](https://chromium.googlesource.com/angle/angle)'s OpenGL ES, on Metal, which Safari draws WebGL with too: iOS's own OpenGL ES is deprecated, and the Simulator runs it on the CPU, at seconds a frame for a lit three.js scene (issue #238), where Metal draws on the Mac's GPU. ANGLE's `libEGL` and `libGLESv2` frameworks, and its headers, come in the Lynx frameworks zip (below). Android's OpenGL ES is the phone's, which the emulator already runs on the Mac's GPU. The runtime runs on Lynx's main thread and WebGL needs answers synchronously, so both turn on main-thread modules (`enableMTSModule`): the config's modules are then callable from main-thread JavaScript as `lynx.module(name)`. `AngularLynxAssets` (`App/AssetsModule.swift`, `AssetsModule.kt`) reads a file the app bundles for the main thread's `fetch`, which has no page URL to resolve `/static/...` against. The command numbers the WebGL module reads (`App/AngularLynxWebGLOps.h`, `WebGLOps.kt`) are generated from the runtime's `canvas/webgl-ops.ts` with `npm run generate:webgl-ops -w packages/native`; `scripts/webgl-ops.test.ts` fails when they're stale. UIKit's module imports Apple's OpenGL ES headers into every file, so `AngularLynxWebGLContext.m` turns off their deprecation warnings, which land on ANGLE's functions of the same names; the explicit link to `libGLESv2` comes before UIKit's automatic one to OpenGLES, so those calls bind to ANGLE.
|
|
28
|
+
Both have `<canvas>` with WebGL2 (issue #211), which Lynx doesn't: a `canvas` element (`App/AngularLynxWebGL.m`'s `AngularLynxCanvas`, a `CAMetalLayer` view; `CanvasUI.kt`, a `TextureView`) and the `AngularLynxWebGL` module the runtime's WebGL2 context sends its calls to, which runs them on OpenGL ES 3.0 (`App/AngularLynxWebGLContext.m`, `WebGLContext.kt`). On iOS that's [ANGLE](https://chromium.googlesource.com/angle/angle)'s OpenGL ES, on Metal, which Safari draws WebGL with too: iOS's own OpenGL ES is deprecated, and the Simulator runs it on the CPU, at seconds a frame for a lit three.js scene (issue #238), where Metal draws on the Mac's GPU. ANGLE's `libEGL` and `libGLESv2` frameworks, and its headers, come in the Lynx frameworks zip (below). Android's OpenGL ES is the phone's, which the emulator already runs on the Mac's GPU. The runtime runs on Lynx's main thread and WebGL needs answers synchronously, so both turn on main-thread modules (`enableMTSModule`): the config's modules are then callable from main-thread JavaScript as `lynx.module(name)`. The WebGL module's `encodeImage`, behind `canvas.toBlob()` and `toDataURL()`, reads the drawing buffer and encodes it as a PNG or JPEG with ImageIO or `Bitmap.compress`; on iOS it reads through a pixel pack buffer, since ANGLE on Metal reads straight into memory many times slower. `AngularLynxAssets` (`App/AssetsModule.swift`, `AssetsModule.kt`) reads a file the app bundles for the main thread's `fetch`, which has no page URL to resolve `/static/...` against. The command numbers the WebGL module reads (`App/AngularLynxWebGLOps.h`, `WebGLOps.kt`) are generated from the runtime's `canvas/webgl-ops.ts` with `npm run generate:webgl-ops -w packages/native`; `scripts/webgl-ops.test.ts` fails when they're stale. UIKit's module imports Apple's OpenGL ES headers into every file, so `AngularLynxWebGLContext.m` turns off their deprecation warnings, which land on ANGLE's functions of the same names; the explicit link to `libGLESv2` comes before UIKit's automatic one to OpenGLES, so those calls bind to ANGLE.
|
|
29
29
|
|
|
30
30
|
| | iOS | Android |
|
|
31
31
|
| ---------------- | ---------------------------------------------------- | -------------------------------------------------------- |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ResolvedApp } from '../options.ts';
|
|
2
|
+
/** Each density's scale from dp to px, as Android names its folders. */
|
|
3
|
+
export declare const DENSITIES: Readonly<Record<string, number>>;
|
|
4
|
+
/**
|
|
5
|
+
* Writes the app's launcher icon into the project's resources, from the
|
|
6
|
+
* `icon` option (and `android.adaptiveIcon`'s layers):
|
|
7
|
+
*
|
|
8
|
+
* - `mipmap-<density>/ic_launcher.png` and `ic_launcher_round.png`, the flat
|
|
9
|
+
* icons Android 7 shows, square and round;
|
|
10
|
+
* - `mipmap-anydpi-v26/ic_launcher.xml` and `ic_launcher_round.xml`, the
|
|
11
|
+
* adaptive icon Android 8 and later show, with its layers as
|
|
12
|
+
* `mipmap-<density>/ic_launcher_foreground.png` and
|
|
13
|
+
* `ic_launcher_background.png`, or a color in `values/`.
|
|
14
|
+
*
|
|
15
|
+
* Every size is made here rather than left to Android to scale one big PNG:
|
|
16
|
+
* launchers scale bitmaps with a cheap filter, and a 1024 px image shrunk to
|
|
17
|
+
* 48 px that way comes out jagged.
|
|
18
|
+
*/
|
|
19
|
+
export declare const writeAndroidIcon: (dir: string, app: ResolvedApp, projectRoot: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* The adaptive icon both `android:icon` and `android:roundIcon` point at:
|
|
22
|
+
* the launcher masks it to whatever shape it uses, round included.
|
|
23
|
+
*/
|
|
24
|
+
export declare const adaptiveIconXml: ({ foreground, background, }: {
|
|
25
|
+
readonly foreground: boolean;
|
|
26
|
+
readonly background: "color" | "image";
|
|
27
|
+
}) => string;
|
|
28
|
+
export declare const backgroundColorResource: (color: string) => string;
|
|
29
|
+
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/android/icon.ts"],"names":[],"mappings":"AASA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAaxE,wEAAwE;AACxE,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMtD,CAAC;AAuBF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,aAAa,MAAM,KAClB,IAkFF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,6BAG7B;IACD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC;CACxC,KAAG,MAeU,CAAC;AAEf,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAO1C,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { ICON_BACKGROUND_COLOR } from "../options.js";
|
|
4
|
+
import { decodePng, encodePng, extendEdges, maskCircle, readPngSize, resize, } from "../png.js";
|
|
5
|
+
const RES = 'app/src/main/res';
|
|
6
|
+
/** Each density's scale from dp to px, as Android names its folders. */
|
|
7
|
+
export const DENSITIES = {
|
|
8
|
+
mdpi: 1,
|
|
9
|
+
hdpi: 1.5,
|
|
10
|
+
xhdpi: 2,
|
|
11
|
+
xxhdpi: 3,
|
|
12
|
+
xxxhdpi: 4,
|
|
13
|
+
};
|
|
14
|
+
/** A flat launcher icon is 48 dp square. */
|
|
15
|
+
const LEGACY_DP = 48;
|
|
16
|
+
/** An adaptive icon layer is 108 dp square... */
|
|
17
|
+
const LAYER_DP = 108;
|
|
18
|
+
/**
|
|
19
|
+
* ...of which the launcher shows the middle 72 dp at most, masked to its
|
|
20
|
+
* shape, and moves the layer by up to 18 dp around it.
|
|
21
|
+
*/
|
|
22
|
+
const VISIBLE_DP = 72;
|
|
23
|
+
/**
|
|
24
|
+
* The template's vector placeholder (Angular's red shield), which an app with
|
|
25
|
+
* an icon replaces.
|
|
26
|
+
*/
|
|
27
|
+
const PLACEHOLDERS = [
|
|
28
|
+
'mipmap/ic_launcher.xml',
|
|
29
|
+
'mipmap/ic_launcher_round.xml',
|
|
30
|
+
'drawable/ic_launcher_background.xml',
|
|
31
|
+
'drawable/ic_launcher_foreground.xml',
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Writes the app's launcher icon into the project's resources, from the
|
|
35
|
+
* `icon` option (and `android.adaptiveIcon`'s layers):
|
|
36
|
+
*
|
|
37
|
+
* - `mipmap-<density>/ic_launcher.png` and `ic_launcher_round.png`, the flat
|
|
38
|
+
* icons Android 7 shows, square and round;
|
|
39
|
+
* - `mipmap-anydpi-v26/ic_launcher.xml` and `ic_launcher_round.xml`, the
|
|
40
|
+
* adaptive icon Android 8 and later show, with its layers as
|
|
41
|
+
* `mipmap-<density>/ic_launcher_foreground.png` and
|
|
42
|
+
* `ic_launcher_background.png`, or a color in `values/`.
|
|
43
|
+
*
|
|
44
|
+
* Every size is made here rather than left to Android to scale one big PNG:
|
|
45
|
+
* launchers scale bitmaps with a cheap filter, and a 1024 px image shrunk to
|
|
46
|
+
* 48 px that way comes out jagged.
|
|
47
|
+
*/
|
|
48
|
+
export const writeAndroidIcon = (dir, app, projectRoot) => {
|
|
49
|
+
if (!app.icon) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const res = path.join(dir, RES);
|
|
53
|
+
for (const placeholder of PLACEHOLDERS) {
|
|
54
|
+
rmSync(path.join(res, placeholder), { force: true });
|
|
55
|
+
}
|
|
56
|
+
const icon = loadIcon(projectRoot, app.icon, 'icon');
|
|
57
|
+
// resolveAppOptions has checked an adaptiveIcon has both layers.
|
|
58
|
+
const adaptive = app.android.adaptiveIcon;
|
|
59
|
+
const foreground = adaptive?.foreground
|
|
60
|
+
? loadIcon(projectRoot, adaptive.foreground, 'android.adaptiveIcon.foreground')
|
|
61
|
+
: undefined;
|
|
62
|
+
const backgroundColor = adaptive?.background && ICON_BACKGROUND_COLOR.test(adaptive.background)
|
|
63
|
+
? adaptive.background
|
|
64
|
+
: undefined;
|
|
65
|
+
const backgroundImage = adaptive?.background && !backgroundColor
|
|
66
|
+
? loadIcon(projectRoot, adaptive.background, 'android.adaptiveIcon.background')
|
|
67
|
+
: undefined;
|
|
68
|
+
for (const [density, scale] of Object.entries(DENSITIES)) {
|
|
69
|
+
const folder = path.join(res, `mipmap-${density}`);
|
|
70
|
+
mkdirSync(folder, { recursive: true });
|
|
71
|
+
const legacy = resize(icon, LEGACY_DP * scale, LEGACY_DP * scale);
|
|
72
|
+
writeFileSync(path.join(folder, 'ic_launcher.png'), encodePng(legacy));
|
|
73
|
+
writeFileSync(path.join(folder, 'ic_launcher_round.png'), encodePng(maskCircle(legacy)));
|
|
74
|
+
const layer = LAYER_DP * scale;
|
|
75
|
+
if (foreground) {
|
|
76
|
+
writeFileSync(path.join(folder, 'ic_launcher_foreground.png'), encodePng(resize(foreground, layer, layer)));
|
|
77
|
+
}
|
|
78
|
+
if (!adaptive) {
|
|
79
|
+
// The default adaptive icon: the whole icon fills the 72 dp the mask
|
|
80
|
+
// shows, so a square icon designed for iOS loses only its corners (as
|
|
81
|
+
// it does there), and its edges continue into the margin the layer
|
|
82
|
+
// moves in. Scaling it to the full 108 dp would crop a third of it.
|
|
83
|
+
const visible = VISIBLE_DP * scale;
|
|
84
|
+
writeFileSync(path.join(folder, 'ic_launcher_background.png'), encodePng(extendEdges(resize(icon, visible, visible), (layer - visible) / 2)));
|
|
85
|
+
}
|
|
86
|
+
else if (backgroundImage) {
|
|
87
|
+
writeFileSync(path.join(folder, 'ic_launcher_background.png'), encodePng(resize(backgroundImage, layer, layer)));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (backgroundColor) {
|
|
91
|
+
writeFileSync(path.join(res, 'values/ic_launcher_background.xml'), backgroundColorResource(backgroundColor));
|
|
92
|
+
}
|
|
93
|
+
const xml = adaptiveIconXml({
|
|
94
|
+
foreground: !!foreground,
|
|
95
|
+
background: backgroundColor ? 'color' : 'image',
|
|
96
|
+
});
|
|
97
|
+
mkdirSync(path.join(res, 'mipmap-anydpi-v26'), { recursive: true });
|
|
98
|
+
writeFileSync(path.join(res, 'mipmap-anydpi-v26/ic_launcher.xml'), xml);
|
|
99
|
+
writeFileSync(path.join(res, 'mipmap-anydpi-v26/ic_launcher_round.xml'), xml);
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The adaptive icon both `android:icon` and `android:roundIcon` point at:
|
|
103
|
+
* the launcher masks it to whatever shape it uses, round included.
|
|
104
|
+
*/
|
|
105
|
+
export const adaptiveIconXml = ({ foreground, background, }) => [
|
|
106
|
+
'<?xml version="1.0" encoding="utf-8"?>',
|
|
107
|
+
"<!-- Written by @blotch/angular-lynx-native from angular.json's icon options. -->",
|
|
108
|
+
'<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">',
|
|
109
|
+
background === 'color'
|
|
110
|
+
? ' <background android:drawable="@color/ic_launcher_background" />'
|
|
111
|
+
: ' <background android:drawable="@mipmap/ic_launcher_background" />',
|
|
112
|
+
// A layer can't be left out, so the default icon, all background, has
|
|
113
|
+
// a transparent foreground.
|
|
114
|
+
foreground
|
|
115
|
+
? ' <foreground android:drawable="@mipmap/ic_launcher_foreground" />'
|
|
116
|
+
: ' <foreground android:drawable="@android:color/transparent" />',
|
|
117
|
+
'</adaptive-icon>',
|
|
118
|
+
'',
|
|
119
|
+
].join('\n');
|
|
120
|
+
export const backgroundColorResource = (color) => [
|
|
121
|
+
'<?xml version="1.0" encoding="utf-8"?>',
|
|
122
|
+
'<resources>',
|
|
123
|
+
` <color name="ic_launcher_background">${color}</color>`,
|
|
124
|
+
'</resources>',
|
|
125
|
+
'',
|
|
126
|
+
].join('\n');
|
|
127
|
+
/**
|
|
128
|
+
* Reads one of the icon options' PNGs, checking it's the 1024×1024 the
|
|
129
|
+
* docs ask for, so a wrong file fails here with the option's name rather
|
|
130
|
+
* than as a blurry or misplaced icon.
|
|
131
|
+
*/
|
|
132
|
+
const loadIcon = (projectRoot, file, option) => {
|
|
133
|
+
const absolute = path.resolve(projectRoot, file);
|
|
134
|
+
if (!existsSync(absolute)) {
|
|
135
|
+
throw new Error(`${option}: ${file} doesn't exist.`);
|
|
136
|
+
}
|
|
137
|
+
const size = readPngSize(absolute);
|
|
138
|
+
if (size.width !== 1024 || size.height !== 1024) {
|
|
139
|
+
throw new Error(`${file} is ${size.width}×${size.height}. ${option} must be a 1024×1024 PNG.`);
|
|
140
|
+
}
|
|
141
|
+
return decodePng(readFileSync(absolute));
|
|
142
|
+
};
|
|
@@ -4,7 +4,8 @@ import type { ResolvedApp } from '../options.ts';
|
|
|
4
4
|
* Writes the app options into the Android template: identity goes in
|
|
5
5
|
* angular-lynx.properties (which app/build.gradle.kts reads), and permissions,
|
|
6
6
|
* deep links and the apps canOpenURL can see go between the manifest's
|
|
7
|
-
* `angular-lynx:*` markers
|
|
7
|
+
* `angular-lynx:*` markers, and the icon options become the launcher icon's
|
|
8
|
+
* resources.
|
|
8
9
|
*/
|
|
9
10
|
export declare const androidGenerator: PlatformGenerator;
|
|
10
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/android/project.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/android/project.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,eAAe,CAAC;AAa9D;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAiB9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,WAOtC,CAAC;AAEN,eAAO,MAAM,UAAU,GAAI,KAAK,WAAW,KAAG,MAYhC,CAAC;AAEf,eAAO,MAAM,iBAAiB,GAAI,KAAK,WAAW,KAAG,MAiBpD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,KAAK,WAAW,KAAG,MAYjC,CAAC;AAEnB;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,WAAW,KAAG,MAUpC,CAAC;AAEf,2EAA2E;AAC3E,eAAO,MAAM,cAAc,GACzB,MAAK,MAAM,CAAC,UAAwB,KACnC,MAAM,GAAG,SAaX,CAAC"}
|
package/dist/android/project.js
CHANGED
|
@@ -2,6 +2,7 @@ import { chmodSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { PERMISSION_MAP } from "../permissions.js";
|
|
5
|
+
import { writeAndroidIcon } from "./icon.js";
|
|
5
6
|
import { escapeXml, replaceMarker } from "../xml.js";
|
|
6
7
|
const MANIFEST = 'app/src/main/AndroidManifest.xml';
|
|
7
8
|
const SCREEN_ORIENTATIONS = {
|
|
@@ -13,10 +14,11 @@ const SCREEN_ORIENTATIONS = {
|
|
|
13
14
|
* Writes the app options into the Android template: identity goes in
|
|
14
15
|
* angular-lynx.properties (which app/build.gradle.kts reads), and permissions,
|
|
15
16
|
* deep links and the apps canOpenURL can see go between the manifest's
|
|
16
|
-
* `angular-lynx:*` markers
|
|
17
|
+
* `angular-lynx:*` markers, and the icon options become the launcher icon's
|
|
18
|
+
* resources.
|
|
17
19
|
*/
|
|
18
20
|
export const androidGenerator = {
|
|
19
|
-
configure: (dir, app) => {
|
|
21
|
+
configure: (dir, app, projectRoot) => {
|
|
20
22
|
// npm keeps file modes when it packs, but a copy through another tool
|
|
21
23
|
// (or a Windows checkout) may not, and Gradle can't start without it.
|
|
22
24
|
chmodSync(path.join(dir, 'gradlew'), 0o755);
|
|
@@ -27,6 +29,7 @@ export const androidGenerator = {
|
|
|
27
29
|
manifest = replaceMarker(manifest, 'deep-links', deepLinkEntries(app));
|
|
28
30
|
manifest = replaceMarker(manifest, 'queries', queriesEntries(app));
|
|
29
31
|
writeFileSync(manifestPath, manifest);
|
|
32
|
+
writeAndroidIcon(dir, app, projectRoot);
|
|
30
33
|
},
|
|
31
34
|
bundleDir: (dir) => path.join(dir, 'app/src/main/assets'),
|
|
32
35
|
};
|
package/dist/generate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ResolvedApp } from './options.ts';
|
|
2
2
|
export type Platform = 'ios' | 'android';
|
|
3
3
|
/** The shell templates shipped in this package. */
|
|
4
4
|
export declare const TEMPLATES_DIR: string;
|
|
@@ -28,7 +28,7 @@ export type PreparedProject = {
|
|
|
28
28
|
* `<workDir>/<platform>`, or the user's ejected folder.
|
|
29
29
|
*
|
|
30
30
|
* Generation is skipped when a hash of every input (this package's version,
|
|
31
|
-
* the template files, the app options and the icon) matches the last run, so
|
|
31
|
+
* the template files, the app options and the icon images) matches the last run, so
|
|
32
32
|
* Xcode and Gradle keep their incremental state between builds. The bundle is
|
|
33
33
|
* copied in on every build, because it changes on every build.
|
|
34
34
|
*/
|
package/dist/generate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAaA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAEzC,mDAAmD;AACnD,eAAO,MAAM,aAAa,QAEzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAIpD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,CAClB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,KAChB,IAAI,CAAC;IACV,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,mCAAmC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,gFAQ5B;IACD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,KAAG,eA2BH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,MAAM,EACnB,KAAK,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAC7B,IAUF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,KAAG,IAqBrD,CAAC"}
|
package/dist/generate.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { ICON_BACKGROUND_COLOR } from "./options.js";
|
|
5
6
|
/** The shell templates shipped in this package. */
|
|
6
7
|
export const TEMPLATES_DIR = fileURLToPath(new URL('../templates/', import.meta.url));
|
|
7
8
|
/**
|
|
@@ -17,7 +18,7 @@ const HASH_FILE = '.angular-lynx-hash';
|
|
|
17
18
|
* `<workDir>/<platform>`, or the user's ejected folder.
|
|
18
19
|
*
|
|
19
20
|
* Generation is skipped when a hash of every input (this package's version,
|
|
20
|
-
* the template files, the app options and the icon) matches the last run, so
|
|
21
|
+
* the template files, the app options and the icon images) matches the last run, so
|
|
21
22
|
* Xcode and Gradle keep their incremental state between builds. The bundle is
|
|
22
23
|
* copied in on every build, because it changes on every build.
|
|
23
24
|
*/
|
|
@@ -91,9 +92,15 @@ const inputHash = ({ platform, app, projectRoot, packageVersion, }) => {
|
|
|
91
92
|
hash.update(file.relative);
|
|
92
93
|
hash.update(readFileSync(file.absolute));
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
// The images, not just their paths (which the options above hold), so
|
|
96
|
+
// replacing one with a new image of the same name regenerates the icons.
|
|
97
|
+
// A missing file is hashed as such: generation then fails and says so.
|
|
98
|
+
const { foreground, background } = (platform === 'android' && app.android.adaptiveIcon) || {};
|
|
99
|
+
for (const file of [app.icon, foreground, background]) {
|
|
100
|
+
if (file && !ICON_BACKGROUND_COLOR.test(file)) {
|
|
101
|
+
const absolute = path.resolve(projectRoot, file);
|
|
102
|
+
hash.update(existsSync(absolute) ? readFileSync(absolute) : 'missing');
|
|
103
|
+
}
|
|
97
104
|
}
|
|
98
105
|
return hash.digest('hex');
|
|
99
106
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { Platform } from './generate.ts';
|
|
|
5
5
|
export { EJECT_MARKER, copyBundle, prepareProject } from './generate.ts';
|
|
6
6
|
export { renderEjectedProject } from './eject.ts';
|
|
7
7
|
export { LYNX_IOS, FRAMEWORKS_ENV } from './ios/frameworks.ts';
|
|
8
|
-
export type { AndroidOptions, IosOptions, NativeAppOptions, Orientation, Permission, ResolvedApp, } from './options.ts';
|
|
8
|
+
export type { AndroidOptions, IosExportMethod, IosOptions, NativeAppOptions, Orientation, Permission, ResolvedApp, } from './options.ts';
|
|
9
9
|
export { NativeConfigError, resolveAppOptions } from './options.ts';
|
|
10
10
|
export { NativeBuildError } from './process.ts';
|
|
11
11
|
export type { RunOptions } from './run.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AAExE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EACV,cAAc,EACd,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,eAAe,EAAE,MAErB,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,qBAAqB,KAC7B,OAAO,CAAC;IACT,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAsFA,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,12 @@ import { androidGenerator } from "./android/project.js";
|
|
|
4
4
|
import { buildAndroid, resolveAndroidSigning } from "./android/build.js";
|
|
5
5
|
import { startAndroidDevice } from "./android/run.js";
|
|
6
6
|
import { prepareProject, removeLegacyWorkDir, } from "./generate.js";
|
|
7
|
-
import { buildIos, resolveIosSigning } from "./ios/build.js";
|
|
7
|
+
import { buildIos, missingTeamMessage, resolveIosSigning, } from "./ios/build.js";
|
|
8
8
|
import { resolveLynxFrameworks } from "./ios/frameworks.js";
|
|
9
9
|
import { iosGenerator } from "./ios/project.js";
|
|
10
|
-
import {
|
|
10
|
+
import { startIosTarget } from "./ios/run.js";
|
|
11
11
|
import { resolveAppOptions } from "./options.js";
|
|
12
|
+
import { NativeBuildError } from "./process.js";
|
|
12
13
|
export { EJECT_MARKER, copyBundle, prepareProject } from "./generate.js";
|
|
13
14
|
export { renderEjectedProject } from "./eject.js";
|
|
14
15
|
export { LYNX_IOS, FRAMEWORKS_ENV } from "./ios/frameworks.js";
|
|
@@ -41,8 +42,13 @@ export const buildNativeApp = async (options) => {
|
|
|
41
42
|
const target = !options.run
|
|
42
43
|
? undefined
|
|
43
44
|
: platform === 'ios'
|
|
44
|
-
? await
|
|
45
|
+
? await startIosTarget({ device: options.run.device, logFile, log })
|
|
45
46
|
: await startAndroidDevice({ device: options.run.device, logFile, log });
|
|
47
|
+
// An iPhone only runs a signed app, so a run without a team stops here,
|
|
48
|
+
// before the project is generated and built.
|
|
49
|
+
if (target?.iPhone && !iosSigning) {
|
|
50
|
+
throw new NativeBuildError(await missingTeamMessage(target.iPhone.name));
|
|
51
|
+
}
|
|
46
52
|
const project = prepareProject({
|
|
47
53
|
platform,
|
|
48
54
|
generator: platform === 'ios' ? iosGenerator : androidGenerator,
|
|
@@ -72,6 +78,7 @@ export const buildNativeApp = async (options) => {
|
|
|
72
78
|
logFile,
|
|
73
79
|
log,
|
|
74
80
|
signing: iosSigning,
|
|
81
|
+
device: target?.iPhone,
|
|
75
82
|
})
|
|
76
83
|
: await buildAndroid({
|
|
77
84
|
project,
|
|
@@ -82,7 +89,8 @@ export const buildNativeApp = async (options) => {
|
|
|
82
89
|
signing: androidSigning,
|
|
83
90
|
});
|
|
84
91
|
await target?.launch(
|
|
85
|
-
// The simulator .app or the .apk, not the .ipa or .aab
|
|
92
|
+
// The simulator's or the iPhone's .app or the .apk, not the .ipa or .aab
|
|
93
|
+
// for the stores.
|
|
86
94
|
artifacts.find((artifact) => artifact.endsWith(platform === 'ios' ? '.app' : '.apk')), app);
|
|
87
95
|
return { artifacts, projectDir: project.dir };
|
|
88
96
|
};
|
package/dist/ios/build.d.ts
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
import type { PreparedProject } from '../generate.ts';
|
|
2
|
-
import type { ResolvedApp } from '../options.ts';
|
|
2
|
+
import type { IosExportMethod, ResolvedApp } from '../options.ts';
|
|
3
3
|
export type IosSigning = {
|
|
4
4
|
readonly teamId: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* An App Store Connect API key, which signs without anyone signed in to
|
|
7
|
+
* Xcode, e.g. on CI. Without it, xcodebuild signs with the Apple ID signed
|
|
8
|
+
* in to Xcode's Accounts settings.
|
|
9
|
+
*/
|
|
10
|
+
readonly apiKey?: {
|
|
11
|
+
readonly keyPath: string;
|
|
12
|
+
readonly keyId: string;
|
|
13
|
+
readonly issuerId: string;
|
|
14
|
+
};
|
|
15
|
+
/** How to sign the `.ipa`, or undefined to build none. */
|
|
16
|
+
readonly export?: IosExportMethod;
|
|
8
17
|
};
|
|
9
18
|
/**
|
|
10
|
-
* Reads the App Store Connect API key from the
|
|
11
|
-
*
|
|
12
|
-
* build without credentials still produces the
|
|
13
|
-
* it's configured halfway, which is always a
|
|
19
|
+
* Reads the signing options, and the App Store Connect API key from the
|
|
20
|
+
* environment variables they name. Returns undefined when signing isn't
|
|
21
|
+
* configured at all, so a build without credentials still produces the
|
|
22
|
+
* simulator app, and throws when it's configured halfway, which is always a
|
|
23
|
+
* mistake.
|
|
24
|
+
*
|
|
25
|
+
* `teamId` alone signs only the development builds `--run` installs on a
|
|
26
|
+
* phone: an `.ipa` takes `signing` (an API key) or `export`, so a Personal
|
|
27
|
+
* Team, which can't export one, never fails a plain build.
|
|
14
28
|
*/
|
|
15
29
|
export declare const resolveIosSigning: (app: ResolvedApp, env?: NodeJS.ProcessEnv) => IosSigning | undefined;
|
|
16
30
|
/**
|
|
17
|
-
* Builds the iOS shell:
|
|
18
|
-
*
|
|
31
|
+
* Builds the iOS shell: a simulator `.app`, plus an `.ipa` when signing
|
|
32
|
+
* says how to export one. With `device`, only a development-signed `.app` for
|
|
33
|
+
* that iPhone instead, which is all `--run` installs there: the simulator app
|
|
34
|
+
* would be thrown away, and archiving the `.ipa` takes minutes a Personal
|
|
35
|
+
* Team's run would spend failing. Returns the artifacts' paths.
|
|
19
36
|
*/
|
|
20
|
-
export declare const buildIos: ({ project, app, frameworksDir, buildDir, outputDir, logFile, log, signing, }: {
|
|
37
|
+
export declare const buildIos: ({ project, app, frameworksDir, buildDir, outputDir, logFile, log, signing, device, }: {
|
|
21
38
|
readonly project: PreparedProject;
|
|
22
39
|
readonly app: ResolvedApp;
|
|
23
40
|
readonly frameworksDir: string;
|
|
@@ -27,6 +44,32 @@ export declare const buildIos: ({ project, app, frameworksDir, buildDir, outputD
|
|
|
27
44
|
readonly logFile: string;
|
|
28
45
|
readonly log: (message: string) => void;
|
|
29
46
|
readonly signing: IosSigning | undefined;
|
|
47
|
+
/** The iPhone `--run` installs the app on, when it's one. */
|
|
48
|
+
readonly device?: {
|
|
49
|
+
readonly udid: string;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
};
|
|
30
52
|
}) => Promise<string[]>;
|
|
31
|
-
|
|
53
|
+
/**
|
|
54
|
+
* What to do when `--run` targets an iPhone but nothing says who signs the
|
|
55
|
+
* app. iOS runs only signed apps, and a free Apple ID is enough for one's
|
|
56
|
+
* own phone, so the message says so rather than pointing at the paid program.
|
|
57
|
+
* Xcode doesn't show a team's ID anywhere obvious, so the message lists the
|
|
58
|
+
* teams it can find on this Mac.
|
|
59
|
+
*/
|
|
60
|
+
export declare const missingTeamMessage: (deviceName: string) => Promise<string>;
|
|
61
|
+
export type SigningTeam = {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly name: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The teams this Mac can sign for: those of the accounts signed in to Xcode,
|
|
67
|
+
* which Xcode keeps in its preferences, and those of the Apple Development
|
|
68
|
+
* certificates in the keychain, whose subject holds the team's ID as OU and
|
|
69
|
+
* its name as O.
|
|
70
|
+
*/
|
|
71
|
+
export declare const signingTeams: ({ preferences, }?: {
|
|
72
|
+
readonly preferences?: string;
|
|
73
|
+
}) => Promise<readonly SigningTeam[]>;
|
|
74
|
+
export declare const exportOptionsPlist: (teamId: string, method: IosExportMethod) => string;
|
|
32
75
|
//# sourceMappingURL=build.d.ts.map
|
package/dist/ios/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ios/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ios/build.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIlE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,WAAW,EAChB,MAAK,MAAM,CAAC,UAAwB,KACnC,UAAU,GAAG,SAwCf,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAU,sFAU5B;IACD,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE,KAAG,OAAO,CAAC,MAAM,EAAE,CAkJnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,MAAM,KACjB,OAAO,CAAC,MAAM,CAShB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAU,mBAKhC;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,KAAG,OAAO,CAAC,SAAS,WAAW,EAAE,CA2DzE,CAAC;AA0DF,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,MAAM,EACd,QAAQ,eAAe,KACtB,MAuBF,CAAC"}
|