@blotch/angular-lynx-native 22.2.20 → 22.2.22
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 +8 -4
- package/dist/android/build.d.ts +6 -1
- package/dist/android/build.d.ts.map +1 -1
- package/dist/android/build.js +14 -3
- 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/android/run.d.ts +10 -1
- package/dist/android/run.d.ts.map +1 -1
- package/dist/android/run.js +46 -1
- package/dist/dev-build.d.ts +16 -0
- package/dist/dev-build.d.ts.map +1 -0
- package/dist/dev-build.js +44 -0
- package/dist/generate.d.ts +26 -7
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +25 -10
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77 -13
- package/dist/ios/build.d.ts +68 -12
- package/dist/ios/build.d.ts.map +1 -1
- package/dist/ios/build.js +210 -45
- package/dist/ios/iphone.d.ts +99 -0
- package/dist/ios/iphone.d.ts.map +1 -0
- package/dist/ios/iphone.js +207 -0
- package/dist/ios/project.d.ts +10 -1
- package/dist/ios/project.d.ts.map +1 -1
- package/dist/ios/project.js +27 -4
- package/dist/ios/run.d.ts +18 -3
- package/dist/ios/run.d.ts.map +1 -1
- package/dist/ios/run.js +34 -5
- 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 +54 -6
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +16 -1
- package/package.json +5 -1
- package/templates/android/README.md +5 -1
- package/templates/android/app/src/debug/java/dev/angularlynx/shell/DevServer.kt +159 -0
- package/templates/android/app/src/debug/java/dev/angularlynx/shell/DevServerModules.kt +163 -0
- package/templates/android/app/src/debug/res/xml/network_security_config.xml +13 -0
- package/templates/android/app/src/main/AndroidManifest.xml +16 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/AssetsModule.kt +22 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +24 -1
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ResourceFetchers.kt +12 -6
- 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/android/app/src/release/java/dev/angularlynx/shell/DevServer.kt +24 -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/AssetsModule.swift +21 -3
- package/templates/ios/App/BundleResourceFetcher.swift +46 -2
- package/templates/ios/App/DevServer.swift +190 -0
- package/templates/ios/App/DevServerModules.swift +223 -0
- package/templates/ios/App/LynxViewController.swift +11 -1
- package/templates/ios/App/ShareModule.swift +215 -0
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,17 +18,24 @@ 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.
|
|
24
|
+
*
|
|
25
|
+
* `ng serve --platform`'s development app is generated in a folder of its
|
|
26
|
+
* own, `<workDir>/<platform>-dev`, so it and `ng build --platform`'s app each
|
|
27
|
+
* keep their incremental build state, and one never regenerates or overwrites
|
|
28
|
+
* the other. It gets no bundle (`bundleDir` undefined): it loads the bundle
|
|
29
|
+
* from the dev server.
|
|
23
30
|
*/
|
|
24
|
-
export const prepareProject = ({ platform, generator, projectRoot, workDir, app, bundleDir, packageVersion, }) => {
|
|
31
|
+
export const prepareProject = ({ platform, generator, projectRoot, workDir, app, bundleDir, packageVersion, development = false, }) => {
|
|
25
32
|
const ejectedDir = path.join(projectRoot, platform);
|
|
26
33
|
if (existsSync(path.join(ejectedDir, EJECT_MARKER))) {
|
|
27
|
-
|
|
34
|
+
if (bundleDir)
|
|
35
|
+
copyBundle(bundleDir, generator.bundleDir(ejectedDir));
|
|
28
36
|
return { dir: ejectedDir, ejected: true, regenerated: false };
|
|
29
37
|
}
|
|
30
|
-
const dir = path.join(workDir, platform);
|
|
38
|
+
const dir = path.join(workDir, development ? `${platform}-dev` : platform);
|
|
31
39
|
const hash = inputHash({ platform, app, projectRoot, packageVersion });
|
|
32
40
|
const hashFile = path.join(dir, HASH_FILE);
|
|
33
41
|
const upToDate = existsSync(hashFile) && readFileSync(hashFile, 'utf8') === hash;
|
|
@@ -35,15 +43,16 @@ export const prepareProject = ({ platform, generator, projectRoot, workDir, app,
|
|
|
35
43
|
rmSync(dir, { recursive: true, force: true });
|
|
36
44
|
mkdirSync(dir, { recursive: true });
|
|
37
45
|
cpSync(path.join(TEMPLATES_DIR, platform), dir, { recursive: true });
|
|
38
|
-
generator.configure(dir, app, projectRoot);
|
|
46
|
+
generator.configure(dir, app, projectRoot, development);
|
|
39
47
|
writeFileSync(hashFile, hash);
|
|
40
48
|
}
|
|
41
49
|
// Generated projects are build output. `ng new` already ignores Angular's
|
|
42
50
|
// cache, but a moved cache (`cli.cache.path`) or an edited .gitignore may
|
|
43
51
|
// not be: keep them out of the user's git without asking them to edit it.
|
|
44
52
|
writeFileSync(path.join(workDir, '.gitignore'), '*\n');
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
if (bundleDir)
|
|
54
|
+
copyBundle(bundleDir, generator.bundleDir(dir));
|
|
55
|
+
return { dir, ejected: false, regenerated: !upToDate, hash };
|
|
47
56
|
};
|
|
48
57
|
/**
|
|
49
58
|
* Up to 22.2.2, native builds worked in `.angular-lynx/` at the project root.
|
|
@@ -91,9 +100,15 @@ const inputHash = ({ platform, app, projectRoot, packageVersion, }) => {
|
|
|
91
100
|
hash.update(file.relative);
|
|
92
101
|
hash.update(readFileSync(file.absolute));
|
|
93
102
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
// The images, not just their paths (which the options above hold), so
|
|
104
|
+
// replacing one with a new image of the same name regenerates the icons.
|
|
105
|
+
// A missing file is hashed as such: generation then fails and says so.
|
|
106
|
+
const { foreground, background } = (platform === 'android' && app.android.adaptiveIcon) || {};
|
|
107
|
+
for (const file of [app.icon, foreground, background]) {
|
|
108
|
+
if (file && !ICON_BACKGROUND_COLOR.test(file)) {
|
|
109
|
+
const absolute = path.resolve(projectRoot, file);
|
|
110
|
+
hash.update(existsSync(absolute) ? readFileSync(absolute) : 'missing');
|
|
111
|
+
}
|
|
97
112
|
}
|
|
98
113
|
return hash.digest('hex');
|
|
99
114
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type Platform } from './generate.ts';
|
|
2
2
|
import { type NativeAppOptions } from './options.ts';
|
|
3
|
-
import type { RunOptions } from './run.ts';
|
|
3
|
+
import type { DevServerOptions, RunOptions } from './run.ts';
|
|
4
4
|
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
|
-
export type { RunOptions } from './run.ts';
|
|
11
|
+
export type { DevServerOptions, RunOptions } from './run.ts';
|
|
12
12
|
export declare const PACKAGE_VERSION: string;
|
|
13
13
|
export type BuildNativeAppOptions = {
|
|
14
14
|
readonly platform: Platform;
|
|
@@ -24,7 +24,10 @@ export type BuildNativeAppOptions = {
|
|
|
24
24
|
readonly projectName: string;
|
|
25
25
|
/** The project's package.json version, the default app version. */
|
|
26
26
|
readonly packageVersion?: string;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The rspeedy output folder holding main.lynx.bundle. Unused with
|
|
29
|
+
* `devServer`: the development app loads the bundle from the server.
|
|
30
|
+
*/
|
|
28
31
|
readonly bundleDir: string;
|
|
29
32
|
/** Where the binaries go, e.g. dist/ios. Emptied before they're written. */
|
|
30
33
|
readonly outputDir: string;
|
|
@@ -34,6 +37,12 @@ export type BuildNativeAppOptions = {
|
|
|
34
37
|
* built: `ng build --platform <platform> --run`.
|
|
35
38
|
*/
|
|
36
39
|
readonly run?: RunOptions;
|
|
40
|
+
/**
|
|
41
|
+
* `ng serve --platform <platform>`: build the development app, which loads
|
|
42
|
+
* its bundle from this dev server and reloads on every edit, and open it
|
|
43
|
+
* where `run` says. Needs `run`.
|
|
44
|
+
*/
|
|
45
|
+
readonly devServer?: DevServerOptions;
|
|
37
46
|
readonly log: (message: string) => void;
|
|
38
47
|
};
|
|
39
48
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7D,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,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAW7D,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;;;OAGG;IACH,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;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,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,CAyIA,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { androidGenerator } from "./android/project.js";
|
|
4
4
|
import { buildAndroid, resolveAndroidSigning } from "./android/build.js";
|
|
5
5
|
import { startAndroidDevice } from "./android/run.js";
|
|
6
|
+
import { devBuildKey, recordDevBuild, reusableDevBuild } from "./dev-build.js";
|
|
6
7
|
import { prepareProject, removeLegacyWorkDir, } from "./generate.js";
|
|
7
|
-
import { buildIos, resolveIosSigning } from "./ios/build.js";
|
|
8
|
+
import { buildIos, missingTeamMessage, resolveIosSigning, } from "./ios/build.js";
|
|
8
9
|
import { resolveLynxFrameworks } from "./ios/frameworks.js";
|
|
9
10
|
import { iosGenerator } from "./ios/project.js";
|
|
10
|
-
import {
|
|
11
|
+
import { startIosTarget } from "./ios/run.js";
|
|
11
12
|
import { resolveAppOptions } from "./options.js";
|
|
13
|
+
import { NativeBuildError } from "./process.js";
|
|
12
14
|
export { EJECT_MARKER, copyBundle, prepareProject } from "./generate.js";
|
|
13
15
|
export { renderEjectedProject } from "./eject.js";
|
|
14
16
|
export { LYNX_IOS, FRAMEWORKS_ENV } from "./ios/frameworks.js";
|
|
15
17
|
export { NativeConfigError, resolveAppOptions } from "./options.js";
|
|
16
18
|
export { NativeBuildError } from "./process.js";
|
|
19
|
+
/**
|
|
20
|
+
* The shell file that loads the app from the dev server in the development
|
|
21
|
+
* build, which a project ejected before `ng serve --platform` lacks.
|
|
22
|
+
*/
|
|
23
|
+
const DEV_SERVER_SOURCE = {
|
|
24
|
+
ios: 'App/DevServer.swift',
|
|
25
|
+
android: 'app/src/debug/java/dev/angularlynx/shell/DevServer.kt',
|
|
26
|
+
};
|
|
17
27
|
export const PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
18
28
|
/**
|
|
19
29
|
* Turns a built Lynx bundle into native binaries: generates (or reuses) the
|
|
@@ -22,7 +32,10 @@ export const PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../package.json'
|
|
|
22
32
|
* Returns the paths of the binaries it wrote to `outputDir`.
|
|
23
33
|
*/
|
|
24
34
|
export const buildNativeApp = async (options) => {
|
|
25
|
-
const { platform, projectRoot, workDir, log } = options;
|
|
35
|
+
const { platform, projectRoot, workDir, log, devServer } = options;
|
|
36
|
+
if (devServer && !options.run) {
|
|
37
|
+
throw new Error('The development app is built to run on a device: pass `run` with `devServer`.');
|
|
38
|
+
}
|
|
26
39
|
if (platform === 'ios' && process.platform !== 'darwin') {
|
|
27
40
|
throw new Error('Building for iOS needs macOS with Xcode installed: Apple only ships its build tools for macOS.');
|
|
28
41
|
}
|
|
@@ -31,32 +44,64 @@ export const buildNativeApp = async (options) => {
|
|
|
31
44
|
packageVersion: options.packageVersion,
|
|
32
45
|
});
|
|
33
46
|
// Resolved before generating anything, so a missing secret fails in
|
|
34
|
-
// milliseconds rather than after a native build.
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
// milliseconds rather than after a native build. The development app is
|
|
48
|
+
// signed only as far as a device needs: an iPhone takes the team's
|
|
49
|
+
// development signing, never an .ipa's export, and Android's debug build
|
|
50
|
+
// type always uses the debug key, so its upload key isn't read.
|
|
51
|
+
const iosSigning = platform === 'ios'
|
|
52
|
+
? withoutExport(resolveIosSigning(app), devServer)
|
|
53
|
+
: undefined;
|
|
54
|
+
const androidSigning = platform === 'android' && !devServer
|
|
55
|
+
? resolveAndroidSigning(app)
|
|
56
|
+
: undefined;
|
|
37
57
|
removeLegacyWorkDir(projectRoot, log);
|
|
38
|
-
const logFile = path.join(workDir, 'logs', `${platform}.log`);
|
|
58
|
+
const logFile = path.join(workDir, 'logs', `${platform}${devServer ? '-dev' : ''}.log`);
|
|
39
59
|
mkdirSync(path.dirname(logFile), { recursive: true });
|
|
40
60
|
writeFileSync(logFile, '');
|
|
41
61
|
const target = !options.run
|
|
42
62
|
? undefined
|
|
43
63
|
: platform === 'ios'
|
|
44
|
-
? await
|
|
64
|
+
? await startIosTarget({ device: options.run.device, logFile, log })
|
|
45
65
|
: await startAndroidDevice({ device: options.run.device, logFile, log });
|
|
66
|
+
// An iPhone only runs a signed app, so a run without a team stops here,
|
|
67
|
+
// before the project is generated and built.
|
|
68
|
+
if (target?.iPhone && !iosSigning) {
|
|
69
|
+
throw new NativeBuildError(await missingTeamMessage(target.iPhone.name));
|
|
70
|
+
}
|
|
46
71
|
const project = prepareProject({
|
|
47
72
|
platform,
|
|
48
73
|
generator: platform === 'ios' ? iosGenerator : androidGenerator,
|
|
49
74
|
projectRoot,
|
|
50
75
|
workDir,
|
|
51
76
|
app,
|
|
52
|
-
bundleDir: options.bundleDir,
|
|
77
|
+
bundleDir: devServer ? undefined : options.bundleDir,
|
|
53
78
|
packageVersion: PACKAGE_VERSION,
|
|
79
|
+
development: !!devServer,
|
|
54
80
|
});
|
|
81
|
+
if (devServer &&
|
|
82
|
+
project.ejected &&
|
|
83
|
+
!existsSync(path.join(project.dir, DEV_SERVER_SOURCE[platform]))) {
|
|
84
|
+
throw new NativeBuildError(`The ejected ${platform}/ project has no ${DEV_SERVER_SOURCE[platform]}: it was ejected before \`ng serve --platform\` existed, so it can't load the app from the dev server. Eject again into a new folder (move ${platform}/ aside and run \`ng generate @blotch/angular-lynx:eject --platform ${platform}\`), then carry your changes over to it.`);
|
|
85
|
+
}
|
|
55
86
|
log(project.ejected
|
|
56
87
|
? `Using the ejected ${platform}/ project`
|
|
57
88
|
: project.regenerated
|
|
58
89
|
? `Generated the ${platform} project`
|
|
59
90
|
: `Reusing the generated ${platform} project (no config changes)`);
|
|
91
|
+
// Where the app was built for, which a development build for a simulator
|
|
92
|
+
// or a phone depends on as much as on the project.
|
|
93
|
+
const destination = target?.iPhone?.udid ?? target?.simulator?.udid ?? '';
|
|
94
|
+
// An ejected project is the user's own, whose native code may have changed
|
|
95
|
+
// without anything here knowing, so it's always built.
|
|
96
|
+
const devKey = devServer && project.hash
|
|
97
|
+
? devBuildKey(project.hash, destination)
|
|
98
|
+
: undefined;
|
|
99
|
+
const builtArtifacts = devKey && reusableDevBuild(options.outputDir, devKey);
|
|
100
|
+
if (builtArtifacts) {
|
|
101
|
+
log(`Reusing the development ${platform} app (no native changes)`);
|
|
102
|
+
await target.launch(builtArtifacts[0], app, devServer);
|
|
103
|
+
return { artifacts: builtArtifacts, projectDir: project.dir };
|
|
104
|
+
}
|
|
60
105
|
// rspeedy's clean leaves dist/ios and dist/android alone, so building one
|
|
61
106
|
// platform doesn't delete the other's app. Emptying this platform's folder
|
|
62
107
|
// here keeps what an earlier build wrote from outliving it: an .ipa from a
|
|
@@ -67,11 +112,17 @@ export const buildNativeApp = async (options) => {
|
|
|
67
112
|
project,
|
|
68
113
|
app,
|
|
69
114
|
frameworksDir: await resolveLynxFrameworks(logFile, log),
|
|
70
|
-
|
|
115
|
+
// Apart from the release build's, so switching between `ng serve`
|
|
116
|
+
// and `ng build` leaves both incremental.
|
|
117
|
+
buildDir: path.join(workDir, 'build', devServer ? 'ios-dev' : 'ios'),
|
|
71
118
|
outputDir: options.outputDir,
|
|
72
119
|
logFile,
|
|
73
120
|
log,
|
|
74
121
|
signing: iosSigning,
|
|
122
|
+
device: target?.iPhone,
|
|
123
|
+
development: !!devServer,
|
|
124
|
+
// A release build is for any simulator: it's an artifact in dist/.
|
|
125
|
+
simulator: devServer ? target?.simulator : undefined,
|
|
75
126
|
})
|
|
76
127
|
: await buildAndroid({
|
|
77
128
|
project,
|
|
@@ -80,9 +131,22 @@ export const buildNativeApp = async (options) => {
|
|
|
80
131
|
logFile,
|
|
81
132
|
log,
|
|
82
133
|
signing: androidSigning,
|
|
134
|
+
development: !!devServer,
|
|
83
135
|
});
|
|
136
|
+
if (devKey)
|
|
137
|
+
recordDevBuild(options.outputDir, devKey, artifacts);
|
|
84
138
|
await target?.launch(
|
|
85
|
-
// The simulator .app or the .apk, not the .ipa or .aab
|
|
86
|
-
|
|
139
|
+
// The simulator's or the iPhone's .app or the .apk, not the .ipa or .aab
|
|
140
|
+
// for the stores.
|
|
141
|
+
artifacts.find((artifact) => artifact.endsWith(platform === 'ios' ? '.app' : '.apk')), app, devServer);
|
|
87
142
|
return { artifacts, projectDir: project.dir };
|
|
88
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* The development app never exports an .ipa, so its signing has no export.
|
|
146
|
+
*/
|
|
147
|
+
const withoutExport = (signing, devServer) => {
|
|
148
|
+
if (!signing || !devServer || !signing.export)
|
|
149
|
+
return signing;
|
|
150
|
+
const { export: _, ...rest } = signing;
|
|
151
|
+
return rest;
|
|
152
|
+
};
|
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, development, simulator, }: {
|
|
21
38
|
readonly project: PreparedProject;
|
|
22
39
|
readonly app: ResolvedApp;
|
|
23
40
|
readonly frameworksDir: string;
|
|
@@ -27,6 +44,45 @@ 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
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* `ng serve --platform ios`'s development app: the Debug configuration,
|
|
54
|
+
* which compiles the shell's dev server support in (DevServer.swift) and
|
|
55
|
+
* builds for one architecture, and no `.ipa`.
|
|
56
|
+
*/
|
|
57
|
+
readonly development?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The simulator the development app runs on. The Debug configuration builds
|
|
60
|
+
* only its architecture, so it builds for that simulator rather than any.
|
|
61
|
+
*/
|
|
62
|
+
readonly simulator?: {
|
|
63
|
+
readonly udid: string;
|
|
64
|
+
};
|
|
30
65
|
}) => Promise<string[]>;
|
|
31
|
-
|
|
66
|
+
/**
|
|
67
|
+
* What to do when `--run` targets an iPhone but nothing says who signs the
|
|
68
|
+
* app. iOS runs only signed apps, and a free Apple ID is enough for one's
|
|
69
|
+
* own phone, so the message says so rather than pointing at the paid program.
|
|
70
|
+
* Xcode doesn't show a team's ID anywhere obvious, so the message lists the
|
|
71
|
+
* teams it can find on this Mac.
|
|
72
|
+
*/
|
|
73
|
+
export declare const missingTeamMessage: (deviceName: string) => Promise<string>;
|
|
74
|
+
export type SigningTeam = {
|
|
75
|
+
readonly id: string;
|
|
76
|
+
readonly name: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The teams this Mac can sign for: those of the accounts signed in to Xcode,
|
|
80
|
+
* which Xcode keeps in its preferences, and those of the Apple Development
|
|
81
|
+
* certificates in the keychain, whose subject holds the team's ID as OU and
|
|
82
|
+
* its name as O.
|
|
83
|
+
*/
|
|
84
|
+
export declare const signingTeams: ({ preferences, }?: {
|
|
85
|
+
readonly preferences?: string;
|
|
86
|
+
}) => Promise<readonly SigningTeam[]>;
|
|
87
|
+
export declare const exportOptionsPlist: (teamId: string, method: IosExportMethod) => string;
|
|
32
88
|
//# 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,8GAY5B;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;IACnE;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAChD,KAAG,OAAO,CAAC,MAAM,EAAE,CAsJnB,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"}
|