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

RNV TS migration #1093

Merged
merged 84 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
6bea806
add initial types
pavjacko Aug 28, 2023
b41dbbe
add config types, package manager
pavjacko Aug 28, 2023
c0eb9a3
rename files, main config defaults structure migrations
pavjacko Aug 28, 2023
dff8d99
types refactor
pavjacko Aug 29, 2023
fbed06d
exec types
pavjacko Aug 29, 2023
55a22ce
rename files
pavjacko Aug 29, 2023
0f5e2cc
code formatting
pavjacko Aug 29, 2023
796417d
ts conversions, add global ts, 1856 togo
pavjacko Aug 29, 2023
4739e19
types conversions, 1647 togo
pavjacko Aug 29, 2023
6a2e9a5
type migrations, 1518 togo
pavjacko Aug 29, 2023
f79f791
type conversions, 1395 togo
pavjacko Aug 29, 2023
47dee6e
add more types, 1324 togo
pavjacko Aug 29, 2023
6c03ab3
more type refactors, 1227 togo
pavjacko Aug 29, 2023
08fdb10
more types refactor, 1081 togo
pavjacko Aug 29, 2023
547f90b
add module typings, 1062 togo
pavjacko Aug 29, 2023
c48e600
more ts refactor, 1029 togo
pavjacko Aug 29, 2023
33af2c5
more ts refactor 928 togo
pavjacko Aug 30, 2023
57beb90
more types refactored, 767 togo
pavjacko Aug 30, 2023
50874e1
more ts refactor, 672 togo
pavjacko Aug 30, 2023
a548e02
more ts refactor, 553 togo
pavjacko Aug 30, 2023
5e32eff
more migrations, 471 togo
pavjacko Aug 30, 2023
f5abce1
more refactor, 399 togo
pavjacko Aug 30, 2023
79bd35d
more ts migrations, 354 togo
pavjacko Aug 30, 2023
73104de
plugin types, 343 togo
pavjacko Aug 30, 2023
945388f
more ts migrations, 298 togo
pavjacko Aug 30, 2023
e7f107e
engine ts migration, 279 togo
pavjacko Aug 30, 2023
5c62db0
more ts migrations, 268 togo
pavjacko Aug 30, 2023
b1485f0
more ts refactor, 190 togo
pavjacko Aug 31, 2023
68bac36
more ts refactor, 107 togo
pavjacko Aug 31, 2023
cb867d3
more ts refactor, 98 togo
pavjacko Aug 31, 2023
e27ec10
typings
pavjacko Aug 31, 2023
32e8973
switch to lib output
pavjacko Aug 31, 2023
08cd22e
more ts migrations 61 togo
pavjacko Aug 31, 2023
facc357
more ts refactor, 38 togo
pavjacko Aug 31, 2023
ed67f7d
more ts migrations, 21 togo
pavjacko Aug 31, 2023
0280b18
more ts migrations, 16 togo
pavjacko Aug 31, 2023
85f7d59
refactor object optionals, 7 togo
pavjacko Aug 31, 2023
aa9cdb6
ts migration part one completed
pavjacko Aug 31, 2023
e9db00b
post refactor fixes, add default rnv scope to plugin
pavjacko Sep 1, 2023
fa32df4
fix UTs
pavjacko Sep 2, 2023
1661142
switch android sdk to typed rnv
pavjacko Sep 2, 2023
a082346
rename rnvConfig to rnvContext
pavjacko Sep 3, 2023
e83b73a
split config and context types
pavjacko Sep 3, 2023
126723c
refactor sdk android to ts
pavjacko Sep 3, 2023
de58473
ts fixes, refactor sdk android
pavjacko Sep 3, 2023
7a347a4
refactor apple sdk to TS
pavjacko Sep 3, 2023
426977e
migrate apple sdk to TS
pavjacko Sep 3, 2023
a64a8c6
ts type refactor & fixes
pavjacko Sep 3, 2023
37b7154
apple sdk TS migration done
pavjacko Sep 3, 2023
e3d1db4
engine-rn rename to ts files
pavjacko Sep 3, 2023
36c18a2
TS fixes
pavjacko Sep 3, 2023
214502b
engine-rn migrated to TS
pavjacko Sep 3, 2023
3f50d45
more ts fixes
pavjacko Sep 3, 2023
fa0c1b5
rename engine-lightning js to ts
pavjacko Sep 3, 2023
8422c07
fix ts errors
pavjacko Sep 3, 2023
8a32a10
engine rn-electron rename js to ts
pavjacko Sep 3, 2023
373021b
ts fixes
pavjacko Sep 3, 2023
d800276
refactored sdk webpack
pavjacko Sep 3, 2023
6f3f404
ts fixes
pavjacko Sep 3, 2023
7625778
convert js to ts engine-tvos
pavjacko Sep 3, 2023
e4af178
refactor engine tvos
pavjacko Sep 3, 2023
be38c20
migrate engine-rn-next to TS
pavjacko Sep 3, 2023
b59d9c3
rename js to ts engine-rn-web
pavjacko Sep 3, 2023
65f925d
migrated engine rn-web
pavjacko Sep 4, 2023
43f2a9c
rename engine-rn-macos js to ts
pavjacko Sep 4, 2023
a85075e
engine-rn-macos TS done
pavjacko Sep 4, 2023
2f394e3
update ts configs
pavjacko Sep 4, 2023
f21d123
ts integration-vercel
pavjacko Sep 4, 2023
6d90dd7
ts terraform
pavjacko Sep 4, 2023
28e6065
integration ftp TS migration
pavjacko Sep 4, 2023
56f56dc
ts integration docker
pavjacko Sep 4, 2023
6442f00
reaftor engine windows to ts
pavjacko Sep 4, 2023
f4e83aa
ts fixes
pavjacko Sep 4, 2023
6e23f56
fix UTs
pavjacko Sep 4, 2023
b13657c
fix cli error
pavjacko Sep 4, 2023
a193966
cleanup imports
pavjacko Sep 4, 2023
a2e8bd2
skip linking undefined platforms
pavjacko Sep 4, 2023
08447d1
cleanup, fix plugins inject skip
pavjacko Sep 4, 2023
0e5d346
refactor context type
pavjacko Sep 4, 2023
2294a95
update apple-sdk, code fixes
pavjacko Sep 5, 2023
fc9d0e6
https://github.com/flexn-io/renative/security/code-scanning/70
pavjacko Sep 5, 2023
e4a1262
https://github.com/flexn-io/renative/security/code-scanning/112
mihaiblaga89 Sep 5, 2023
76a5432
cleaner code
pavjacko Sep 5, 2023
1dbe495
Merge branch 'feat/ts-migration' of github.com:flexn-io/renative into…
pavjacko Sep 5, 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
  •  
  •  
  •  
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@
"@flexn/build-hooks-git": "0.1.0",
"@types/jest": "~27.0.2",
"@types/node": "~16.11.7",
"@types/node-fetch": "2.6.4",
"@types/lodash.set": "4.3.7",
"@types/lodash.get": "4.4.7",
"@types/lodash.intersection": "4.4.7",
"@types/kill-port": "2.0.0",
"@types/tar": "6.1.5",
"@types/shelljs": "0.8.12",
"@types/ncp": "2.0.5",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"babel-jest": "26.6.3",
Expand Down Expand Up @@ -164,4 +172,4 @@
"ejs": "3.1.7",
"shell-quote": "1.7.3"
}
}
}
2 changes: 1 addition & 1 deletion packages/engine-lightning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
"access": "public"
},
"gitHead": "930edaf234cc321ad9f1e296c5d394e3144845e2"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Config, EngineManager } from 'rnv';
import { Config, EngineManager, RnvEngine } from 'rnv';
//@ts-ignore
import CNF from '../renative.engine.json';
// import taskRnvPackage from './tasks/task.rnv.package';
import taskRnvBuild from './tasks/task.rnv.build';
Expand All @@ -11,7 +12,7 @@ import taskRnvRun from './tasks/task.rnv.run';

