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

ReNative major refactor #1113

Merged
merged 119 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
9782fc3
merge with release
mihaiblaga89 Aug 21, 2023
78e738f
initial
mihaiblaga89 Aug 30, 2023
ea3fc5f
android native code is building
mihaiblaga89 Aug 31, 2023
8f77ce7
ANDROID WORKS
mihaiblaga89 Aug 31, 2023
8d19749
ios working
mihaiblaga89 Aug 31, 2023
c48431e
Merge branch 'feat/rn_update' into feat/rn-upgrade-ts
pavjacko Sep 5, 2023
b514af6
remove gradle from template, taken out tokens from gradle config file…
mihaiblaga89 Sep 5, 2023
d6acf95
android works, for real this time
mihaiblaga89 Sep 5, 2023
a1c2bf8
Merge branch 'feat/rn_update' into feat/rn-upgrade-ts
pavjacko Sep 5, 2023
2acfb22
android and ios now working
mihaiblaga89 Sep 6, 2023
8cf4dc4
android works through rnv
mihaiblaga89 Sep 6, 2023
08894e2
android export works
mihaiblaga89 Sep 6, 2023
c2dd0ae
initial templating of java files
mihaiblaga89 Sep 6, 2023
d2111b9
Merge branch 'main' into feat/rn-upgrade-ts
pavjacko Sep 6, 2023
9270564
ios pods working
mihaiblaga89 Sep 6, 2023
868f49b
Merge branch 'feat/rn-upgrade-ts' of github.com:flexn-io/renative int…
pavjacko Sep 6, 2023
d5d32bf
add notes
pavjacko Sep 6, 2023
fd35dff
ios run working through rnv
mihaiblaga89 Sep 7, 2023
73ffbf7
change pbxproj to latest, disable packager
Sep 11, 2023
bd33fde
fix bundler, revert fonts
Sep 13, 2023
53e205a
fix rn permissions, add node_require injection, change pod checksum t…
Sep 13, 2023
0d5135f
add sdk tizen
pavjacko Sep 13, 2023
6b9dfcb
Merge branch 'feat/rn-upgrade-ts' of github.com:flexn-io/renative int…
pavjacko Sep 13, 2023
a05e4d5
add webos sdk package
pavjacko Sep 13, 2023
3323ecc
migrate device manager, add sdk-kaios
pavjacko Sep 13, 2023
6c219a5
refactor installers
pavjacko Sep 13, 2023
e729fc2
migrate engine-core to separate pakage
pavjacko Sep 13, 2023
1a0aacd
packages split refactor
pavjacko Sep 14, 2023
fa9f7b0
context => contextManager
pavjacko Sep 14, 2023
291240c
remove setupManager
pavjacko Sep 14, 2023
884110e
migrate sdk code from engines to sdks, deprecate firefoxos
pavjacko Sep 14, 2023
7a264a3
refactor cleanup
pavjacko Sep 14, 2023
c9c0f6d
migrate sdk constants from core
pavjacko Sep 14, 2023
5779847
migration fixes
pavjacko Sep 14, 2023
e13d83d
fix rnv engine-core import
pavjacko Sep 14, 2023
a19504a
fix undefined subpath
pavjacko Sep 14, 2023
24d7391
fix bootstrap
pavjacko Sep 14, 2023
8563db3
fix podfile permissions
mihaiblaga89 Sep 14, 2023
769360f
Merge branch 'feat/rn-upgrade-ts-2' of github.com:pavjacko/renative i…
mihaiblaga89 Sep 14, 2023
244534f
fix web
mihaiblaga89 Sep 14, 2023
719f1ff
fix lightning entry
pavjacko Sep 14, 2023
5902545
Merge branch 'feat/rn-upgrade-ts-2' of github.com:flexn-io/renative i…
pavjacko Sep 14, 2023
288c42d
remove deprecated console.disableYellowBox
pavjacko Sep 14, 2023
db0d026
fix paths
pavjacko Sep 15, 2023
629a17f
rn config update to point to template instead of app for now
pavjacko Sep 15, 2023
52dabca
split rnv to core and cli
pavjacko Sep 15, 2023
8e22f85
migrate cli imports
pavjacko Sep 15, 2023
2c1a4fb
update babel-loader, preset-react, use it instead of babel-preset-rea…
mihaiblaga89 Sep 15, 2023
5ba3462
abstract cli API in rnv core via DI
pavjacko Sep 15, 2023
7b82f78
refactor cleanup and import fixes
pavjacko Sep 15, 2023
15c99c5
fix cli entry
pavjacko Sep 15, 2023
d7cede8
Merge branch 'feat/rn-upgrade-ts-2' into fix/macos_babel
pavjacko Sep 15, 2023
30b5a91
dependency cleanup
pavjacko Sep 15, 2023
9b443b4
cleanup allowjs
pavjacko Sep 15, 2023
cac94d9
Merge pull request #1106 from flexn-io/fix/macos_babel
pavjacko Sep 15, 2023
1c8668a
refactor config to context
pavjacko Sep 15, 2023
f5277c0
context rename finalised
pavjacko Sep 15, 2023
559b5ee
fix UTs
pavjacko Sep 15, 2023
a6a4a2a
resolutions cleanup
pavjacko Sep 15, 2023
4a67646
upgrade electron
pavjacko Sep 15, 2023
42ad635
babel cleanup
pavjacko Sep 15, 2023
6797050
dep cleanup
pavjacko Sep 15, 2023
82f4b28
update yarnlock
pavjacko Sep 16, 2023
4c37da5
security patches
pavjacko Sep 16, 2023
561c9fd
migrate from dist to lib
pavjacko Sep 16, 2023
fdda56a
migrate rnv core to separate package
pavjacko Sep 16, 2023
7f4b96b
switch deps to @rnv/core
pavjacko Sep 17, 2023
353587b
fix imports
pavjacko Sep 17, 2023
a525603
migrated rnv core features into @rnv/core
pavjacko Sep 17, 2023
8f5da49
fix deps, move rnv executor to rnv package
pavjacko Sep 18, 2023
8096001
fix UTs
pavjacko Sep 18, 2023
39a6a7f
path fixes
pavjacko Sep 18, 2023
f9339d4
fix paths
pavjacko Sep 18, 2023
d2571fd
refactor core file structure
pavjacko Sep 18, 2023
c95335c
split context and api
pavjacko Sep 18, 2023
179e284
fix uts
pavjacko Sep 18, 2023
a7fd0bb
rename logger
pavjacko Sep 18, 2023
3e87fc8
abstract inquirer into DI
pavjacko Sep 18, 2023
4059fbb
fix device manager
pavjacko Sep 18, 2023
09dd398
logger refactor into DI
pavjacko Sep 19, 2023
5117342
abstract logger api
pavjacko Sep 19, 2023
3eac44e
post cleanup, move chalk to cli
pavjacko Sep 19, 2023
e44528a
abstract filesystem injections
pavjacko Sep 19, 2023
e229bc7
refactor context to functional arch
pavjacko Sep 19, 2023
6cfa6be
separate context and api to providers to prevent circular deps issues
pavjacko Sep 19, 2023
bdf0935
refactor rnv runner
pavjacko Sep 19, 2023
a44de13
fix ora, premature chalk call
pavjacko Sep 19, 2023
444a834
fix default doResolve injections
pavjacko Sep 21, 2023
7a7e516
skipOverrides per plugin
pavjacko Sep 21, 2023
7b4f8bf
next 13
pavjacko Sep 21, 2023
8edeb4a
fixed androidtv, tvos wip
mihaiblaga89 Sep 21, 2023
63ff46a
add rnv extensions
pavjacko Sep 23, 2023
a81bdf8
fix react types
pavjacko Sep 24, 2023
963653e
upgrade node requirements
pavjacko Sep 24, 2023
aa5cebc
Merge branch 'fix/android-tv-rn72' into feat/rn-upgrade-ts-3
pavjacko Sep 24, 2023
12d9ee5
add sdk-react-native as separate rn wrapper package
pavjacko Sep 24, 2023
03d23f7
update android and apple sdk to use sdk-rn
pavjacko Sep 24, 2023
8bce117
migrate to sdk-rn
pavjacko Sep 24, 2023
4b8b67d
cleanup, renaming of templates
pavjacko Sep 24, 2023
d5e8b76
remove specific mentro and babel handlers from rnv. let templates dea…
pavjacko Sep 24, 2023
f9c3c18
refactor sdk exports
pavjacko Sep 24, 2023
1207583
cleanup constants, deps
pavjacko Sep 24, 2023
02767f2
removed node-fetch
pavjacko Sep 24, 2023
72b637d
git name case hack
pavjacko Sep 24, 2023
d9c8033
rename to lowercase
pavjacko Sep 24, 2023
211c933
update deps
pavjacko Sep 25, 2023
f097959
cleanup old templates
pavjacko Sep 25, 2023
2c87c1c
android device management fixes
pavjacko Sep 25, 2023
e9ac99b
launch activity fix
pavjacko Sep 25, 2023
83be715
reuse gradle configurations
pavjacko Sep 25, 2023
cba1ef2
update metro configs
pavjacko Sep 26, 2023
256f520
adapter and tvos fixes
pavjacko Sep 28, 2023
5313a8e
upgrade tvos template
pavjacko Sep 29, 2023
8d511df
update podfile
pavjacko Oct 2, 2023
ca549cb
Merge branch 'main' into feat/rn-upgrade-ts-3
pavjacko Oct 2, 2023
69ed985
update env configurations
pavjacko Oct 2, 2023
7fa1759
update template with tvos default template
pavjacko Oct 2, 2023
f84bb04
tvos dual engines fixes, getRelativePath, --showEnv
pavjacko Oct 3, 2023
04070e0
update to runner
pavjacko Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ buck-out/
# Testing
/packages/**/coverage
/packages/**/dist
/packages/**/lib

