@rock-js/plugin-brownfield-ios 0.11.14 → 0.12.1
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/dist/src/lib/copyHermesXcframework.d.ts +2 -1
- package/dist/src/lib/copyHermesXcframework.js +9 -6
- package/dist/src/lib/copyHermesXcframework.js.map +1 -1
- package/dist/src/lib/pluginBrownfieldIos.js +2 -2
- package/dist/src/lib/pluginBrownfieldIos.js.map +1 -1
- package/package.json +4 -4
- package/src/lib/copyHermesXcframework.ts +11 -5
- package/src/lib/pluginBrownfieldIos.ts +3 -1
- package/template/ios/Podfile +0 -1
- package/template/package.json +1 -1
- package/dist/src/lib/mergeFrameworks.d.ts +0 -9
- package/dist/src/lib/mergeFrameworks.js +0 -33
- package/dist/src/lib/mergeFrameworks.js.map +0 -1
- package/src/lib/mergeFrameworks.ts +0 -46
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function copyHermesXcframework({ sourceDir, destinationDir, }: {
|
|
1
|
+
export declare function copyHermesXcframework({ sourceDir, destinationDir, reactNativeVersion, }: {
|
|
2
2
|
sourceDir: string;
|
|
3
3
|
destinationDir: string;
|
|
4
|
+
reactNativeVersion: string;
|
|
4
5
|
}): void;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import fs, { existsSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { color, logger, spinner } from '@rock-js/tools';
|
|
4
|
-
export function copyHermesXcframework({ sourceDir, destinationDir, }) {
|
|
3
|
+
import { color, logger, spinner, versionCompare } from '@rock-js/tools';
|
|
4
|
+
export function copyHermesXcframework({ sourceDir, destinationDir, reactNativeVersion, }) {
|
|
5
5
|
const loader = spinner();
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const hermesFrameworkName = versionCompare(reactNativeVersion, '0.82.0') >= 0
|
|
7
|
+
? 'hermesvm.xcframework'
|
|
8
|
+
: 'hermes.xcframework';
|
|
9
|
+
loader.start(`Copying ${color.bold(hermesFrameworkName)}`);
|
|
10
|
+
const hermesDestination = path.join(destinationDir, hermesFrameworkName);
|
|
8
11
|
if (existsSync(hermesDestination)) {
|
|
9
12
|
logger.debug(`Removing old hermes copy`);
|
|
10
13
|
fs.rmSync(hermesDestination, { recursive: true, force: true });
|
|
11
14
|
}
|
|
12
|
-
fs.cpSync(path.join(sourceDir,
|
|
13
|
-
loader.stop(`Copied ${color.bold(
|
|
15
|
+
fs.cpSync(path.join(sourceDir, `Pods/hermes-engine/destroot/Library/Frameworks/universal/${hermesFrameworkName}`), hermesDestination, { recursive: true, force: true });
|
|
16
|
+
loader.stop(`Copied ${color.bold(hermesFrameworkName)}`);
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=copyHermesXcframework.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyHermesXcframework.js","sourceRoot":"","sources":["../../../src/lib/copyHermesXcframework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"copyHermesXcframework.js","sourceRoot":"","sources":["../../../src/lib/copyHermesXcframework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,UAAU,qBAAqB,CAAC,EACpC,SAAS,EACT,cAAc,EACd,kBAAkB,GAKnB;IACC,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,MAAM,mBAAmB,GACvB,cAAc,CAAC,kBAAkB,EAAE,QAAQ,CAAC,IAAI,CAAC;QAC/C,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,oBAAoB,CAAC;IAE3B,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;IAEzE,IAAI,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QACzC,EAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,EAAE,CAAC,MAAM,CACP,IAAI,CAAC,IAAI,CACP,SAAS,EACT,4DAA4D,mBAAmB,EAAE,CAClF,EACD,iBAAiB,EACjB,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CACjC,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { createBuild, genericDestinations, getBuildOptions, getBuildPaths, getValidProjectConfig, } from '@rock-js/platform-apple-helpers';
|
|
2
|
+
import { createBuild, genericDestinations, getBuildOptions, getBuildPaths, getValidProjectConfig, mergeFrameworks, } from '@rock-js/platform-apple-helpers';
|
|
3
3
|
import { colorLink, intro, logger, outro, relativeToCwd } from '@rock-js/tools';
|
|
4
4
|
import { copyHermesXcframework } from './copyHermesXcframework.js';
|
|
5
|
-
import { mergeFrameworks } from './mergeFrameworks.js';
|
|
6
5
|
const buildOptions = getBuildOptions({ platformName: 'ios' });
|
|
7
6
|
export const pluginBrownfieldIos = (pluginConfig) => (api) => {
|
|
8
7
|
api.registerCommand({
|
|
@@ -56,6 +55,7 @@ export const pluginBrownfieldIos = (pluginConfig) => (api) => {
|
|
|
56
55
|
copyHermesXcframework({
|
|
57
56
|
sourceDir,
|
|
58
57
|
destinationDir: frameworkTargetOutputDir,
|
|
58
|
+
reactNativeVersion: api.getReactNativeVersion(),
|
|
59
59
|
});
|
|
60
60
|
// 5) Inform the user
|
|
61
61
|
logger.log(`XCFrameworks are available at: ${colorLink(relativeToCwd(frameworkTargetOutputDir))}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginBrownfieldIos.js","sourceRoot":"","sources":["../../../src/lib/pluginBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAEL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,qBAAqB,
|
|
1
|
+
{"version":3,"file":"pluginBrownfieldIos.js","sourceRoot":"","sources":["../../../src/lib/pluginBrownfieldIos.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAEL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,mBAAmB,GAC9B,CAAC,YAA+B,EAAE,EAAE,CACpC,CAAC,GAAc,EAAgB,EAAE;IAC/B,GAAG,CAAC,eAAe,CAAC;QAClB,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,kDAAkD;QAC/D,MAAM,EAAE,KAAK,EAAE,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|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Plugin for integrating Rock projects with existing iOS apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@react-native-community/cli-config-apple": "^20.0.0",
|
|
24
24
|
"@react-native-community/cli-types": "^20.0.0",
|
|
25
|
-
"@rock-js/tools": "^0.
|
|
26
|
-
"@rock-js/platform-apple-helpers": "^0.
|
|
25
|
+
"@rock-js/tools": "^0.12.1",
|
|
26
|
+
"@rock-js/platform-apple-helpers": "^0.12.1",
|
|
27
27
|
"tslib": "^2.3.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@rock-js/config": "^0.
|
|
30
|
+
"@rock-js/config": "^0.12.1"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import fs, { existsSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { color, logger, spinner } from '@rock-js/tools';
|
|
3
|
+
import { color, logger, spinner, versionCompare } from '@rock-js/tools';
|
|
4
4
|
|
|
5
5
|
export function copyHermesXcframework({
|
|
6
6
|
sourceDir,
|
|
7
7
|
destinationDir,
|
|
8
|
+
reactNativeVersion,
|
|
8
9
|
}: {
|
|
9
10
|
sourceDir: string;
|
|
10
11
|
destinationDir: string;
|
|
12
|
+
reactNativeVersion: string;
|
|
11
13
|
}) {
|
|
12
14
|
const loader = spinner();
|
|
15
|
+
const hermesFrameworkName =
|
|
16
|
+
versionCompare(reactNativeVersion, '0.82.0') >= 0
|
|
17
|
+
? 'hermesvm.xcframework'
|
|
18
|
+
: 'hermes.xcframework';
|
|
13
19
|
|
|
14
|
-
loader.start(`Copying ${color.bold(
|
|
15
|
-
const hermesDestination = path.join(destinationDir,
|
|
20
|
+
loader.start(`Copying ${color.bold(hermesFrameworkName)}`);
|
|
21
|
+
const hermesDestination = path.join(destinationDir, hermesFrameworkName);
|
|
16
22
|
|
|
17
23
|
if (existsSync(hermesDestination)) {
|
|
18
24
|
logger.debug(`Removing old hermes copy`);
|
|
@@ -22,11 +28,11 @@ export function copyHermesXcframework({
|
|
|
22
28
|
fs.cpSync(
|
|
23
29
|
path.join(
|
|
24
30
|
sourceDir,
|
|
25
|
-
|
|
31
|
+
`Pods/hermes-engine/destroot/Library/Frameworks/universal/${hermesFrameworkName}`,
|
|
26
32
|
),
|
|
27
33
|
hermesDestination,
|
|
28
34
|
{ recursive: true, force: true },
|
|
29
35
|
);
|
|
30
36
|
|
|
31
|
-
loader.stop(`Copied ${color.bold(
|
|
37
|
+
loader.stop(`Copied ${color.bold(hermesFrameworkName)}`);
|
|
32
38
|
}
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
getBuildOptions,
|
|
9
9
|
getBuildPaths,
|
|
10
10
|
getValidProjectConfig,
|
|
11
|
+
mergeFrameworks,
|
|
11
12
|
} from '@rock-js/platform-apple-helpers';
|
|
12
13
|
import { colorLink, intro, logger, outro, relativeToCwd } from '@rock-js/tools';
|
|
13
14
|
import { copyHermesXcframework } from './copyHermesXcframework.js';
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
const buildOptions = getBuildOptions({ platformName: 'ios' });
|
|
16
17
|
|
|
17
18
|
export const pluginBrownfieldIos =
|
|
@@ -105,6 +106,7 @@ export const pluginBrownfieldIos =
|
|
|
105
106
|
copyHermesXcframework({
|
|
106
107
|
sourceDir,
|
|
107
108
|
destinationDir: frameworkTargetOutputDir,
|
|
109
|
+
reactNativeVersion: api.getReactNativeVersion(),
|
|
108
110
|
});
|
|
109
111
|
|
|
110
112
|
// 5) Inform the user
|
package/template/ios/Podfile
CHANGED
package/template/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Xcode emits different `.framework` file based on the destination (simulator arm64/x86_64, iphone arm64 etc.)
|
|
3
|
-
* This takes those `.frameworks` files and merges them to a single `.xcframework` file for easier distribution.
|
|
4
|
-
*/
|
|
5
|
-
export declare function mergeFrameworks({ frameworkPaths, outputPath, sourceDir, }: {
|
|
6
|
-
frameworkPaths: string[];
|
|
7
|
-
outputPath: string;
|
|
8
|
-
sourceDir: string;
|
|
9
|
-
}): Promise<void>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import fs, { existsSync } from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { color, logger, spawn, spinner } from '@rock-js/tools';
|
|
4
|
-
/**
|
|
5
|
-
* Xcode emits different `.framework` file based on the destination (simulator arm64/x86_64, iphone arm64 etc.)
|
|
6
|
-
* This takes those `.frameworks` files and merges them to a single `.xcframework` file for easier distribution.
|
|
7
|
-
*/
|
|
8
|
-
export async function mergeFrameworks({ frameworkPaths, outputPath, sourceDir, }) {
|
|
9
|
-
const loader = spinner();
|
|
10
|
-
const xcframeworkName = path.basename(outputPath);
|
|
11
|
-
if (existsSync(outputPath)) {
|
|
12
|
-
logger.debug(`Removing `);
|
|
13
|
-
fs.rmSync(outputPath, { recursive: true, force: true });
|
|
14
|
-
}
|
|
15
|
-
loader.start(`Creating ${color.bold(xcframeworkName)}`);
|
|
16
|
-
const xcodebuildArgs = [
|
|
17
|
-
'-create-xcframework',
|
|
18
|
-
...frameworkPaths.flatMap((frameworkPath) => ['-framework', frameworkPath]),
|
|
19
|
-
'-output',
|
|
20
|
-
outputPath,
|
|
21
|
-
];
|
|
22
|
-
try {
|
|
23
|
-
await spawn('xcodebuild', xcodebuildArgs, { cwd: sourceDir });
|
|
24
|
-
loader.stop(`Created ${color.bold(xcframeworkName)}`);
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
loader.stop(`Couldn't create ${color.bold(xcframeworkName)}.`, 1);
|
|
28
|
-
throw new Error('Running xcodebuild failed', {
|
|
29
|
-
cause: error.stderr,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=mergeFrameworks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeFrameworks.js","sourceRoot":"","sources":["../../../src/lib/mergeFrameworks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,cAAc,EACd,UAAU,EACV,SAAS,GAKV;IACC,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAElD,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1B,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAExD,MAAM,cAAc,GAAG;QACrB,qBAAqB;QACrB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;QAC3E,SAAS;QACT,UAAU;KACX,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAE9D,MAAM,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,2BAA2B,EAAE;YAC3C,KAAK,EAAG,KAAyB,CAAC,MAAM;SACzC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import fs, { existsSync } from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import type { SubprocessError } from '@rock-js/tools';
|
|
4
|
-
import { color, logger, spawn, spinner } from '@rock-js/tools';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Xcode emits different `.framework` file based on the destination (simulator arm64/x86_64, iphone arm64 etc.)
|
|
8
|
-
* This takes those `.frameworks` files and merges them to a single `.xcframework` file for easier distribution.
|
|
9
|
-
*/
|
|
10
|
-
export async function mergeFrameworks({
|
|
11
|
-
frameworkPaths,
|
|
12
|
-
outputPath,
|
|
13
|
-
sourceDir,
|
|
14
|
-
}: {
|
|
15
|
-
frameworkPaths: string[];
|
|
16
|
-
outputPath: string;
|
|
17
|
-
sourceDir: string;
|
|
18
|
-
}) {
|
|
19
|
-
const loader = spinner();
|
|
20
|
-
const xcframeworkName = path.basename(outputPath);
|
|
21
|
-
|
|
22
|
-
if (existsSync(outputPath)) {
|
|
23
|
-
logger.debug(`Removing `);
|
|
24
|
-
fs.rmSync(outputPath, { recursive: true, force: true });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
loader.start(`Creating ${color.bold(xcframeworkName)}`);
|
|
28
|
-
|
|
29
|
-
const xcodebuildArgs = [
|
|
30
|
-
'-create-xcframework',
|
|
31
|
-
...frameworkPaths.flatMap((frameworkPath) => ['-framework', frameworkPath]),
|
|
32
|
-
'-output',
|
|
33
|
-
outputPath,
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
await spawn('xcodebuild', xcodebuildArgs, { cwd: sourceDir });
|
|
38
|
-
|
|
39
|
-
loader.stop(`Created ${color.bold(xcframeworkName)}`);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
loader.stop(`Couldn't create ${color.bold(xcframeworkName)}.`, 1);
|
|
42
|
-
throw new Error('Running xcodebuild failed', {
|
|
43
|
-
cause: (error as SubprocessError).stderr,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|