Skip to content

Commit

Permalink
Merge pull request #1471 from flexn-io/feat/rnv_new
Browse files Browse the repository at this point in the history
RNV bootstrapping
  • Loading branch information
pavjacko committed Apr 3, 2024
2 parents abd41cb + d5afffb commit 8432167
Show file tree
Hide file tree
Showing 620 changed files with 50,035 additions and 23,764 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Expand Up @@ -16,8 +16,8 @@ test/examples/*.js
**/projectTemplates
**/pluginTemplates
**/nodeModuleOverrides
**/supportFiles
**/coreTemplateFiles
**/templateFiles
**/templateFiles
packages/rnv/tests
jest.config.*.js
**/templates
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-harness-android.yml
Expand Up @@ -36,7 +36,7 @@ jobs:
cd packages/app-harness && yarn run:android-test & sleep 180
- name: E2E
run: |
cd packages/app-harness && yarn e2e:android && kill $(lsof -t -i:8083)
cd packages/app-harness && yarn e2e:android && kill $(lsof -t -i:8093)
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-harness-androidtv.yml
Expand Up @@ -36,7 +36,7 @@ jobs:
cd packages/app-harness && yarn run:androidtv-test & sleep 180
- name: E2E
run: |
cd packages/app-harness && yarn e2e:androidtv && kill $(lsof -t -i:8084)
cd packages/app-harness && yarn e2e:androidtv && kill $(lsof -t -i:8094)
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-harness-ios.yml
Expand Up @@ -37,7 +37,7 @@ jobs:
cd packages/app-harness && yarn run:ios-test & sleep 1200
- name: E2E
run: |
cd packages/app-harness && yarn e2e:ios && kill $(lsof -t -i:8082)
cd packages/app-harness && yarn e2e:ios && kill $(lsof -t -i:8092)
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-harness-tvos.yml
Expand Up @@ -37,7 +37,7 @@ jobs:
cd packages/app-harness && yarn run:tvos-test & sleep 1200
- name: E2E
run: |
cd packages/app-harness && yarn e2e:tvos && kill $(lsof -t -i:8089)
cd packages/app-harness && yarn e2e:tvos && kill $(lsof -t -i:8099)
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-harness-web.yml
Expand Up @@ -36,7 +36,7 @@ jobs:
cd packages/app-harness && yarn start:web-test & sleep 60
- name: E2E
run: |
cd packages/app-harness && yarn e2e:web && kill $(lsof -t -i:8080)
cd packages/app-harness && yarn e2e:web && kill $(lsof -t -i:8090)
# Commented because e2e tests would fail due to minion issues
# - name: Post message to Slack via Webhook
# if: ${{ github.event_name == 'push' && failure() }}
Expand Down
59 changes: 39 additions & 20 deletions .gitignore
Expand Up @@ -28,15 +28,23 @@ project.xcworkspace
# node.js
#
node_modules/
dist
lib

# NPM
#
npm-debug.log
yarn-error.log

# Yarn
#
yarn-error.log

# Lerna
#
lerna-debug.log

index/

# BUCK
#
buck-out/
\.buckd/

Expand All @@ -51,25 +59,36 @@ buck-out/


# Testing
/packages/**/coverage
/packages/**/dist
/packages/**/lib

.expo
#
coverage
reporting
coverage-ts

# IMPORTANT. in rnv .next should NOT be at the root level but in platformBuilds. if you see it in root level you should delete it
# .next

# RN Windows Engine
.binlog
packages/**/*.binlog
# Expo
#
.expo

dist
lib
# Next
#
.next

lerna-debug.log
yarn-error.log
# ReNative
#
.rnv
coverage-ts
.watchman-cookie-*
renative.private.json
renative.local.json
renative.local.json
renative.build.json
renative.runtime.json
rnv-config.local.json
metro.config.local.js
platformBuilds
platformAssets