.expo
coverage

Expand Down
66 changes: 66 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
LOAD FILES TO MEMORY (MIGHT TAKE SEVERAL ROUNDS?)

generate abstract runtime definitions
generate all injections

CREATE ABSTRACT CONTEXT INFO

GENERATE / COPY NEW FILES

copy over template files (.tpl files to be injected )

rnv

@rnv/cli
@rnv/core
@rnv/sdk-tizen
@rnv/sdk-webos
@rnv/sdk-apple

import { executeRnv } from '@rnv/core'

await executeRnv({
commandAsString: 'rnv run -p ios',
commandAsObject: {
command: 'run',
},
cwd: '',
errorHandler: async ({}) => {
return true;
},
inputHandler: async ({}) => {

},
logger: ({}) => {

}

});

- make build hooks typescript (with autocomplete)
- split rnv into cli & core
- move sdkManger to separate sdk packages
- rethink templateFile injection system
- renative.json: engines.engine-rn.platforms.ios.template.ignoreFiles: []
- merge engine-rn + tvos + macos????

templateFiles: {
'ios/Info.plist': {
isTemplate: source.endsWith('.tpl'),
source: 'ios/Info.plist.tpl',
dest: 'ios/Info.plist',
injections: {
'{{NAME}}': 'myApp'
}
},
'ios/image.png': {
source: 'ios/image.png',
dest: 'ios/image.png'
}
}