const { generateEngineTasks, generateEngineExtensions } = EngineManager;

export default {
const Engine: RnvEngine = {
initializeRuntimeConfig: (c) => Config.initializeConfig(c),
tasks: generateEngineTasks([
taskRnvRun,
Expand All @@ -26,7 +27,8 @@ export default {
config: CNF,
projectDirName: 'project',
serverDirName: 'server',
ejectPlatform: null,
runtimeExtraProps: {},
// ejectPlatform: null,
platforms: {
tizen: {
defaultPort: 8087,
Expand All @@ -40,3 +42,5 @@ export default {
},
},
};

export default Engine;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Logger,
PlatformManager,
ProjectManager,
RnvContext,
SDKManager,
} from 'rnv';
import semver from 'semver';
Expand All @@ -33,8 +34,8 @@ const { writeCleanFile } = FileUtils;
const { runTizenSimOrDevice, DEFAULT_SECURITY_PROFILE_NAME } = SDKManager.Tizen;
const { runWebosSimOrDevice } = SDKManager.Webos;

export const runLightningProject = async (c, target) => {
logTask('runLightningProject', `target:${target}`);
export const runLightningProject = async (c: RnvContext) => {
logTask('runLightningProject');
const entryFile = getConfigProp(c, c.platform, 'entryFile');
const { platform } = c;
const { hosted } = c.program;
Expand Down Expand Up @@ -63,18 +64,18 @@ export const runLightningProject = async (c, target) => {
return true;
};

export const buildLightningProject = async (c) => {
export const buildLightningProject = async (c: RnvContext) => {
logTask('buildLightningProject');

const { platform } = c;
const platformConfig = c.buildConfig.platforms[platform];
const platformConfig = c.buildConfig.platforms?.[platform];

const entryFile = getConfigProp(c, c.platform, 'entryFile');
const target = getConfigProp(c, platform, 'target', 'es6');
const tBuild = getPlatformProjectDir(c);

const tOut = path.join(tBuild, 'output');
const certProfile = platformConfig.certificateProfile ?? DEFAULT_SECURITY_PROFILE_NAME;
const tOut = path.join(tBuild || '', 'output');
const certProfile = platformConfig?.certificateProfile ?? DEFAULT_SECURITY_PROFILE_NAME;

await executeAsync(c, `lng dist --${target}`, {
stdio: 'inherit',
Expand All @@ -99,7 +100,7 @@ export const buildLightningProject = async (c) => {
return true;
};

export const configureLightningProject = async (c) => {
export const configureLightningProject = async (c: RnvContext) => {
logTask('configureLightningProject');
const { platform } = c;
c.runtime.platformBuildsProjectPath = `${getPlatformBuildDir(c)}`;
Expand All @@ -111,18 +112,18 @@ export const configureLightningProject = async (c) => {
return copyBuildsFolder(c, platform);
};

const _configureProject = (c) =>
new Promise((resolve) => {
const _configureProject = (c: RnvContext) =>
new Promise<void>((resolve) => {
logTask('_configureProject');
const { platform } = c;
const p = c.buildConfig.platforms[platform];
const p = c.buildConfig.platforms?.[platform];

const injects =
platform === TIZEN
? [
{ pattern: '{{PACKAGE}}', override: p.package },
{ pattern: '{{ID}}', override: p.id },
{ pattern: '{{APP_NAME}}', override: p.appName },
{ pattern: '{{PACKAGE}}', override: p?.package },
{ pattern: '{{ID}}', override: p?.id },
{ pattern: '{{APP_NAME}}', override: p?.appName },
{ pattern: '{{APP_VERSION}}', override: semver.coerce(getAppVersion(c, platform)) },
]
: [
Expand All @@ -138,8 +139,8 @@ const _configureProject = (c) =>
addSystemInjects(c, injects);

const configFile = platform === TIZEN ? 'config.xml' : 'appinfo.json';
const file = path.join(getPlatformProjectDir(c), configFile);
writeCleanFile(file, file, injects, null, c);
const file = path.join(getPlatformProjectDir(c) || '', configFile);
writeCleanFile(file, file, injects, undefined, c);

resolve();
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Constants, Logger, PlatformManager, TaskManager } from 'rnv';
import { Constants, Logger, PlatformManager, RnvTaskFn, TaskManager } from 'rnv';
import { SDKLightning } from '../sdks';

const { logErrorPlatform } = PlatformManager;
Expand All @@ -7,7 +7,7 @@ const { TIZEN, WEBOS, TASK_BUILD, TASK_CONFIGURE, PARAMS } = Constants;
const { buildLightningProject } = SDKLightning;
const { executeOrSkipTask, shouldSkipTask } = TaskManager;

export const taskRnvBuild = async (c, parentTask, originTask) => {
export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => {
logTask('taskRnvBuild', `parent:${parentTask}`);
const { platform } = c;
c.runtime.forceBundleAssets = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Constants, Logger, PlatformManager, TaskManager } from 'rnv';
import { Constants, Logger, PlatformManager, RnvTaskFn, TaskManager } from 'rnv';
import { SDKLightning } from '../sdks';

const { logErrorPlatform } = PlatformManager;
Expand All @@ -7,7 +7,7 @@ const { TIZEN, WEBOS, TASK_PLATFORM_CONFIGURE, TASK_CONFIGURE, PARAMS } = Consta
const { configureLightningProject } = SDKLightning;
const { executeTask } = TaskManager;

export const taskRnvConfigure = async (c, parentTask, originTask) => {
export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => {
logTask('taskRnvConfigure');

await executeTask(c, TASK_PLATFORM_CONFIGURE, TASK_CONFIGURE, originTask);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Constants, Logger, PlatformManager, TaskManager } from 'rnv';
import { Constants, Logger, PlatformManager, RnvTaskFn, TaskManager } from 'rnv';
import { SDKLightning } from '../sdks';

const { logErrorPlatform } = PlatformManager;
Expand All @@ -7,7 +7,7 @@ const { TIZEN, WEBOS, TASK_RUN, TASK_CONFIGURE, PARAMS } = Constants;
const { runLightningProject } = SDKLightning;
const { executeOrSkipTask } = TaskManager;

export const taskRnvRun = async (c, parentTask, originTask) => {
export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => {
const { platform } = c;
const { port } = c.runtime;
const { target } = c.runtime;
Expand Down
4 changes: 2 additions & 2 deletions packages/engine-lightning/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"allowJs": true,
"resolveJsonModule": false
},
"include": ["./src/**/*", "./src/**/*.json", "./types.d.ts", "./package.json"]
"include": ["./src/**/*", "./src/**/*.json", "./types.d.ts", "./package.json"],
"exclude": ["node_modules", "./src/__tests__", "./dist/**/*"]
}
2 changes: 1 addition & 1 deletion packages/engine-rn-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@
"access": "public"
},
"gitHead": "930edaf234cc321ad9f1e296c5d394e3144845e2"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const withRNVBabel = (cnf) => {
export const withRNVBabel = (cnf: any) => {
const plugins = cnf?.plugins || [];
return {
retainLines: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Config, EngineManager } from 'rnv';
import { Config, EngineManager, RnvContext, RnvEngine } from 'rnv';
//@ts-ignore
import CNF from '../renative.engine.json';
import taskRnvBuild from './tasks/task.rnv.build';
import taskRnvConfigure from './tasks/task.rnv.configure';
Expand All @@ -12,8 +13,8 @@ import { withRNVBabel } from './adapter';

const { generateEngineTasks, generateEngineExtensions } = EngineManager;

export default {
initializeRuntimeConfig: (c) => Config.initializeConfig(c),
const Engine: RnvEngine = {
initializeRuntimeConfig: (c: RnvContext) => Config.initializeConfig(c),
tasks: generateEngineTasks([
taskRnvRun,
taskRnvPackage,
Expand All @@ -27,7 +28,8 @@ export default {
config: CNF,
projectDirName: '',
serverDirName: '',
ejectPlatform: null,
// ejectPlatform: null,
runtimeExtraProps: {},
platforms: {
macos: {
defaultPort: 8086,
Expand Down Expand Up @@ -57,3 +59,5 @@ export default {
};

export { withRNVBabel };

export default Engine;
Loading