Skip to content

Commit 813d72b

Browse files
authored
Merge pull request #1310 from flexn-io/fix/sanity-fixes
Blocker issues hotfixes
2 parents f7aec32 + 50afd78 commit 813d72b

File tree

10 files changed

+65
-26
lines changed

10 files changed

+65
-26
lines changed

buildHooks/src/prePublish.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import fs from 'fs';
55
const merge = require('deepmerge');
66

77
const VERSIONED_PACKAGES = [
8+
'app-harness',
89
'rnv',
910
'core',
1011
'build-hooks-git',

packages/app-harness/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rnv/app-harness",
3-
"version": "1.0.0-feat-pin-cli.6",
3+
"version": "1.0.0-rc.5",
44
"description": "ReNative Test Harness App",
55
"keywords": [],
66
"homepage": "https://github.com/flexn-io/renative#readme",

packages/core/src/configs/configProject.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,33 @@ export const generatePlatformTemplatePaths = (c: RnvContext) => {
118118
if (originalPath) {
119119
if (!pt[platform]) {
120120
const pt1 = getRealPath(c, originalPath, 'platformTemplatesDir', originalPath);
121-
if (pt1) result[platform] = pt1;
121+
if (pt1) {
122+
result[platform] = pt1;
123+
} else {
124+
logWarning(`Cannot resolve originalTemplatePlatformsDir: ${originalPath}. SKIPPING...`);
125+
}
122126
} else {
123127
const pt2 = getRealPath(c, pt[platform], 'platformTemplatesDir', originalPath);
124-
if (pt2) result[platform] = pt2;
128+
if (pt2) {
129+
result[platform] = pt2;
130+
} else {
131+
logWarning(
132+
`Cannot resolve platformTemplatesDirs[${platform}] with original path: ${originalPath}. SKIPPING...`
133+
);
134+
}
125135
}
126136
} else {
127137
logWarning(
128138
`Platform ${chalk().red(platform)} not supported by any registered engine. SKIPPING...`
129139
);
130140
}
141+
} else if (platform === c.platform && c.runtime.currentEngine) {
142+
//NOTE: only log warning if there is already registered engine but cannot be found by platform
143+
logWarning(
144+
`Could not find active engine for platform: ${chalk().red(
145+
platform
146+
)}. Available engine platforms: ${Object.keys(c.runtime.enginesByPlatform)}`
147+
);
131148
}
132149
}
133150
});

packages/core/src/context/runtime.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const configureRuntimeDefaults = async (c: RnvContext) => {
5252
if (c.buildConfig.defaults?.supportedPlatforms) {
5353
c.runtime.supportedPlatforms = [];
5454
c.buildConfig.defaults.supportedPlatforms.forEach((platform) => {
55+
//TODO: migrate to singular platform engine
5556
const engine = getEngineRunnerByPlatform(c, platform);
5657
if (engine) {
5758
const dir = engine.originalTemplatePlatformsDir;

packages/core/src/platforms/index.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,30 @@ export const createPlatformBuild = (c: RnvContext, platform: RnvPlatform) =>
5757

5858
if (!platform || !isPlatformSupportedSync(c, platform, undefined, reject)) return;
5959

60+
const ptDir = c.paths.project.platformTemplatesDirs[platform];
61+
if (!ptDir) {
62+
logError(`Cannot create platform build: c.paths.project.platformTemplatesDirs[${platform}] is not defined`);
63+
return;
64+
}
65+
6066
const pPath = getAppFolder(c);
61-
const ptPath = path.join(c.paths.project.platformTemplatesDirs[platform], `${platform}`);
67+
const ptPath = path.join(ptDir, `${platform}`);
6268

6369
copyFolderContentsRecursiveSync(
6470
ptPath,
6571
pPath,
6672
false,
6773
[path.join(ptPath, '_privateConfig')],
6874
false,
69-
[{
70-
pattern: '{{PATH_REACT_NATIVE}}',
71-
override: doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native', true, {
72-
forceForwardPaths: true,
73-
}) || '',
74-
}],
75+
[
76+
{
77+
pattern: '{{PATH_REACT_NATIVE}}',
78+
override:
79+
doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native', true, {
80+
forceForwardPaths: true,
81+
}) || '',
82+
},
83+
],
7584
getTimestampPathsConfig(c, platform),
7685
c
7786
);

packages/core/src/projects/npm.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export const checkNpxIsInstalled = async () => {
2828

2929
export const areNodeModulesInstalled = () => !!doResolve('resolve', false);
3030

31+
type NpmVersion = { name: string; value: string };
32+
3133
export const listAndSelectNpmVersion = async (c: RnvContext, npmPackage: string) => {
3234
const templateVersionsStr = await executeAsync(c, `npm view ${npmPackage} versions`);
3335
const versionArr = templateVersionsStr.replace(/\r?\n|\r|\s|'|\[|\]/g, '').split(',');
@@ -46,9 +48,11 @@ export const listAndSelectNpmVersion = async (c: RnvContext, npmPackage: string)
4648
});
4749

4850
versionArr.reverse();
49-
const validVersions = versionArr.map((v: string) => ({ name: v, value: v }));
51+
const validVersions: NpmVersion[] = versionArr.map((v: string) => ({ name: v, value: v }));
5052

5153
let recommendedVersion;
54+
const validVersionsStandard: NpmVersion[] = [];
55+
const validVersionsHead: NpmVersion[] = [];
5256
validVersions.forEach((item) => {
5357
let matchStr = '';
5458
const matchArr: Array<string> = [];
@@ -58,24 +62,29 @@ export const listAndSelectNpmVersion = async (c: RnvContext, npmPackage: string)
5862
}
5963
});
6064
if (matchArr.length) {
61-
matchStr = ` (HEAD: ${matchArr.join(', ')})`;
65+
matchStr = ` (@${matchArr.join(', ')})`;
6266
item.name = `${item.value}${matchStr}`;
6367
if (matchArr[0] === 'latest') {
6468
recommendedVersion = item;
6569
}
70+
validVersionsHead.push(item);
71+
} else {
72+
validVersionsStandard.push(item);
6673
}
6774
});
6875
if (!recommendedVersion) {
6976
recommendedVersion = validVersions[0];
7077
}
7178