if isTemplate = true && injections = undefined => use global injections
if isTemplate = true && injections = {...} => use local injections

reading config files 17 times in the first half of an rnv run :D
a plugin that was removed from renative.json still has it's orchestra-plugins/builds and renative.plugins.json overrides applied
125 changes: 125 additions & 0 deletions __mocks__/@rnv/core.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// __mocks__/@rnv/core.ts
const rnvcore: any = jest.createMockFromModule('@rnv/core');

const configPropMocks = {
scheme: 'debug',
bundleAssets: false,
};

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,
};
_chalkCols.rgb = () => (v) => v;
_chalkCols.bold = _chalkCols;
const _chalkMono = {
..._chalkCols,
};

rnvcore.getEngineRunnerByPlatform = () => ({
getOriginalPlatformTemplatesDir: () => 'sometemptdir',
});
rnvcore.executeTask = jest.fn();
rnvcore.shouldSkipTask = () => false;
rnvcore.generatePlatformChoices = () => [];
rnvcore.executeAsync = jest.fn();
rnvcore.removeDirs = jest.fn();
rnvcore.fsExistsSync = () => true;
rnvcore.fsReaddirSync = () => [];
rnvcore.getRealPath = () => '';
rnvcore.copyFolderContentsRecursiveSync = jest.fn();