# Other
#
.binlog
*.binlog
.bundle
vendor
.watchman-cookie-*
1 change: 1 addition & 0 deletions .prettierignore
Expand Up @@ -22,4 +22,5 @@ build

allure-results
pluginTemplates
templateFiles
*.d.ts
54 changes: 30 additions & 24 deletions __mocks__/@rnv/core.ts
Expand Up @@ -10,30 +10,32 @@ type Context = {

const rnvcore: any = jest.createMockFromModule('@rnv/core');

function mockChalk(v) {
return v;
}

const _chalkCols: any = {
white: (v) => v,
green: (v) => v,
red: (v) => v,
yellow: (v) => v,
default: (v) => v,
gray: (v) => v,
grey: (v) => v,
blue: (v) => v,
cyan: (v) => v,
magenta: (v) => v,
bold: (v) => v,
rgb: (v) => v,
white: mockChalk,
green: mockChalk,
red: mockChalk,
yellow: mockChalk,
default: mockChalk,
gray: mockChalk,
grey: mockChalk,
blue: mockChalk,
cyan: mockChalk,
magenta: mockChalk,
bold: mockChalk,
rgb: mockChalk,
};
function mockChalk() {
return _chalkCols;
}

Object.assign(mockChalk, _chalkCols);
Object.keys(_chalkCols).forEach((key) => {
_chalkCols[key] = mockChalk;
});
const _chalkMono = {
..._chalkCols,
};
// Object.keys(_chalkCols).forEach((key) => {
// _chalkCols[key] = mockChalk;
// });
// const _chalkMono = {
// ..._chalkCols,
// };

const generateRnvConfigPathObj = () => {
return {
Expand Down Expand Up @@ -61,6 +63,7 @@ const generateRnvConfigFileObj = () => {
};

const generateContextDefaults = (ctx?: Context) => {
const _opts = {};
const runtime: any = {
currentEngine: { rootPath: '' },
enginesByPlatform: {},
Expand Down Expand Up @@ -99,11 +102,13 @@ const generateContextDefaults = (ctx?: Context) => {
runtimePropsInjects: [],
supportedPlatforms: [],
systemPropsInjects: [],
program: {},
program: {
opts: () => _opts,
},
buildConfig: {},
command: '',
subCommand: '',
platform: ctx?.program.platform ?? '',
platform: ctx?.program.opts().platform ?? '',
process: {},
//==========
_renativePluginCache: {},
Expand Down Expand Up @@ -251,7 +256,8 @@ const generateContextDefaults = (ctx?: Context) => {
},
};
};
rnvcore.chalk = () => _chalkMono;
rnvcore.createTask = (task) => task;
rnvcore.chalk = () => _chalkCols;
rnvcore.createRnvContext = (ctx?: Context) => {
rnvcore.__MOCK_RNV_CONTEXT = generateContextDefaults(ctx);
};
Expand Down
18 changes: 14 additions & 4 deletions buildHooks/src/prePublish.ts
@@ -1,5 +1,13 @@
import path from 'path';
import { RnvContext, copyFileSync, fixPackageObject, fsExistsSync, readObjectSync, writeFileSync } from '@rnv/core';
import {
RnvContext,
RnvFileName,
copyFileSync,
fixPackageObject,
fsExistsSync,
readObjectSync,
writeFileSync,
} from '@rnv/core';
import fs from 'fs';

const merge = require('deepmerge');
Expand Down Expand Up @@ -29,7 +37,9 @@ const VERSIONED_PACKAGES = [
'sdk-webos',
'sdk-utils',
'renative',
'config-templates',
'integration-docker',
'adapter',
];

type PackageConfig = {
Expand All @@ -49,7 +59,7 @@ const setPackageVersions = (c: RnvContext, version: string | undefined, versione
const pkgFolder = path.join(c.paths.project.dir, 'packages');
_updateJson(c.paths.project.package, v);
versionedPackages.forEach(function (pkgName) {
_updateJson(path.join(pkgFolder, pkgName, 'package.json'), v);
_updateJson(path.join(pkgFolder, pkgName, RnvFileName.package), v);
});
};

Expand Down Expand Up @@ -116,7 +126,7 @@ export const prePublish = async (c: RnvContext) => {
},
});

_updateJson(path.join(pkgDirPath, 'rnv/coreTemplateFiles/renative.templates.json'), {
_updateJson(path.join(pkgDirPath, 'core/renative.templates.json'), {
engineTemplates: {
'@rnv/engine-rn': v,
'@rnv/engine-rn-tvos': v,
Expand All @@ -142,7 +152,7 @@ export const prePublish = async (c: RnvContext) => {
let pkgFile;

if (fs.statSync(dirPath).isDirectory()) {
_pkgPath = path.join(dirPath, 'package.json');
_pkgPath = path.join(dirPath, RnvFileName.package);
if (fsExistsSync(_pkgPath)) {
pkgFile = readObjectSync<any>(_pkgPath);
pkgName = pkgFile?.name;
Expand Down
9 changes: 3 additions & 6 deletions package.json
Expand Up @@ -56,8 +56,8 @@
"url": "git://github.com/flexn-io/renative.git"
},
"scripts": {
"bootstrap": "yarn run link:rnv && npx lerna bootstrap && yarn build",
"bootstrap-clean": "rimraf -I ./node_modules; npx lerna clean --yes && yarn bootstrap",
"bootstrap": "npx lerna@6 bootstrap && yarn build && yarn link:rnv",
"bootstrap-clean": "rimraf -I ./node_modules; npx lerna@6 clean --yes && yarn bootstrap",
"build": "lerna run build",
"compile": "npx lerna run compile",
"deploy:canary": "yarn pre-publish && npx lerna publish from-package --dist-tag canary && git push --tags origin HEAD",
Expand Down Expand Up @@ -99,7 +99,6 @@
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"babel-jest": "29.6.3",
"babel-plugin-module-resolver": "^5.0.0",
"deepmerge": "3.2.0",
"eslint": "8.19.0",
"eslint-config-prettier": "8.8.0",
Expand Down Expand Up @@ -143,12 +142,10 @@
"webpack",
"mini-css-extract-plugin",
"execa",
"**/@flexn/plugins",
"**/@flexn/graybox",
"**/appium-*",
"**/@wdio/*",
"**/@react-native/metro-babel-transformer"
]
},
"resolutions": {}
}
}
File renamed without changes.
2 changes: 2 additions & 0 deletions packages/adapter/README.md
@@ -0,0 +1,2 @@
# @rnv/adapter

39 changes: 39 additions & 0 deletions packages/adapter/package.json
@@ -0,0 +1,39 @@
{
"name": "@rnv/adapter",
"version": "1.0.0-rc.12",
"description": "ReNative Adapters for babel, metro, next and other build configs",
"keywords": [],
"homepage": "https://github.com/flexn-io/renative#readme",
"bugs": {
"url": "https://github.com/flexn-io/renative/issues"
},
"license": "MIT",
"author": "Pavel Jacko <pavel.jacko@gmail.com> (https://github.com/pavjacko)",
"files": [
"LICENSE",
"lib",
"types.d.ts"
],
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/flexn-io/renative.git"
},
"scripts": {
"bootstrap": "yarn && yarn build && npm link",
"build": "yarn clean && yarn compile",
"clean": "rimraf -I ./lib && rimraf -I tsconfig.tsbuildinfo",
"compile": "tsc -b tsconfig.json",
"compile:prod": "tsc -b tsconfig.json",
"lint": "eslint . --ext .ts",
"watch": "tsc --watch --preserveWatchOutput"
},
"dependencies": {
"babel-plugin-module-resolver": "^5.0.0"
},
"peerDependencies": {},
"private": false,
"publishConfig": {
"access": "public"
}
}

0 comments on commit 8432167

Please sign in to comment.