Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/add app harness #20

Draft
wants to merge 12 commits into
base: release/1.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ tsconfig.tsbuildinfo
.vscode

!**/overrides/**/lib
!**/overrides/**/build
!**/overrides/**/build

**/renative.local.json

.DS_Store

**/vendor
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"react-native": "0.67.2",
"husky": "4.2.5",
"lerna": "6.6.2",
"rnv": "0.37.0-canary.11",
"@rnv/core": "1.0.0-rc.1",
"rnv": "1.0.0-rc.1",
"typescript": "4.9.5",
"prettier": "2.3.1",
"eslint": "8.40.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/app-harness/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
35 changes: 35 additions & 0 deletions packages/app-harness/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# --------------------------------
# Generated by ReNative
# --------------------------------

.DS_Store
node_modules/
npm-debug.log
yarn-error.log
.env
.next
.expo

#-------------------------------
# Visual Studio
#-------------------------------
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

#-------------------------------
# RENATIVE
#-------------------------------

platformBuilds/
platformAssets/
buildHooks/dist
buildHooks/lib
renative.local.json
renative.private.json
renative.build.json
renative.runtime.json
rnv-config.local.json
metro.config.local.js
8 changes: 8 additions & 0 deletions packages/app-harness/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.12'
gem 'activesupport', '~> 7.0', '<= 7.0.8'

99 changes: 99 additions & 0 deletions packages/app-harness/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.14.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.14.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.3)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.2)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.7.1)
minitest (5.20.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.6)
ruby-macho (2.5.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)

PLATFORMS
ruby

DEPENDENCIES
activesupport (~> 7.0, <= 7.0.8)
cocoapods (~> 1.12)

RUBY VERSION
ruby 3.1.1p18

BUNDLED WITH
2.3.7
15 changes: 15 additions & 0 deletions packages/app-harness/appConfigs/app/renative.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "../../../../.rnv/schema/rnv.app.json",
"extendsTemplate": "@rnv/template-starter/appConfigs/base/renative.json",
"id": "app",
"common": {
"id": "com.rnv.myapp",
"title": "Hello ReNative",
"description": "ReNative App",
"buildSchemes": {},
"runtime": {
"welcomeMessage": "Hello ReNative!"
}
},
"platforms": {}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/app-harness/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { withRNVBabel } = require('rnv');

module.exports = withRNVBabel({});
11 changes: 11 additions & 0 deletions packages/app-harness/buildHooks/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { logHook } from '@rnv/core';

const hooks = {
hello: async () => {
logHook('Hello build hook!');
},
};

const pipes = {};

export { pipes, hooks };
1 change: 1 addition & 0 deletions packages/app-harness/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './src/entry/'; //eslint-disable-line
3 changes: 3 additions & 0 deletions packages/app-harness/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { withRNVMetro } = require('rnv');

module.exports = withRNVMetro({});
5 changes: 5 additions & 0 deletions packages/app-harness/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
7 changes: 7 additions & 0 deletions packages/app-harness/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { withRNV } = require('@rnv/engine-rn-next');

const config = {
compress: false,
};

module.exports = withRNV(config);
51 changes: 51 additions & 0 deletions packages/app-harness/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"devDependencies": {
"typescript": "4.9.5",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.6",
"@types/react-native": "0.72.3",
"@flexn/typescript-config": "1.0.0",
"@flexn/assets-renative-outline": "0.3.2",
"babel-loader": "9.1.3",
"rnv": "1.0.0-rc.1",
"@rnv/template-starter": "1.0.0-rc.1",
"@rnv/engine-rn": "1.0.0-rc.1",
"@rnv/engine-rn-tvos": "1.0.0-rc.1",
"@rnv/engine-rn-next": "1.0.0-rc.1",
"@rnv/engine-rn-web": "1.0.0-rc.1",
"@rnv/engine-rn-electron": "1.0.0-rc.1",
"xcode": "2.1.0",
"jetifier": "1.6.5"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"resolutions": {
"@babel/traverse": "7.15.0",
"@types/react": "18.2.6"
},
"name": "app-harness",
"version": "0.1.0",
"dependencies": {
"raf": "3.4.1",
"@rnv/renative": "1.0.0-rc.1",
"react": "18.2.0",
"react-art": "18.2.0",
"react-dom": "18.2.0",
"react-native-gesture-handler": "2.13.1",
"react-native": "0.72.4",
"next": "13.5.2",
"react-native-web": "0.19.9",
"react-native-tvos": "0.72.4-0",
"@react-native-community/cli": "^11.3.8"
}
}
6 changes: 6 additions & 0 deletions packages/app-harness/react-native.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! NO CONSOLE LOGS HERE. IT WILL BREAK THE APP
const { withRNVRNConfig } = require('rnv');

const config = withRNVRNConfig({});

module.exports = config;
39 changes: 39 additions & 0 deletions packages/app-harness/renative.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "../../.rnv/schema/rnv.template.json",
"platforms": {},
"plugins": {
"@react-native-community/cli": "^11.3.8"
},
"extendsTemplate": "@rnv/template-starter/renative.json",
"projectName": "app-harness",
"projectVersion": "0.1.0",
"workspaceID": "rnv",
"defaults": {
"supportedPlatforms": [
"ios",
"android",
"androidtv",
"firetv",
"androidwear",
"web",
"webtv",
"tizen",
"tvos",
"webos",
"macos",
"windows",
"tizenwatch",
"tizenmobile",
"kaios",
"chromecast"
]
},
"engines": {},
"templates": {
"@rnv/template-starter": {
"version": "1.0.0-rc.1"
}
},
"currentTemplate": "@rnv/template-starter",
"isMonorepo": true
}
55 changes: 55 additions & 0 deletions packages/app-harness/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React, { useContext, useEffect, useState } from 'react';
import { Text, Image, View, PixelRatio, TouchableOpacity } from 'react-native';
import { Api } from '@rnv/renative';
import { ICON_LOGO, CONFIG, ThemeProvider, ThemeContext, testProps } from '../config';
import packageJson from '../../package.json';

const App = () => (
<ThemeProvider>
<AppThemed />
</ThemeProvider>
);

const AppThemed = () => {
const { theme, toggle } = useContext(ThemeContext);

const [pixelRatio, setPixelRatio] = useState(1);
const [fontScale, setFontScale] = useState(1);

useEffect(() => {
setPixelRatio(PixelRatio.get());
setFontScale(PixelRatio.getFontScale());
}, []);

return (
<View style={theme.styles.container}>
<Image
style={theme.styles.image}
source={ICON_LOGO}
{...testProps('template-starter-home-screen-renative-image')}
/>
<Text style={theme.styles.textH2} {...testProps('template-starter-home-screen-welcome-message-text')}>
{CONFIG.welcomeMessage}
</Text>
<Text style={theme.styles.textH2} {...testProps('template-starter-home-screen-version-number-text')}>
v {packageJson.version}
</Text>
<Text style={theme.styles.textH3}>
{`platform: ${Api.platform}, factor: ${Api.formFactor}, engine: ${Api.engine}`}
</Text>
<Text style={theme.styles.textH3}>{`hermes: ${
typeof HermesInternal === 'object' && HermesInternal !== null ? 'yes' : 'no'
}`}</Text>
<Text style={theme.styles.textH3}>{`pixelRatio: ${pixelRatio}, ${fontScale}`}</Text>
<TouchableOpacity
onPress={toggle}
style={theme.styles.button}
{...testProps('template-starter-home-screen-try-my-button')}
>
<Text style={theme.styles.buttonText}>Try me!</Text>
</TouchableOpacity>
</View>
);
};

export default App;
Loading
Loading