rnvcore.getConfigProp = (c, platform, key) => configPropMocks[key];
rnvcore.confirmActiveBundler = () => null;
rnvcore.getAppFolder = () => null;

rnvcore.logToSummary = jest.fn();
rnvcore.logTask = jest.fn();
rnvcore.logDebug = jest.fn();
rnvcore.logInfo = jest.fn();
rnvcore.logError = jest.fn();
rnvcore.logWarning = jest.fn();
rnvcore.logSuccess = jest.fn();
rnvcore.logSummary = jest.fn();
rnvcore.chalk = () => _chalkMono;

// Common: {
// getConfigProp: (c, platform, key) => configPropMocks[key],
// confirmActiveBundler: () => null,
// getAppFolder: () => null,
// },
// Logger: {
// logToSummary: jest.fn(),
// logTask: jest.fn(),
// logDebug: jest.fn(),
// logInfo: jest.fn(),
// logError: jest.fn(),
// logWarning: jest.fn(),
// logSuccess: jest.fn(),
// logSummary: jest.fn(),
// chalk: () => _chalkMono,
// },
// FileUtils: {
// fsExistsSync: () => null,
// copyFileSync: () => null,
// },
// Constants: {
// PARAMS: {
// withBase: () => [],
// withRun: () => [],
// withConfigure: () => [],
// },
// IOS: 'ios',
// },
// TaskManager: {
// executeTask: () => null,
// executeOrSkipTask: () => null,
// shouldSkipTask: () => false,
// },
// Exec: {
// executeAsync: () => null,
// },
// ObjectUtils: {
// isObject: () => null,
// },
// PluginManager: {
// parsePlugins: () => null,
// },
// ProjectManager: {
// copyAssetsFolder: () => null,
// copyBuildsFolder: () => null,
// parseFonts: () => null,
// },
// Resolver: {
// doResolve: () => null,
// doResolvePath: () => null,
// },
// Prompt: {
// isSystemWin: () => null,
// },
// Utils: {
// inquirerPrompt: () => null,
// },
// PlatformManager: {
// isPlatformActive: () => null,
// logErrorPlatform: () => null,
// },
// RuntimeManager: {
// updateRenativeConfigs: () => null,
// },
// SDKManager: {
// Apple: {
// launchAppleSimulator: () => null,
// },
// Android: {},
// },

module.exports = rnvcore;
6 changes: 6 additions & 0 deletions __mocks__/@rnv/sdk-apple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// __mocks__/@rnv/sdk-apple.ts
const sdkApple: any = jest.createMockFromModule('@rnv/sdk-apple');

sdkApple.launchAppleSimulator = () => null;

module.exports = sdkApple;
6 changes: 6 additions & 0 deletions __mocks__/axios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// __mocks__/axios.ts
const axios: any = jest.createMockFromModule('axios');

axios.get = () => true;

module.exports = axios;
7 changes: 7 additions & 0 deletions __mocks__/child_process.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// __mocks__/child_process.ts

const child_process: any = jest.createMockFromModule('child_process');

child_process.spawn = jest.fn();

module.exports = child_process;
6 changes: 4 additions & 2 deletions __mocks__/fs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// __mocks__/fs.js
// __mocks__/fs.ts
const path = require('path');

const fs = jest.createMockFromModule('fs');
const fs: any = jest.createMockFromModule('fs');

