Skip to content

Commit

Permalink
Merge branch 'release/1.0' into fix/add_customization
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaDiachenko authored Dec 20, 2023
2 parents 3459de2 + 706bae7 commit 713192a
Show file tree
Hide file tree
Showing 42 changed files with 195 additions and 151 deletions.
1 change: 1 addition & 0 deletions buildHooks/src/prePublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fs from 'fs';
const merge = require('deepmerge');

const VERSIONED_PACKAGES = [
'app-harness',
'rnv',
'core',
'build-hooks-git',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flexn/renative-monorepo",
"version": "1.0.0-rc.4",
"version": "1.0.0-rc.6",
"description": "🚀🚀🚀 Unified Development Platform. Bootstrap, Develop & Deploy `iOS`, `tvOS`, `Android`, `Android TV`, `Fire TV`, `Android Wear`, `Web`, `Tizen TV`, `Tizen Watch`, `Tizen Mobile`, `LG webOS`, `macOS/OSX`, `Windows`, `KaiOS`, `Linux` and `Chromecast` platforms",
"keywords": [
"android tv",
Expand Down Expand Up @@ -84,8 +84,8 @@
"@flexn/eslint-config": "1.0.0",
"@flexn/prettier-config": "1.0.0",
"@flexn/typescript-config": "1.0.0",
"@rnv/build-hooks-git": "1.0.0-rc.4",
"@rnv/core": "1.0.0-rc.4",
"@rnv/build-hooks-git": "1.0.0-rc.6",
"@rnv/core": "1.0.0-rc.6",
"@types/jest": "~27.0.2",
"@types/kill-port": "2.0.0",
"@types/lodash.get": "4.4.7",
Expand Down
22 changes: 11 additions & 11 deletions packages/app-harness/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rnv/app-harness",
"version": "1.0.0-feat-pin-cli.6",
"version": "1.0.0-rc.6",
"description": "ReNative Test Harness App",
"keywords": [],
"homepage": "https://github.com/flexn-io/renative#readme",
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"dependencies": {
"@lightningjs/sdk": "^5.4.1",
"@rnv/renative": "1.0.0-rc.4",
"@rnv/renative": "1.0.0-rc.6",
"next": "13.5.2",
"raf": "3.4.1",
"react": "18.2.0",
Expand All @@ -50,22 +50,22 @@
"devDependencies": {
"@flexn/assets-renative-outline": "0.3.2",
"@flexn/graybox": "1.0.0-feat.12",
"@rnv/core": "1.0.0-rc.4",
"@rnv/engine-lightning": "1.0.0-rc.4",
"@rnv/engine-rn": "1.0.0-rc.4",
"@rnv/engine-rn-electron": "1.0.0-rc.4",
"@rnv/engine-rn-next": "1.0.0-rc.4",
"@rnv/engine-rn-tvos": "1.0.0-rc.4",
"@rnv/engine-rn-web": "1.0.0-rc.4",
"@rnv/template-starter": "^1.0.0-rc.4",
"@rnv/core": "1.0.0-rc.6",
"@rnv/engine-lightning": "1.0.0-rc.6",
"@rnv/engine-rn": "1.0.0-rc.6",
"@rnv/engine-rn-electron": "1.0.0-rc.6",
"@rnv/engine-rn-next": "1.0.0-rc.6",
"@rnv/engine-rn-tvos": "1.0.0-rc.6",
"@rnv/engine-rn-web": "1.0.0-rc.6",
"@rnv/template-starter": "1.0.0-rc.6",
"@types/react": "18.2.22",
"@types/react-dom": "18.2.7",
"@types/react-native": "0.72.2",
"babel-jest": "29.2.1",
"babel-loader": "9.1.3",
"detox": "18.20.2",
"jetifier": "2.0.0",
"rnv": "1.0.0-rc.4"
"rnv": "1.0.0-rc.6"
},
"private": true,
"browserslist": {
Expand Down
4 changes: 2 additions & 2 deletions packages/build-hooks-git/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rnv/build-hooks-git",
"version": "1.0.0-rc.4",
"version": "1.0.0-rc.6",
"description": "Build Hooks for Git",
"keywords": [],
"homepage": "https://github.com/flexn-io/renative#readme",
Expand Down Expand Up @@ -30,7 +30,7 @@
"simple-git": "^3.16.0"
},
"peerDependencies": {
"@rnv/core": "^1.0.0-rc.4"
"@rnv/core": "^1.0.0-rc.6"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/build-hooks-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"zod-to-json-schema": "3.21.4"
},
"peerDependencies": {
"@rnv/core": "^1.0.0-rc.4"
"@rnv/core": "^1.0.0-rc.6"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rnv/cli",
"version": "1.0.0-rc.4",
"version": "1.0.0-rc.6",
"description": "ReNative CLI",
"keywords": [],
"homepage": "https://github.com/flexn-io/renative#readme",
Expand Down Expand Up @@ -37,7 +37,7 @@
"inquirer": "8.2.0"
},
"peerDependencies": {
"@rnv/core": "^1.0.0-rc.4"
"@rnv/core": "^1.0.0-rc.6"
},
"private": false,
"publishConfig": {
Expand Down
22 changes: 9 additions & 13 deletions packages/cli/src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,19 @@ export const inquirerPrompt = async (params: PromptParams): Promise<Record<strin

const msg = params.logMessage || params.warningMessage || params.message;
if (c.program?.ci) {
try {
if (
Array.isArray(params.choices) &&
typeof params.default !== 'undefined' &&
params.choices.includes(params.default)
) {
logDebug(`defaulting to choice '${params.default}' for prompt '${params.name}'`);
if (
Array.isArray(params.choices) &&
typeof params.default !== 'undefined' &&
params.choices.includes(params.default)
) {
logDebug(`defaulting to choice '${params.default}' for prompt '${params.name}'`);

if (params.name) return { [params.name]: params.default };
}
throw new Error(msg);
} catch (error) {
logWarning(error instanceof Error ? error.message : error);
if (params.name) return { [params.name]: params.default };
}
return Promise.reject(`--ci option does not allow prompts. question: ${msg}.`);
}
if (msg && params.logMessage) logTask(msg, chalk().grey);
if (msg && params.warningMessage && !c.program.ci) logWarning(msg);
if (msg && params.warningMessage) logWarning(msg);

// allow passing in just { type: 'prompt', ... } instead of { type: 'prompt', name: 'prompt', ... }
const { type, name } = params;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rnv/core",
"version": "1.0.0-rc.4",
"version": "1.0.0-rc.6",
"description": "RNV Core SDK",
"keywords": [],
"homepage": "https://github.com/flexn-io/renative#readme",
Expand Down
21 changes: 19 additions & 2 deletions packages/core/src/configs/configProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,33 @@ export const generatePlatformTemplatePaths = (c: RnvContext) => {
if (originalPath) {
if (!pt[platform]) {
const pt1 = getRealPath(c, originalPath, 'platformTemplatesDir', originalPath);
if (pt1) result[platform] = pt1;
if (pt1) {
result[platform] = pt1;
} else {
logWarning(`Cannot resolve originalTemplatePlatformsDir: ${originalPath}. SKIPPING...`);
}
} else {
const pt2 = getRealPath(c, pt[platform], 'platformTemplatesDir', originalPath);
if (pt2) result[platform] = pt2;
if (pt2) {
result[platform] = pt2;
} else {
logWarning(
`Cannot resolve platformTemplatesDirs[${platform}] with original path: ${originalPath}. SKIPPING...`
);
}
}
} else {
logWarning(
`Platform ${chalk().red(platform)} not supported by any registered engine. SKIPPING...`
);
}
} else if (platform === c.platform && c.runtime.currentEngine) {
//NOTE: only log warning if there is already registered engine but cannot be found by platform
logWarning(
`Could not find active engine for platform: ${chalk().red(
platform
)}. Available engine platforms: ${Object.keys(c.runtime.enginesByPlatform)}`
);
}
}
});
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/context/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const configureRuntimeDefaults = async (c: RnvContext) => {
if (c.buildConfig.defaults?.supportedPlatforms) {
c.runtime.supportedPlatforms = [];
c.buildConfig.defaults.supportedPlatforms.forEach((platform) => {
//TODO: migrate to singular platform engine
const engine = getEngineRunnerByPlatform(c, platform);
if (engine) {
const dir = engine.originalTemplatePlatformsDir;
Expand Down
23 changes: 16 additions & 7 deletions packages/core/src/platforms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,30 @@ export const createPlatformBuild = (c: RnvContext, platform: RnvPlatform) =>

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

const ptDir = c.paths.project.platformTemplatesDirs[platform];
if (!ptDir) {
logError(`Cannot create platform build: c.paths.project.platformTemplatesDirs[${platform}] is not defined`);
return;
}

const pPath = getAppFolder(c);
const ptPath = path.join(c.paths.project.platformTemplatesDirs[platform], `${platform}`);
const ptPath = path.join(ptDir, `${platform}`);

copyFolderContentsRecursiveSync(
ptPath,
pPath,
false,
[path.join(ptPath, '_privateConfig')],
false,
[{
pattern: '{{PATH_REACT_NATIVE}}',
override: doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native', true, {
forceForwardPaths: true,
}) || '',
}],
[
{
pattern: '{{PATH_REACT_NATIVE}}',
override:
doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native', true, {
forceForwardPaths: true,
}) || '',
},
],
getTimestampPathsConfig(c, platform),
c
);
Expand Down
15 changes: 12 additions & 3 deletions packages/core/src/projects/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const checkNpxIsInstalled = async () => {

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

type NpmVersion = { name: string; value: string };

export const listAndSelectNpmVersion = async (c: RnvContext, npmPackage: string) => {
const templateVersionsStr = await executeAsync(c, `npm view ${npmPackage} versions`);
const versionArr = templateVersionsStr.replace(/\r?\n|\r|\s|'|\[|\]/g, '').split(',');
Expand All @@ -46,9 +48,11 @@ export const listAndSelectNpmVersion = async (c: RnvContext, npmPackage: string)
});

versionArr.reverse();
const validVersions = versionArr.map((v: string) => ({ name: v, value: v }));
const validVersions: NpmVersion[] = versionArr.map((v: string) => ({ name: v, value: v }));

let recommendedVersion;
const validVersionsStandard: NpmVersion[] = [];
const validVersionsHead: NpmVersion[] = [];
validVersions.forEach((item) => {
let matchStr = '';
const matchArr: Array<string> = [];
Expand All @@ -58,24 +62,29 @@ export const listAndSelectNpmVersion = async (c: RnvContext, npmPackage: string)
}
});
if (matchArr.length) {
matchStr = ` (HEAD: ${matchArr.join(', ')})`;
matchStr = ` (@${matchArr.join(', ')})`;
item.name = `${item.value}${matchStr}`;
if (matchArr[0] === 'latest') {
recommendedVersion = item;
}
validVersionsHead.push(item);
} else {
validVersionsStandard.push(item);
}
});
if (!recommendedVersion) {
recommendedVersion = validVersions[0];
}

const validVersionsCombined = validVersionsHead.concat(validVersionsStandard);

const { inputTemplateVersion } = await inquirerPrompt({
name: 'inputTemplateVersion',
type: 'list',
message: `What ${npmPackage} version to use?`,
default: recommendedVersion.value,
loop: false,
choices: validVersions,
choices: validVersionsCombined,
});

return inputTemplateVersion;
Expand Down
14 changes: 7 additions & 7 deletions packages/engine-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rnv/engine-core",
"version": "1.0.0-rc.4",
"version": "1.0.0-rc.6",
"description": "ReNative Engine Core",
"keywords": [],
"homepage": "https://github.com/flexn-io/renative#readme",
Expand Down Expand Up @@ -29,17 +29,17 @@
"watch": "tsc --watch --preserveWatchOutput"
},
"dependencies": {
"@rnv/sdk-android": "1.0.0-rc.4",
"@rnv/sdk-apple": "1.0.0-rc.4",
"@rnv/sdk-kaios": "1.0.0-rc.4",
"@rnv/sdk-tizen": "1.0.0-rc.4",
"@rnv/sdk-webos": "1.0.0-rc.4",
"@rnv/sdk-android": "1.0.0-rc.6",
"@rnv/sdk-apple": "1.0.0-rc.6",
"@rnv/sdk-kaios": "1.0.0-rc.6",
"@rnv/sdk-tizen": "1.0.0-rc.6",
"@rnv/sdk-webos": "1.0.0-rc.6",
"iocane": "4.0.0",
"kill-port": "1.6.1",
"tar": "4.4.19"
},
"peerDependencies": {
"@rnv/core": "^1.0.0-rc.4"
"@rnv/core": "^1.0.0-rc.6"
},
"private": false,
"publishConfig": {
Expand Down
Loading

0 comments on commit 713192a

Please sign in to comment.