79+
const validVersionsCombined = validVersionsHead.concat(validVersionsStandard);
80+
7281
const { inputTemplateVersion } = await inquirerPrompt({
7382
name: 'inputTemplateVersion',
7483
type: 'list',
7584
message: `What ${npmPackage} version to use?`,
7685
default: recommendedVersion.value,
7786
loop: false,
78-
choices: validVersions,
87+
choices: validVersionsCombined,
7988
});
8089

8190
return inputTemplateVersion;

packages/sdk-android/src/gradleParser.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,19 @@ export const parseAppBuildGradleSync = (c: Context) => {
264264

265265
c.payload.pluginConfigAndroid.store = {
266266
storeFile: storeFile,
267-
// keyAlias,
268-
// storePassword,
269-
// keyPassword,
270267
};
271268

272269
if (!!storeFile && !!keyAlias && !!storePassword && !!keyPassword) {
273270
const keystorePath = storeFile;
274271
let keystorePathFull = keystorePath;
275272
if (keystorePath) {
276-
if (keystorePath.startsWith('.')) {
277-
keystorePathFull = path.join(c.paths.workspace.project.dir, keystorePath);
278-
} else if (!fsExistsSync(keystorePath)) {
279-
keystorePathFull = path.join(c.paths.workspace.project.dir, keystorePath);
273+
if (keystorePath.startsWith('.') || !fsExistsSync(keystorePathFull)) {
274+
//NOTE: because of merged logic we don't know whether renative.private.json
275+
// values come from project or appConfig so we selectively check both
276+
keystorePathFull = path.join(c.paths.workspace.appConfig.dir, keystorePath);
277+
if (!fsExistsSync(keystorePathFull)) {
278+
keystorePathFull = path.join(c.paths.workspace.project.dir, keystorePath);
279+
}
280280
}
281281
if (isSystemWin) {
282282
keystorePathFull = keystorePathFull.replace(/\\/g, '/');

packages/sdk-android/src/manifestParser.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ export const parseAndroidManifestSync = (c: Context) => {
194194
// PARSE all standard renative.*.json files in correct mergeOrder
195195
objArr.forEach((tpl) => {
196196
const manifestObj = tpl?.AndroidManifest_xml;
197-
_mergeNodeParameters(baseManifestFile, manifestObj);
197+
if (manifestObj) {
198+
_mergeNodeParameters(baseManifestFile, manifestObj);
199+
}
198200
if (manifestObj?.children) {
199201
_mergeNodeChildren(baseManifestFile, manifestObj.children);
200202
}

packages/sdk-react-native/src/androidRunner.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export const packageReactNativeAndroid = async (c: RnvContext) => {
7070

7171
await executeAsync(c, cmd, {
7272
env: {
73-
...CoreEnvVars.RNV_EXTENSIONS(),
7473
...CoreEnvVars.BASE(),
74+
...CoreEnvVars.RNV_EXTENSIONS(),
7575
...EnvVars.RNV_REACT_NATIVE_PATH(),
7676
...EnvVars.RNV_APP_ID(),
7777
},
@@ -138,6 +138,8 @@ export const buildReactNativeAndroid = async (c: RnvContext) => {
138138
cwd: appFolder,
139139
env: {
140140
...CoreEnvVars.BASE(),
141+
//NOTE: we need extensions here because rn will trigger packaging step in release mode
142+
...CoreEnvVars.RNV_EXTENSIONS(),
141143
...EnvVars.RNV_REACT_NATIVE_PATH(),
142144
...EnvVars.RNV_APP_ID(),
143145
},

packages/template-starter/renative.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
},
6969
"templates": {
7070
"@rnv/template-starter": {
71-
"version": "^1.0.0-rc.5"
71+
"version": "1.0.0-rc.5"
7272
}
7373
},
7474
"currentTemplate": "@rnv/template-starter",
@@ -109,9 +109,7 @@
109109
"minSdkVersion": 21,
110110
"extendPlatform": "android",
111111
"engine": "engine-rn-tvos",
112-
"includedPermissions": [
113-
"INTERNET"
114-
]
112+
"includedPermissions": ["INTERNET"]
115113
},
116114
"web": {
117115
"engine": "engine-rn-next"

0 commit comments

Comments
 (0)