let mockFiles = Object.create(null);
function __setMockFiles(newMockFiles) {
mockFiles = Object.create(null);
//@ts-expect-error
Array.values(newMockFiles).forEach((file) => {
const dir = path.dirname(file);

Expand All @@ -22,5 +23,6 @@ function readdirSync(directoryPath) {

fs.__setMockFiles = __setMockFiles;
fs.readdirSync = readdirSync;
fs.readFileSync = () => '{}';

module.exports = fs;
6 changes: 6 additions & 0 deletions __mocks__/inquirer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// __mocks__/inquirer.ts
const inquirer: any = jest.createMockFromModule('inquirer');

inquirer.prompt = () => true;

module.exports = inquirer;
4 changes: 4 additions & 0 deletions __mocks__/rnv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// __mocks__/rnv.ts
const rnv: any = jest.createMockFromModule('rnv');

module.exports = rnv;
8 changes: 8 additions & 0 deletions __mocks__/shelljs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// __mocks__/rnv.ts
const shelljs: any = jest.createMockFromModule('shelljs');

shelljs.mkdir = () => {
//NOOP
};

module.exports = shelljs;
2 changes: 1 addition & 1 deletion buildHooks/src/prePublish.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { Doctor, FileUtils } from 'rnv';
import { Doctor, FileUtils } from '@rnv/core';
import fs from 'fs';
import { setPackageVersions } from '@flexn/build-hooks-version';

Expand Down
49 changes: 16 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
},
"devDependencies": {
"@babel/eslint-parser": "7.17.0",
"@babel/plugin-transform-runtime": "7.8.3",
"@babel/preset-react": "7.16.7",
"@babel/runtime": "7.12.5",
"@flexn/build-hooks-git": "0.1.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-react": "7.22.15",
"@babel/runtime": "^7.0.0",
"@flexn/build-hooks-git": "0.31.1-canary.0",
"@flexn/build-hooks-version": "0.1.0",
"@flexn/eslint-config": "1.0.0",
"@flexn/prettier-config": "1.0.0",
Expand All @@ -100,31 +100,31 @@
"@types/lodash.set": "4.3.7",
"@types/ncp": "2.0.5",
"@types/node": "~16.11.7",
"@types/node-fetch": "2.6.4",
"@types/shelljs": "0.8.12",
"@types/tar": "6.1.5",
"@types/shell-quote": "1.7.1",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"babel-jest": "26.6.3",
"babel-plugin-module-resolver": "3.2.0",
"babel-plugin-polyfill-corejs2": "0.2.2",
"babel-jest": "29.2.1",
"babel-plugin-module-resolver": "^5.0.0",
"deepmerge": "3.2.0",
"eslint": "8.40.0",
"eslint": "8.19.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-react": "7.33.2",
"husky": "^7.0.0",
"jest": "27.5.1",
"lerna": "6.6.2",
"jest": "29.2.1",
"jest-environment-jsdom": "29.7.0",
"lerna": "^6.6.2",
"lint-staged": "12.3.4",
"prettier": "2.3.1",
"pretty-quick": "1.11.0",
"rnv": "0.38.0-canary.1",
"ts-jest": "^27.0.7",
"ttab": "^0.7.2",
"typescript": "4.9.5"
"typescript": "5.2.2"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
"node": ">=18.0.0",
"npm": ">=9.0.0"
},
"private": true,
"title": "ReNative",
Expand Down Expand Up @@ -154,22 +154,5 @@
"**/@flexn/plugins"
]
},
"resolutions": {
"@types/react": "18.2.6",
"tslib": "2.5.2",
"@react-native-community/cli": "^6.0.0",
"@react-native-community/cli-platform-ios": "^6.0.0",
"@react-native-community/cli-platform-android": "^6.0.0",
"axios": "^0.21.2",
"plist": "^3.0.5",
"merge": "^2.1.1",
"minimist": "1.2.6",
"react-dev-utils": "^12.0.0",
"node-forge": "1.3.0",
"chokidar": "3.5.3",
"terser": "5.14.2",
"simple-plist": "1.3.1",
"ejs": "3.1.7",
"shell-quote": "1.7.3"
}
"resolutions": {}
}
3 changes: 3 additions & 0 deletions packages/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
coverage
21 changes: 21 additions & 0 deletions packages/cli/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Pavel Jacko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# cli

Loading
Loading