From 8dafaf7d73dd9aa0e4836b62a5d0676578fd4469 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Wed, 7 Feb 2024 08:49:10 +0100 Subject: [PATCH 01/10] support for private tasks --- packages/core/src/tasks/index.ts | 5 +++-- packages/core/src/tasks/types.ts | 1 + packages/engine-core/src/tasks/task.rnv.configureSoft.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index b1dea7ae70..52cd17be01 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -87,12 +87,13 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr let filteredTasks; let addendum = ''; if (!c.paths.project.configExists) { - filteredTasks = taskInstances.filter((v) => v.taskInstance.isGlobalScope); + filteredTasks = taskInstances.filter((v) => v.taskInstance.isGlobalScope && !v.taskInstance.isPrivate); tasks = filteredTasks.map((v) => _getTaskOption(v)).sort(); tasksCommands = filteredTasks.map((v) => v.taskInstance.task.split(' ')[0]).sort(); addendum = ' (Not a ReNative project. options will be limited)'; } else { - tasks = taskInstances.map((v) => _getTaskOption(v)).sort(); + filteredTasks = taskInstances.filter((v) => !v.taskInstance.isPrivate); + tasks = filteredTasks.map((v) => _getTaskOption(v)).sort(); tasksCommands = taskInstances.map((v) => v.taskInstance.task.split(' ')[0]).sort(); defaultCmd = tasks.find((v) => v.startsWith('run')); } diff --git a/packages/core/src/tasks/types.ts b/packages/core/src/tasks/types.ts index 77768a7e9f..ff25eb2ccd 100644 --- a/packages/core/src/tasks/types.ts +++ b/packages/core/src/tasks/types.ts @@ -9,6 +9,7 @@ export type RnvTask = { forceBuildHookRebuild?: boolean; fn?: RnvTaskFn; fnHelp?: RnvTaskFn; + isPrivate?: boolean; }; export type RnvTaskParameter = { diff --git a/packages/engine-core/src/tasks/task.rnv.configureSoft.ts b/packages/engine-core/src/tasks/task.rnv.configureSoft.ts index 9d8c68f75c..35e8d73df4 100644 --- a/packages/engine-core/src/tasks/task.rnv.configureSoft.ts +++ b/packages/engine-core/src/tasks/task.rnv.configureSoft.ts @@ -25,9 +25,10 @@ export const taskRnvConfigureSoft: RnvTaskFn = async (c, parentTask, originTask) }; export default { - description: 'Configure system and project wothout recreating files (used for --only)', + description: 'Configure system and project without recreating files (used for --only)', fn: taskRnvConfigureSoft, task: TASK_CONFIGURE_SOFT, params: PARAMS.withBase(), platforms: [], + isPrivate: true, }; From 375993fe074fc9c972ea2c0bed49d27f887f6fac Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 09:05:54 +0100 Subject: [PATCH 02/10] task options refactor --- packages/core/src/tasks/index.ts | 66 +++++++++++++++++++++++--------- packages/core/src/tasks/types.ts | 2 +- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index 52cd17be01..3694e4f74b 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -21,6 +21,8 @@ let executedTasks: Record = {}; const CUSTOM_TASKS: RnvTaskMap = {}; +type TaskOption = { name: string; value: string; command: string; asArray: string[], subCommand: string; }; + export const registerCustomTask = async (_c: RnvContext, task: RnvTask) => { if (task.task) { CUSTOM_TASKS[task.task] = task; @@ -41,27 +43,43 @@ export const initializeTask = async (c: RnvContext, task: string) => { return true; }; -const _getTaskOption = ({ taskInstance, hasMultipleSubTasks }: TaskObj) => { - if (hasMultipleSubTasks) { - return `${taskInstance.task.split(' ')[0]}...`; - } +const _getTaskOption = ({ taskInstance }: TaskObj): TaskOption => { + const output = { value: taskInstance.task, name: '', command: '', asArray: taskInstance.task.split(' ') }; + + // if (hasMultipleSubTasks) { + // output.name = `${taskInstance.task.split(' ')[0]}...`; + // return output; + // } + if (taskInstance.description && taskInstance.description !== '') { - return `${taskInstance.task.split(' ')[0]} ${chalk().grey(`(${taskInstance.description})`)}`; + output.name = `${taskInstance.task} ${chalk().grey(`(${taskInstance.description})`)}`; + // output.lastName = `${output.asArray[0]} ${chalk().grey(`(${taskInstance.description})`)}`; + + return output; } - return `${taskInstance.task.split(' ')[0]}`; + // output.lastName = `${output.asArray[0]}`; + output.name = taskInstance.task; + + return output; }; const _getTaskObj = (taskInstance: RnvTask) => { - const key = taskInstance.task.split(' ')[0]; - let hasMultipleSubTasks = false; - if (taskInstance.task.includes(' ')) hasMultipleSubTasks = true; + const key = taskInstance.task; + const taskNameArr = key.split(' '); + let parent: null | string = null; + if (taskNameArr.length > 1) { + taskNameArr.pop(); + parent = taskNameArr.join(' '); + } + return { key, taskInstance, - hasMultipleSubTasks, + parent, }; }; + export const findSuitableTask = async (c: RnvContext, specificTask?: string): Promise => { logTask('findSuitableTask'); const REGISTERED_ENGINES = getRegisteredEngines(c); @@ -81,33 +99,45 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr }); const taskInstances = Object.values(suitableTaskInstances); - let tasks; + let tasks: TaskOption[]; + let defaultCmd: string | undefined = 'new'; - let tasksCommands; let filteredTasks; let addendum = ''; if (!c.paths.project.configExists) { filteredTasks = taskInstances.filter((v) => v.taskInstance.isGlobalScope && !v.taskInstance.isPrivate); tasks = filteredTasks.map((v) => _getTaskOption(v)).sort(); - tasksCommands = filteredTasks.map((v) => v.taskInstance.task.split(' ')[0]).sort(); addendum = ' (Not a ReNative project. options will be limited)'; } else { filteredTasks = taskInstances.filter((v) => !v.taskInstance.isPrivate); tasks = filteredTasks.map((v) => _getTaskOption(v)).sort(); - tasksCommands = taskInstances.map((v) => v.taskInstance.task.split(' ')[0]).sort(); - defaultCmd = tasks.find((v) => v.startsWith('run')); + defaultCmd = tasks.find((v) => v.value.startsWith('run'))?.name; } - const { command } = await inquirerPrompt({ + const groupedTasks: TaskOption[] = []; + const taskGroups: Record = {}; + tasks.forEach((task) => { + if(task.asArray.length > 1) { + if(!taskGroups[task.asArray[0]]) { + taskGroups[task.asArray[0]] = { + name: + } + } + } else { + groupedTasks.push(task) + } + }) + + const { selectedTask } = await inquirerPrompt({ type: 'list', default: defaultCmd, - name: 'command', + name: 'selectedTask', message: `Pick a command${addendum}`, choices: tasks, pageSize: 15, logMessage: 'Welcome to the brave new world...', }); - c.command = tasksCommands[tasks.indexOf(command)]; + c.command = selectedTask; } if (c.command) task = c.command; if (c.subCommand) task += ` ${c.subCommand}`; diff --git a/packages/core/src/tasks/types.ts b/packages/core/src/tasks/types.ts index ff25eb2ccd..8e6cdddc53 100644 --- a/packages/core/src/tasks/types.ts +++ b/packages/core/src/tasks/types.ts @@ -39,5 +39,5 @@ export type TaskItemMap = Record< export type TaskObj = { key: string; taskInstance: RnvTask; - hasMultipleSubTasks?: boolean; + // hasMultipleSubTasks?: boolean; }; From d09fd81c66217c74c68ecf224e874deaa646f322 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 18:54:31 +0100 Subject: [PATCH 03/10] update task generator logic --- packages/core/src/tasks/index.ts | 59 ++++++++++++------- .../engine-core/src/tasks/task.rnv.link.ts | 2 +- .../src/tasks/task.rnv.platform.configure.ts | 2 +- .../src/tasks/task.rnv.platform.list.ts | 6 +- .../engine-core/src/tasks/task.rnv.unlink.ts | 2 +- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index 3694e4f74b..0b6e283045 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -21,7 +21,14 @@ let executedTasks: Record = {}; const CUSTOM_TASKS: RnvTaskMap = {}; -type TaskOption = { name: string; value: string; command: string; asArray: string[], subCommand: string; }; +type TaskOption = { + name: string; + value: string; + command: string; + asArray?: string[]; + subCommand?: string; + subTasks?: TaskOption[]; +}; export const registerCustomTask = async (_c: RnvContext, task: RnvTask) => { if (task.task) { @@ -44,21 +51,21 @@ export const initializeTask = async (c: RnvContext, task: string) => { }; const _getTaskOption = ({ taskInstance }: TaskObj): TaskOption => { - const output = { value: taskInstance.task, name: '', command: '', asArray: taskInstance.task.split(' ') }; - - // if (hasMultipleSubTasks) { - // output.name = `${taskInstance.task.split(' ')[0]}...`; - // return output; - // } + const asArray = taskInstance.task.split(' '); + const output: TaskOption = { + value: taskInstance.task, + command: '', + name: '', + asArray, + }; if (taskInstance.description && taskInstance.description !== '') { output.name = `${taskInstance.task} ${chalk().grey(`(${taskInstance.description})`)}`; - // output.lastName = `${output.asArray[0]} ${chalk().grey(`(${taskInstance.description})`)}`; - - return output; + } else { + output.name = taskInstance.task; } - // output.lastName = `${output.asArray[0]}`; - output.name = taskInstance.task; + output.command = asArray[0]; + output.subCommand = asArray[1]; return output; }; @@ -79,7 +86,6 @@ const _getTaskObj = (taskInstance: RnvTask) => { }; }; - export const findSuitableTask = async (c: RnvContext, specificTask?: string): Promise => { logTask('findSuitableTask'); const REGISTERED_ENGINES = getRegisteredEngines(c); @@ -114,26 +120,35 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr defaultCmd = tasks.find((v) => v.value.startsWith('run'))?.name; } + const ungroupedTasks: TaskOption[] = []; const groupedTasks: TaskOption[] = []; const taskGroups: Record = {}; tasks.forEach((task) => { - if(task.asArray.length > 1) { - if(!taskGroups[task.asArray[0]]) { - taskGroups[task.asArray[0]] = { - name: - } + if (task.subCommand) { + if (!taskGroups[task.command]) { + const groupTask: TaskOption = { + name: `${task.command} ...`, + command: task.command, + value: task.command, + }; + taskGroups[task.command] = groupTask; + groupedTasks.push(groupTask); } } else { - groupedTasks.push(task) + console.log('DKKDKDK', task); + + ungroupedTasks.push(task); } - }) + }); + + const mergedTasks = [...ungroupedTasks, ...groupedTasks]; const { selectedTask } = await inquirerPrompt({ type: 'list', default: defaultCmd, name: 'selectedTask', message: `Pick a command${addendum}`, - choices: tasks, + choices: mergedTasks, pageSize: 15, logMessage: 'Welcome to the brave new world...', }); @@ -374,7 +389,7 @@ export const executeOrSkipTask = async (c: RnvContext, task: string, parentTask: const ACCEPTED_CONDITIONS = ['platform', 'target', 'appId', 'scheme'] as const; -type ACKey = typeof ACCEPTED_CONDITIONS[number]; +type ACKey = (typeof ACCEPTED_CONDITIONS)[number]; const _logSkip = (task: string) => { logInfo(`Original RNV task ${chalk().white(task)} marked to ignore. SKIPPING...`); diff --git a/packages/engine-core/src/tasks/task.rnv.link.ts b/packages/engine-core/src/tasks/task.rnv.link.ts index ba33296b42..5c26191677 100644 --- a/packages/engine-core/src/tasks/task.rnv.link.ts +++ b/packages/engine-core/src/tasks/task.rnv.link.ts @@ -39,7 +39,7 @@ export const taskRnvLink: RnvTaskFn = async (c, _parentTask, _originalTask) => { }; export default { - description: '', + description: 'Links development version or renative with this project', fn: taskRnvLink, task: 'link', params: PARAMS.withBase(), diff --git a/packages/engine-core/src/tasks/task.rnv.platform.configure.ts b/packages/engine-core/src/tasks/task.rnv.platform.configure.ts index 71764d2ac6..7fe075e5bd 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.configure.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.configure.ts @@ -56,7 +56,7 @@ export const taskRnvPlatformConfigure: RnvTaskFn = async (c, parentTask, originT }; export default { - description: '', + description: 'Low-level task used by engines to prepare platformBuilds folder', fn: taskRnvPlatformConfigure, task: TASK_PLATFORM_CONFIGURE, params: PARAMS.withBase(), diff --git a/packages/engine-core/src/tasks/task.rnv.platform.list.ts b/packages/engine-core/src/tasks/task.rnv.platform.list.ts index 23bcb48a3c..faff0d3f6d 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.list.ts @@ -8,6 +8,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvPlatformList: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -20,11 +21,12 @@ export const taskRnvPlatformList: RnvTaskFn = async (c, _parentTask, originTask) return true; }; -export default { +const Task: RnvTask = { description: 'List all available platforms', fn: taskRnvPlatformList, task: 'platform list', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.unlink.ts b/packages/engine-core/src/tasks/task.rnv.unlink.ts index 093da52e98..1ab217d081 100644 --- a/packages/engine-core/src/tasks/task.rnv.unlink.ts +++ b/packages/engine-core/src/tasks/task.rnv.unlink.ts @@ -43,7 +43,7 @@ export const taskRnvUnlink: RnvTaskFn = async (c) => { }; export default { - description: '', + description: 'Replaces rnv version in project with original node_modules version', fn: taskRnvUnlink, task: 'unlink', params: PARAMS.withBase(), From 12bf9814f0072583cc834e2f8d447bb6d885b458 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 19:20:20 +0100 Subject: [PATCH 04/10] better command sorting --- packages/cli/src/prompt.ts | 4 ++-- packages/core/src/api/index.ts | 4 ++-- packages/core/src/api/types.ts | 2 +- packages/core/src/constants.ts | 2 ++ packages/core/src/tasks/index.ts | 31 +++++++++++++++++++++++++------ 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/prompt.ts b/packages/cli/src/prompt.ts index c5bcc4fea8..c0f3ab6465 100644 --- a/packages/cli/src/prompt.ts +++ b/packages/cli/src/prompt.ts @@ -51,8 +51,8 @@ export const inquirerPrompt = async (params: PromptParams): Promise { - return new inquirer.Separator(); +export const inquirerSeparator = (text?: string) => { + return new inquirer.Separator(text); }; export const pressAnyKeyToContinue = () => { diff --git a/packages/core/src/api/index.ts b/packages/core/src/api/index.ts index 012bfab508..14b5b31286 100644 --- a/packages/core/src/api/index.ts +++ b/packages/core/src/api/index.ts @@ -40,8 +40,8 @@ export const inquirerPrompt: RnvApiPrompt['inquirerPrompt'] = (opts) => { return getApi().prompt.inquirerPrompt(opts); }; -export const inquirerSeparator: RnvApiPrompt['inquirerSeparator'] = () => { - return getApi().prompt.inquirerSeparator(); +export const inquirerSeparator: RnvApiPrompt['inquirerSeparator'] = (text?: string) => { + return getApi().prompt.inquirerSeparator(text); }; export const generateOptions: RnvApiPrompt['generateOptions'] = (inputData, isMultiChoice, mapping, renderMethod) => { diff --git a/packages/core/src/api/types.ts b/packages/core/src/api/types.ts index 25ee130cbf..629d50de6d 100644 --- a/packages/core/src/api/types.ts +++ b/packages/core/src/api/types.ts @@ -37,7 +37,7 @@ export type RnvApiPrompt = { renderMethod?: PromptRenderFn ) => PromptOptions; pressAnyKeyToContinue: () => Promise; - inquirerSeparator: () => any; + inquirerSeparator: (text?: string) => any; }; export type RnvContextAnalytics = { diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 3c0a37d30b..50eb5bb7d6 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -122,6 +122,8 @@ export const SUPPORTED_PLATFORMS = [ export const TASK_RUN = 'run'; export const TASK_CONFIGURE = 'configure'; export const TASK_DOCTOR = 'doctor'; +export const TASK_NEW = 'new'; +export const TASK_HELP = 'help'; export const TASK_BUILD = 'build'; export const TASK_INFO = 'info'; export const TASK_START = 'start'; diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index 0b6e283045..280baa80c9 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -8,11 +8,21 @@ import { getEngineSubTasks, registerAllPlatformEngines, } from '../engines'; -import { TASK_CONFIGURE_SOFT } from '../constants'; +import { + TASK_BUILD, + TASK_CONFIGURE, + TASK_CONFIGURE_SOFT, + TASK_EXPORT, + TASK_HELP, + TASK_NEW, + TASK_PACKAGE, + TASK_RUN, + TASK_START, +} from '../constants'; import { RnvContext } from '../context/types'; import { RnvTask, RnvTaskMap, TaskItemMap, TaskObj } from './types'; import { RnvEngine } from '../engines/types'; -import { inquirerPrompt, pressAnyKeyToContinue } from '../api'; +import { inquirerPrompt, inquirerSeparator, pressAnyKeyToContinue } from '../api'; import { getApi } from '../api/provider'; import { RenativeConfigTaskKey } from '../schema/types'; import { checkIfProjectAndNodeModulesExists } from '../projects/dependencyManager'; @@ -86,6 +96,8 @@ const _getTaskObj = (taskInstance: RnvTask) => { }; }; +const COMMON_TASKS = [TASK_RUN, TASK_BUILD, TASK_CONFIGURE, TASK_NEW, TASK_HELP, TASK_PACKAGE, TASK_START, TASK_EXPORT]; + export const findSuitableTask = async (c: RnvContext, specificTask?: string): Promise => { logTask('findSuitableTask'); const REGISTERED_ENGINES = getRegisteredEngines(c); @@ -120,6 +132,7 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr defaultCmd = tasks.find((v) => v.value.startsWith('run'))?.name; } + const commonTasks: TaskOption[] = []; const ungroupedTasks: TaskOption[] = []; const groupedTasks: TaskOption[] = []; const taskGroups: Record = {}; @@ -127,21 +140,27 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr if (task.subCommand) { if (!taskGroups[task.command]) { const groupTask: TaskOption = { - name: `${task.command} ...`, + name: `${task.command}...`, command: task.command, value: task.command, }; taskGroups[task.command] = groupTask; groupedTasks.push(groupTask); } + } else if (COMMON_TASKS.includes(task.value)) { + commonTasks.push(task); } else { - console.log('DKKDKDK', task); - ungroupedTasks.push(task); } }); - const mergedTasks = [...ungroupedTasks, ...groupedTasks]; + const mergedTasks = [ + inquirerSeparator('─────────── Common tasks ───────────'), + ...commonTasks, + inquirerSeparator('─────────── More tasks ─────────────'), + ...ungroupedTasks, + ...groupedTasks, + ]; const { selectedTask } = await inquirerPrompt({ type: 'list', From d38b3249cce49f14fc80da73418136ff457a0e68 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 19:30:36 +0100 Subject: [PATCH 05/10] typed engine core task exports --- .../src/tasks/task.rnv.app.configure.ts | 5 ++++- .../engine-core/src/tasks/task.rnv.app.create.ts | 6 ++++-- packages/engine-core/src/tasks/task.rnv.clean.ts | 10 ++++++++-- packages/engine-core/src/tasks/task.rnv.config.ts | 6 ++++-- .../src/tasks/task.rnv.configureSoft.ts | 5 ++++- .../src/tasks/task.rnv.crypto.decrypt.ts | 6 ++++-- .../src/tasks/task.rnv.crypto.encrypt.ts | 6 ++++-- packages/engine-core/src/tasks/task.rnv.doctor.ts | 5 ++++- packages/engine-core/src/tasks/task.rnv.help.ts | 6 ++++-- .../engine-core/src/tasks/task.rnv.hooks.list.ts | 7 ++++--- .../engine-core/src/tasks/task.rnv.hooks.pipes.ts | 7 ++++--- .../engine-core/src/tasks/task.rnv.hooks.run.ts | 7 ++++--- .../engine-core/src/tasks/task.rnv.install.ts | 6 ++++-- packages/engine-core/src/tasks/task.rnv.kill.ts | 5 ++++- packages/engine-core/src/tasks/task.rnv.link.ts | 6 ++++-- packages/engine-core/src/tasks/task.rnv.new.ts | 5 ++++- .../src/tasks/task.rnv.platform.configure.ts | 5 ++++- .../src/tasks/task.rnv.platform.connect.ts | 5 ++++- .../src/tasks/task.rnv.platform.eject.ts | 5 ++++- .../src/tasks/task.rnv.platform.setup.ts | 6 ++++-- .../engine-core/src/tasks/task.rnv.plugin.add.ts | 5 ++++- .../engine-core/src/tasks/task.rnv.plugin.list.ts | 5 ++++- .../src/tasks/task.rnv.plugin.update.ts | 5 ++++- .../src/tasks/task.rnv.project.configure.ts | 5 ++++- .../src/tasks/task.rnv.project.upgrade.ts | 7 ++++--- packages/engine-core/src/tasks/task.rnv.status.ts | 6 ++++-- packages/engine-core/src/tasks/task.rnv.switch.ts | 5 ++++- .../src/tasks/task.rnv.target.launch.ts | 5 ++++- .../engine-core/src/tasks/task.rnv.target.list.ts | 5 ++++- .../src/tasks/task.rnv.telemetry.disable.ts | 7 ++++--- .../src/tasks/task.rnv.telemetry.enable.ts | 7 ++++--- .../src/tasks/task.rnv.telemetry.status.ts | 7 ++++--- .../src/tasks/task.rnv.template.add.ts | 5 ++++- .../src/tasks/task.rnv.template.apply.ts | 5 ++++- .../src/tasks/task.rnv.template.list.ts | 6 ++++-- packages/engine-core/src/tasks/task.rnv.unlink.ts | 6 ++++-- .../src/tasks/task.rnv.workspace.add.ts | 5 ++++- .../src/tasks/task.rnv.workspace.configure.ts | 6 ++++-- .../src/tasks/task.rnv.workspace.connect.ts | 5 ++++- .../src/tasks/task.rnv.workspace.list.ts | 5 ++++- .../src/tasks/task.rnv.workspace.update.ts | 15 ++++++++++++--- 41 files changed, 176 insertions(+), 70 deletions(-) diff --git a/packages/engine-core/src/tasks/task.rnv.app.configure.ts b/packages/engine-core/src/tasks/task.rnv.app.configure.ts index 222cfc0ec5..bd8758a945 100644 --- a/packages/engine-core/src/tasks/task.rnv.app.configure.ts +++ b/packages/engine-core/src/tasks/task.rnv.app.configure.ts @@ -19,6 +19,7 @@ import { inquirerPrompt, RnvContext, inquirerSeparator, + RnvTask, } from '@rnv/core'; const _loadAppConfigIDfromDir = (dirName: string, appConfigsDir: string) => { @@ -204,10 +205,12 @@ export const taskRnvAppConfigure = async (c: RnvContext) => { return true; }; -export default { +const Task: RnvTask = { description: 'Configure project with specific appConfig', fn: taskRnvAppConfigure, task: TASK_APP_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.app.create.ts b/packages/engine-core/src/tasks/task.rnv.app.create.ts index ea83f9df7a..0367610c9a 100644 --- a/packages/engine-core/src/tasks/task.rnv.app.create.ts +++ b/packages/engine-core/src/tasks/task.rnv.app.create.ts @@ -15,6 +15,7 @@ import { logTask, TASK_APP_CREATE, PARAMS, + RnvTask, } from '@rnv/core'; import { ConfigFileApp } from '@rnv/core/lib/schema/configFiles/types'; @@ -163,11 +164,12 @@ export const taskRnvAppCreate: RnvTaskFn = async (c) => { return true; }; -export default { +const Task: RnvTask = { description: 'Create new app config', fn: taskRnvAppCreate, task: TASK_APP_CREATE, params: PARAMS.withBase(), - skipPlatforms: true, platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.clean.ts b/packages/engine-core/src/tasks/task.rnv.clean.ts index 5d4435c827..8507d999a5 100644 --- a/packages/engine-core/src/tasks/task.rnv.clean.ts +++ b/packages/engine-core/src/tasks/task.rnv.clean.ts @@ -13,6 +13,7 @@ import { isSystemWin, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; function clearWindowsCacheFiles() { @@ -198,13 +199,16 @@ export const taskRnvClean: RnvTaskFn = async (c) => { logDebug('watchman not installed. skipping'); } - await executeAsync(c, 'npx rimraf -I $TMPDIR/metro-* && npx rimraf -I $TMPDIR/react-* && npx rimraf -I $TMPDIR/haste-*'); + await executeAsync( + c, + 'npx rimraf -I $TMPDIR/metro-* && npx rimraf -I $TMPDIR/react-* && npx rimraf -I $TMPDIR/haste-*' + ); } } return true; }; -export default { +const Task: RnvTask = { description: 'Automatically removes all node_modules and lock in your project and its dependencies', fn: taskRnvClean, task: 'clean', @@ -212,3 +216,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.config.ts b/packages/engine-core/src/tasks/task.rnv.config.ts index 05e7376fa8..ac976ffdb8 100644 --- a/packages/engine-core/src/tasks/task.rnv.config.ts +++ b/packages/engine-core/src/tasks/task.rnv.config.ts @@ -1,4 +1,4 @@ -import { logTask, PARAMS, RnvTaskFn, executeTask, TASK_CONFIGURE_SOFT, SUPPORTED_PLATFORMS } from '@rnv/core'; +import { logTask, PARAMS, RnvTaskFn, executeTask, TASK_CONFIGURE_SOFT, SUPPORTED_PLATFORMS, RnvTask } from '@rnv/core'; const TASK_CONFIG = 'config'; @@ -12,10 +12,12 @@ export const taskRnvConfig: RnvTaskFn = async (c, _, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Display RNV config', fn: taskRnvConfig, task: TASK_CONFIG, params: PARAMS.withBase(), platforms: [...SUPPORTED_PLATFORMS], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.configureSoft.ts b/packages/engine-core/src/tasks/task.rnv.configureSoft.ts index 35e8d73df4..3d35791b63 100644 --- a/packages/engine-core/src/tasks/task.rnv.configureSoft.ts +++ b/packages/engine-core/src/tasks/task.rnv.configureSoft.ts @@ -8,6 +8,7 @@ import { isPlatformSupported, isBuildSchemeSupported, logTask, + RnvTask, } from '@rnv/core'; import { checkAndConfigureSdks, checkSdk } from '../common'; @@ -24,7 +25,7 @@ export const taskRnvConfigureSoft: RnvTaskFn = async (c, parentTask, originTask) return true; }; -export default { +const Task: RnvTask = { description: 'Configure system and project without recreating files (used for --only)', fn: taskRnvConfigureSoft, task: TASK_CONFIGURE_SOFT, @@ -32,3 +33,5 @@ export default { platforms: [], isPrivate: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.crypto.decrypt.ts b/packages/engine-core/src/tasks/task.rnv.crypto.decrypt.ts index f7e49feaf3..fa19938211 100644 --- a/packages/engine-core/src/tasks/task.rnv.crypto.decrypt.ts +++ b/packages/engine-core/src/tasks/task.rnv.crypto.decrypt.ts @@ -21,6 +21,7 @@ import { PARAMS, RnvContext, RnvTaskFn, + RnvTask, } from '@rnv/core'; const iocane = require('iocane'); @@ -205,11 +206,12 @@ and we will try to help! } }; -export default { +const Task: RnvTask = { description: 'Decrypt encrypted project files into local ~///..', fn: taskRnvCryptoDecrypt, task: TASK_CRYPTO_DECRYPT, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.crypto.encrypt.ts b/packages/engine-core/src/tasks/task.rnv.crypto.encrypt.ts index e0384568b2..8ad90589d3 100644 --- a/packages/engine-core/src/tasks/task.rnv.crypto.encrypt.ts +++ b/packages/engine-core/src/tasks/task.rnv.crypto.encrypt.ts @@ -25,6 +25,7 @@ import { RnvContext, RnvTaskFn, copyFileSync, + RnvTask, } from '@rnv/core'; import { statSync } from 'fs'; @@ -230,11 +231,12 @@ export const taskRnvCryptoEncrypt: RnvTaskFn = async (c, _parentTask, originTask } }; -export default { +const Task: RnvTask = { description: 'Encrypts secure files from ~///.. to project', fn: taskRnvCryptoEncrypt, task: TASK_CRYPTO_ENCRYPT, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.doctor.ts b/packages/engine-core/src/tasks/task.rnv.doctor.ts index 9d758e0bb0..9832f15d18 100644 --- a/packages/engine-core/src/tasks/task.rnv.doctor.ts +++ b/packages/engine-core/src/tasks/task.rnv.doctor.ts @@ -12,6 +12,7 @@ import { fsExistsSync, RnvTaskFn, validateRenativeProjectSchema, + RnvTask, } from '@rnv/core'; const configTargets = [ @@ -87,7 +88,7 @@ export const taskRnvDoctor: RnvTaskFn = async (c, parentTask, originTask) => { logToSummary(errMsg); }; -export default { +const Task: RnvTask = { description: 'Checks validity and config health of your project', fn: taskRnvDoctor, task: TASK_DOCTOR, @@ -95,3 +96,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.help.ts b/packages/engine-core/src/tasks/task.rnv.help.ts index 0beebdc09e..6e15a2563e 100644 --- a/packages/engine-core/src/tasks/task.rnv.help.ts +++ b/packages/engine-core/src/tasks/task.rnv.help.ts @@ -1,4 +1,4 @@ -import { chalk, logToSummary, logTask, PARAMS, getRegisteredEngines, RnvTaskFn } from '@rnv/core'; +import { chalk, logToSummary, logTask, PARAMS, getRegisteredEngines, RnvTaskFn, RnvTask } from '@rnv/core'; export const taskRnvHelp: RnvTaskFn = async (c) => { logTask('taskRnvHelp'); @@ -44,7 +44,7 @@ ${optsString} `); }; -export default { +const Task: RnvTask = { description: 'Display generic help', fn: taskRnvHelp, task: 'help', @@ -52,3 +52,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.hooks.list.ts b/packages/engine-core/src/tasks/task.rnv.hooks.list.ts index 0c1b27a020..663ccb59fd 100644 --- a/packages/engine-core/src/tasks/task.rnv.hooks.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.hooks.list.ts @@ -8,6 +8,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvHooksList: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -30,13 +31,13 @@ export const taskRnvHooksList: RnvTaskFn = async (c, _parentTask, originTask) => return Promise.reject('Your buildHooks object is empty!'); }; -export default { +const Task: RnvTask = { description: 'Get list of all available hooks', fn: taskRnvHooksList, task: TASK_HOOKS_LIST, params: PARAMS.withBase(), platforms: [], - skipAppConfig: true, - skipPlatforms: true, forceBuildHookRebuild: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.hooks.pipes.ts b/packages/engine-core/src/tasks/task.rnv.hooks.pipes.ts index 2d4a98fb64..c83afa38cd 100644 --- a/packages/engine-core/src/tasks/task.rnv.hooks.pipes.ts +++ b/packages/engine-core/src/tasks/task.rnv.hooks.pipes.ts @@ -8,6 +8,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvHooksPipes: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -21,12 +22,12 @@ export const taskRnvHooksPipes: RnvTaskFn = async (c, _parentTask, originTask) = logRaw(`Pipes:\n${pipeOpts.asString}`); }; -export default { +const Task: RnvTask = { description: 'Get the list of all available pipes', fn: taskRnvHooksPipes, task: TASK_HOOKS_PIPES, params: PARAMS.withBase(), platforms: [], - skipAppConfig: true, - skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.hooks.run.ts b/packages/engine-core/src/tasks/task.rnv.hooks.run.ts index fd16a85d28..1429c8b505 100644 --- a/packages/engine-core/src/tasks/task.rnv.hooks.run.ts +++ b/packages/engine-core/src/tasks/task.rnv.hooks.run.ts @@ -10,6 +10,7 @@ import { PARAM_KEYS, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; export const taskRnvHooksRun: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -56,14 +57,14 @@ export const taskRnvHooksRun: RnvTaskFn = async (c, _parentTask, originTask) => return true; }; -export default { +const Task: RnvTask = { description: 'Run specific build hook', fn: taskRnvHooksRun, task: TASK_HOOKS_RUN, params: PARAMS.withBase([PARAM_KEYS.exeMethod]), platforms: [], - skipAppConfig: true, - skipPlatforms: true, forceBuildHookRebuild: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.install.ts b/packages/engine-core/src/tasks/task.rnv.install.ts index ca4c81e5ac..6b5992ec33 100644 --- a/packages/engine-core/src/tasks/task.rnv.install.ts +++ b/packages/engine-core/src/tasks/task.rnv.install.ts @@ -5,6 +5,7 @@ import { logTask, logInfo, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvInstall: RnvTaskFn = async (c, parentTask, _) => { @@ -28,11 +29,12 @@ export const taskRnvInstall: RnvTaskFn = async (c, parentTask, _) => { return true; }; -export default { +const Task: RnvTask = { description: 'Install package node_modules via yarn or npm', fn: taskRnvInstall, task: 'install', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.kill.ts b/packages/engine-core/src/tasks/task.rnv.kill.ts index 0f89becb4b..d17ba5899c 100644 --- a/packages/engine-core/src/tasks/task.rnv.kill.ts +++ b/packages/engine-core/src/tasks/task.rnv.kill.ts @@ -2,6 +2,7 @@ import { PARAMS, PlatformKey, RnvContext, + RnvTask, RnvTaskFn, TASK_APP_CONFIGURE, TASK_KILL, @@ -65,7 +66,7 @@ ${usedPorts.map((v) => chalk().white(`> ${v.port} (${v.platform})`)).join('\n')} return true; }; -export default { +const Task: RnvTask = { description: 'Kills all the processes related to this project', fn: taskRnvKill, task: TASK_KILL, @@ -73,3 +74,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.link.ts b/packages/engine-core/src/tasks/task.rnv.link.ts index 5c26191677..126e290c92 100644 --- a/packages/engine-core/src/tasks/task.rnv.link.ts +++ b/packages/engine-core/src/tasks/task.rnv.link.ts @@ -9,6 +9,7 @@ import { fsSymlinkSync, RnvTaskFn, RnvContext, + RnvTask, } from '@rnv/core'; import { RNV_PACKAGES } from '../constants'; @@ -38,12 +39,13 @@ export const taskRnvLink: RnvTaskFn = async (c, _parentTask, _originalTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Links development version or renative with this project', fn: taskRnvLink, task: 'link', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.new.ts b/packages/engine-core/src/tasks/task.rnv.new.ts index a4a86ab037..7a2ebc7145 100644 --- a/packages/engine-core/src/tasks/task.rnv.new.ts +++ b/packages/engine-core/src/tasks/task.rnv.new.ts @@ -35,6 +35,7 @@ import { PlatformKey, commandExistsSync, PromptParams, + RnvTask, } from '@rnv/core'; import { ConfigFileProject, ConfigFileTemplate } from '@rnv/core/lib/schema/configFiles/types'; @@ -797,7 +798,7 @@ const findEngineKeyById = (c: RnvContext, id: string) => { } }; -export default { +const Task: RnvTask = { description: 'Create new ReNative project', fn: taskRnvNew, task: 'new', @@ -805,3 +806,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.platform.configure.ts b/packages/engine-core/src/tasks/task.rnv.platform.configure.ts index 7fe075e5bd..bff4df218c 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.configure.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.configure.ts @@ -17,6 +17,7 @@ import { TASK_PROJECT_CONFIGURE, TASK_INSTALL, RnvTaskFn, + RnvTask, } from '@rnv/core'; import { checkAndConfigureSdks, checkSdk } from '../common'; @@ -55,10 +56,12 @@ export const taskRnvPlatformConfigure: RnvTaskFn = async (c, parentTask, originT return true; }; -export default { +const Task: RnvTask = { description: 'Low-level task used by engines to prepare platformBuilds folder', fn: taskRnvPlatformConfigure, task: TASK_PLATFORM_CONFIGURE, params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.platform.connect.ts b/packages/engine-core/src/tasks/task.rnv.platform.connect.ts index d590104829..9ffcf8a957 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.connect.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.connect.ts @@ -15,6 +15,7 @@ import { RnvTaskFn, inquirerPrompt, PlatformKey, + RnvTask, } from '@rnv/core'; export const taskRnvPlatformConnect: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -87,10 +88,12 @@ export const taskRnvPlatformConnect: RnvTaskFn = async (c, _parentTask, originTa ); }; -export default { +const Task: RnvTask = { description: 'Connect platform template back to rnv', fn: taskRnvPlatformConnect, task: TASK_PLATFORM_CONNECT, params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.platform.eject.ts b/packages/engine-core/src/tasks/task.rnv.platform.eject.ts index 983e927f86..e65eb5801b 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.eject.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.eject.ts @@ -14,6 +14,7 @@ import { RnvTaskFn, inquirerPrompt, PlatformKey, + RnvTask, } from '@rnv/core'; export const taskRnvPlatformEject: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -70,10 +71,12 @@ TIP: You can select options with ${chalk().white('SPACE')} key before pressing E } }; -export default { +const Task: RnvTask = { description: 'Copy all platform files directly to project', fn: taskRnvPlatformEject, task: 'platform eject', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.platform.setup.ts b/packages/engine-core/src/tasks/task.rnv.platform.setup.ts index ee8dd1301e..217d8f9ea9 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.setup.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.setup.ts @@ -7,6 +7,7 @@ import { executeTask, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; export const taskRnvPlatformSetup: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -29,11 +30,12 @@ export const taskRnvPlatformSetup: RnvTaskFn = async (c, _parentTask, originTask updateProjectPlatforms(c, inputSupportedPlatforms); }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvPlatformSetup, task: TASK_PLATFORM_SETUP, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.plugin.add.ts b/packages/engine-core/src/tasks/task.rnv.plugin.add.ts index 8f6131faaa..30d18c5e36 100644 --- a/packages/engine-core/src/tasks/task.rnv.plugin.add.ts +++ b/packages/engine-core/src/tasks/task.rnv.plugin.add.ts @@ -15,6 +15,7 @@ import { getApi, inquirerPrompt, RenativeConfigPlugin, + RnvTask, } from '@rnv/core'; /* eslint-disable no-await-in-loop */ @@ -101,10 +102,12 @@ export const taskRnvPluginAdd: RnvTaskFn = async (c, _parentTask, originTask) => return true; }; -export default { +const Task: RnvTask = { description: 'Add selected plugin to the project', fn: taskRnvPluginAdd, task: 'plugin add', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.plugin.list.ts b/packages/engine-core/src/tasks/task.rnv.plugin.list.ts index a1b20ce206..2d30c5ffd1 100644 --- a/packages/engine-core/src/tasks/task.rnv.plugin.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.plugin.list.ts @@ -7,6 +7,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvPluginList: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -22,10 +23,12 @@ export const taskRnvPluginList: RnvTaskFn = async (c, _parentTask, originTask) = return true; }; -export default { +const Task: RnvTask = { description: 'Show list of all available plugins', fn: taskRnvPluginList, task: 'plugin list', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.plugin.update.ts b/packages/engine-core/src/tasks/task.rnv.plugin.update.ts index 0cd4eb20f0..a53230ffc6 100644 --- a/packages/engine-core/src/tasks/task.rnv.plugin.update.ts +++ b/packages/engine-core/src/tasks/task.rnv.plugin.update.ts @@ -9,6 +9,7 @@ import { PARAMS, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; export const taskRnvPluginUpdate: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -48,10 +49,12 @@ export const taskRnvPluginUpdate: RnvTaskFn = async (c, _parentTask, originTask) } }; -export default { +const Task: RnvTask = { description: 'Update specific plugin to latest supported version (rnv)', fn: taskRnvPluginUpdate, task: 'plugin update', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.project.configure.ts b/packages/engine-core/src/tasks/task.rnv.project.configure.ts index 6d03ff159c..6fedc75426 100644 --- a/packages/engine-core/src/tasks/task.rnv.project.configure.ts +++ b/packages/engine-core/src/tasks/task.rnv.project.configure.ts @@ -35,6 +35,7 @@ import { RnvContext, generatePlatformAssetsRuntimeConfig, TASK_CRYPTO_DECRYPT, + RnvTask, } from '@rnv/core'; const checkIsRenativeProject = (c: RnvContext) => @@ -136,10 +137,12 @@ export const taskRnvProjectConfigure: RnvTaskFn = async (c, parentTask, originTa return true; }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvProjectConfigure, task: TASK_PROJECT_CONFIGURE, params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.project.upgrade.ts b/packages/engine-core/src/tasks/task.rnv.project.upgrade.ts index c4294c5315..a6b506be87 100644 --- a/packages/engine-core/src/tasks/task.rnv.project.upgrade.ts +++ b/packages/engine-core/src/tasks/task.rnv.project.upgrade.ts @@ -15,6 +15,7 @@ import { fsExistsSync, readObjectSync, RnvTaskFn, + RnvTask, } from '@rnv/core'; import { NpmPackageFile } from '@rnv/core/lib/configs/types'; import { ConfigFileProject } from '@rnv/core/lib/schema/configFiles/types'; @@ -74,13 +75,13 @@ export const taskRnvProjectUpgrade: RnvTaskFn = async (c, _parentTask, originTas return true; }; -export default { +const Task: RnvTask = { description: 'Upgrade or downgrade RNV dependencies in your ReNative project', fn: taskRnvProjectUpgrade, task: TASK_PROJECT_UPGRADE, params: PARAMS.withBase(), platforms: [], - skipAppConfig: true, - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.status.ts b/packages/engine-core/src/tasks/task.rnv.status.ts index a3be56b737..335d9856a7 100644 --- a/packages/engine-core/src/tasks/task.rnv.status.ts +++ b/packages/engine-core/src/tasks/task.rnv.status.ts @@ -1,8 +1,8 @@ -import { PARAMS } from '@rnv/core'; +import { PARAMS, RnvTask } from '@rnv/core'; export const taskRnvStatus = async () => Promise.resolve(); -export default { +const Task: RnvTask = { description: 'Show current info about the project', fn: taskRnvStatus, task: 'status', @@ -10,3 +10,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.switch.ts b/packages/engine-core/src/tasks/task.rnv.switch.ts index e9b8dba019..f7b7ea8a82 100644 --- a/packages/engine-core/src/tasks/task.rnv.switch.ts +++ b/packages/engine-core/src/tasks/task.rnv.switch.ts @@ -8,6 +8,7 @@ import { PARAMS, RnvTaskFn, generatePlatformAssetsRuntimeConfig, + RnvTask, } from '@rnv/core'; export const taskRnvSwitch: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -22,10 +23,12 @@ export const taskRnvSwitch: RnvTaskFn = async (c, _parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvSwitch, task: TASK_SWITCH, params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.target.launch.ts b/packages/engine-core/src/tasks/task.rnv.target.launch.ts index c7541878f4..c5a06f0198 100644 --- a/packages/engine-core/src/tasks/task.rnv.target.launch.ts +++ b/packages/engine-core/src/tasks/task.rnv.target.launch.ts @@ -17,6 +17,7 @@ import { executeTask, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; import { checkAndConfigureSdks, checkSdk } from '../common'; @@ -88,7 +89,7 @@ export const taskRnvTargetLaunch: RnvTaskFn = async (c, parentTask, originTask) } }; -export default { +const Task: RnvTask = { description: 'Launch specific emulator', fn: taskRnvTargetLaunch, task: 'target launch', @@ -96,3 +97,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.target.list.ts b/packages/engine-core/src/tasks/task.rnv.target.list.ts index 7834e6e702..2dbb7de4ca 100644 --- a/packages/engine-core/src/tasks/task.rnv.target.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.target.list.ts @@ -15,6 +15,7 @@ import { PARAMS, executeTask, RnvTaskFn, + RnvTask, } from '@rnv/core'; import { listAndroidTargets } from '@rnv/sdk-android'; import { listAppleDevices } from '@rnv/sdk-apple'; @@ -54,7 +55,7 @@ export const taskRnvTargetList: RnvTaskFn = async (c, _parentTask, originTask) = } }; -export default { +const Task: RnvTask = { description: 'List all available devices / emulators for specific platform', fn: taskRnvTargetList, task: 'target list', @@ -62,3 +63,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts b/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts index dc69280c62..a8cc69fea8 100644 --- a/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts +++ b/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts @@ -1,4 +1,4 @@ -import { chalk, logTask, logToSummary, PARAMS, RnvTaskFn, writeFileSync } from '@rnv/core'; +import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn, writeFileSync } from '@rnv/core'; export const taskRnvTelemetryDisable: RnvTaskFn = async (c) => { logTask('taskRnvTelemetryDisable'); @@ -18,12 +18,13 @@ export const taskRnvTelemetryDisable: RnvTaskFn = async (c) => { return true; }; -export default { +const Task: RnvTask = { description: 'Disables rnv telemetry on your machine', fn: taskRnvTelemetryDisable, task: 'telemetry disable', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts b/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts index 2c66f14781..f5087ec0b3 100644 --- a/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts +++ b/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts @@ -1,4 +1,4 @@ -import { chalk, logTask, logToSummary, PARAMS, RnvTaskFn, writeFileSync } from '@rnv/core'; +import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn, writeFileSync } from '@rnv/core'; export const taskRnvTelemetryEnable: RnvTaskFn = async (c) => { logTask('taskRnvTelemetryEnable'); @@ -18,12 +18,13 @@ export const taskRnvTelemetryEnable: RnvTaskFn = async (c) => { return true; }; -export default { +const Task: RnvTask = { description: 'Enables rnv telemetry on your machine', fn: taskRnvTelemetryEnable, task: 'telemetry enable', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts b/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts index 63fd1e67fa..8135bf3761 100644 --- a/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts +++ b/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts @@ -1,4 +1,4 @@ -import { chalk, logTask, logToSummary, PARAMS, RnvTaskFn } from '@rnv/core'; +import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn } from '@rnv/core'; export const taskRnvTelemetryStatus: RnvTaskFn = async (c) => { logTask('taskRnvTelemetryStatus'); @@ -25,12 +25,13 @@ export const taskRnvTelemetryStatus: RnvTaskFn = async (c) => { return true; }; -export default { +const Task: RnvTask = { description: 'Show current rnv telemetry status on your machine', fn: taskRnvTelemetryStatus, task: 'telemetry status', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.template.add.ts b/packages/engine-core/src/tasks/task.rnv.template.add.ts index 1fdc083ab5..a7efaf47ab 100644 --- a/packages/engine-core/src/tasks/task.rnv.template.add.ts +++ b/packages/engine-core/src/tasks/task.rnv.template.add.ts @@ -10,6 +10,7 @@ import { RnvContext, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; const _writeObjectSync = (c: RnvContext, p: string, s: object) => { @@ -53,10 +54,12 @@ export const taskRnvTemplateAdd: RnvTaskFn = async (c, _parentTask, originTask) return true; }; -export default { +const Task: RnvTask = { description: 'Install additional template to the project', fn: taskRnvTemplateAdd, task: 'template add', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.template.apply.ts b/packages/engine-core/src/tasks/task.rnv.template.apply.ts index 52f9ba10ad..91c3bb3808 100644 --- a/packages/engine-core/src/tasks/task.rnv.template.apply.ts +++ b/packages/engine-core/src/tasks/task.rnv.template.apply.ts @@ -9,6 +9,7 @@ import { PARAMS, RnvTaskFn, inquirerPrompt, + RnvTask, } from '@rnv/core'; export const taskRnvTemplateApply: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -44,10 +45,12 @@ export const taskRnvTemplateApply: RnvTaskFn = async (c, _parentTask, originTask return true; }; -export default { +const Task: RnvTask = { description: 'Reset project to specific template', fn: taskRnvTemplateApply, task: 'template apply', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.template.list.ts b/packages/engine-core/src/tasks/task.rnv.template.list.ts index c507b991b0..e33fcb4ff5 100644 --- a/packages/engine-core/src/tasks/task.rnv.template.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.template.list.ts @@ -7,6 +7,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvTemplateList: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -20,12 +21,13 @@ export const taskRnvTemplateList: RnvTaskFn = async (c, _parentTask, originTask) return true; }; -export default { +const Task: RnvTask = { description: 'Show list of available templates', fn: taskRnvTemplateList, task: 'template list', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.unlink.ts b/packages/engine-core/src/tasks/task.rnv.unlink.ts index 1ab217d081..b9e76ebcfa 100644 --- a/packages/engine-core/src/tasks/task.rnv.unlink.ts +++ b/packages/engine-core/src/tasks/task.rnv.unlink.ts @@ -10,6 +10,7 @@ import { fsLstatSync, RnvTaskFn, RnvContext, + RnvTask, } from '@rnv/core'; import { RNV_PACKAGES } from '../constants'; @@ -42,12 +43,13 @@ export const taskRnvUnlink: RnvTaskFn = async (c) => { return true; }; -export default { +const Task: RnvTask = { description: 'Replaces rnv version in project with original node_modules version', fn: taskRnvUnlink, task: 'unlink', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.workspace.add.ts b/packages/engine-core/src/tasks/task.rnv.workspace.add.ts index e56e602a38..dcff7ea90b 100644 --- a/packages/engine-core/src/tasks/task.rnv.workspace.add.ts +++ b/packages/engine-core/src/tasks/task.rnv.workspace.add.ts @@ -9,6 +9,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvWorkspaceAdd: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -48,7 +49,7 @@ export const taskRnvWorkspaceAdd: RnvTaskFn = async (c, _parentTask, originTask) return true; }; -export default { +const Task: RnvTask = { description: 'Add new workspace', fn: taskRnvWorkspaceAdd, task: TASK_WORKSPACE_ADD, @@ -56,3 +57,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts b/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts index aecebfb88c..950a3159e6 100644 --- a/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts +++ b/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts @@ -13,6 +13,7 @@ import { logDebug, logInfo, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvWorkspaceConfigure: RnvTaskFn = async (c) => { @@ -86,12 +87,13 @@ export const taskRnvWorkspaceConfigure: RnvTaskFn = async (c) => { return true; }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvWorkspaceConfigure, task: 'workspace configure', params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.workspace.connect.ts b/packages/engine-core/src/tasks/task.rnv.workspace.connect.ts index af472b3196..3433d0ab17 100644 --- a/packages/engine-core/src/tasks/task.rnv.workspace.connect.ts +++ b/packages/engine-core/src/tasks/task.rnv.workspace.connect.ts @@ -8,6 +8,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvWorkspaceConnect: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -33,7 +34,7 @@ export const taskRnvWorkspaceConnect: RnvTaskFn = async (c, _parentTask, originT logRaw(selectedWS); }; -export default { +const Task: RnvTask = { description: 'Connect project with selected workspace', fn: taskRnvWorkspaceConnect, task: TASK_WORKSPACE_CONNECT, @@ -41,3 +42,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.workspace.list.ts b/packages/engine-core/src/tasks/task.rnv.workspace.list.ts index 575966d605..9b1608284f 100644 --- a/packages/engine-core/src/tasks/task.rnv.workspace.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.workspace.list.ts @@ -8,6 +8,7 @@ import { TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; export const taskRnvWorkspaceList: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -30,7 +31,7 @@ export const taskRnvWorkspaceList: RnvTaskFn = async (c, _parentTask, originTask logToSummary(`Workspaces:\n\n${opts.asString}`); }; -export default { +const Task: RnvTask = { description: 'Show list of all available workspaces', fn: taskRnvWorkspaceList, task: TASK_WORKSPACE_LIST, @@ -38,3 +39,5 @@ export default { platforms: [], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.workspace.update.ts b/packages/engine-core/src/tasks/task.rnv.workspace.update.ts index a2ce57353c..c28828cf21 100644 --- a/packages/engine-core/src/tasks/task.rnv.workspace.update.ts +++ b/packages/engine-core/src/tasks/task.rnv.workspace.update.ts @@ -1,4 +1,12 @@ -import { logTask, executeTask, TASK_WORKSPACE_UPDATE, TASK_PROJECT_CONFIGURE, PARAMS, RnvTaskFn } from '@rnv/core'; +import { + logTask, + executeTask, + TASK_WORKSPACE_UPDATE, + TASK_PROJECT_CONFIGURE, + PARAMS, + RnvTaskFn, + RnvTask, +} from '@rnv/core'; export const taskRnvWorkspaceUpdate: RnvTaskFn = async (c, _parentTask, originTask) => { // TODO: taskRnvWorkspaceUpdate @@ -9,12 +17,13 @@ export const taskRnvWorkspaceUpdate: RnvTaskFn = async (c, _parentTask, originTa return true; }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvWorkspaceUpdate, task: TASK_WORKSPACE_UPDATE, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, isGlobalScope: true, }; + +export default Task; From 7b1710eca29cd0565628dd3114f16e63bf923073 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 21:16:01 +0100 Subject: [PATCH 06/10] aggregated descriptions --- packages/core/src/constants.ts | 9 +++++ packages/core/src/tasks/index.ts | 35 ++++++++++++------- .../src/tasks/task.rnv.run.ts | 2 +- .../src/tasks/task.rnv.run.ts | 2 +- .../engine-rn-macos/src/tasks/task.rnv.run.ts | 2 +- .../engine-rn-tvos/src/tasks/task.rnv.run.ts | 2 +- packages/engine-rn/src/tasks/task.rnv.run.ts | 2 +- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 50eb5bb7d6..0a8fe4d536 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -190,3 +190,12 @@ export const INJECTABLE_CONFIG_PROPS: Array = [ export const INJECTABLE_RUNTIME_PROPS = ['appId', 'scheme', 'timestamp', 'localhost', 'target', 'port'] as const; export const REMOTE_DEBUGGER_ENABLED_PLATFORMS = [TIZEN, TIZEN_MOBILE, TIZEN_WATCH]; + +export const DEFAULT_TASK_DESCRIPTIONS: Record = { + [TASK_RUN]: 'Run your app on target device or emulator', + [TASK_PACKAGE]: 'Package source files into bundle', + [TASK_BUILD]: 'Build project binary', + [TASK_CONFIGURE]: 'Configure current project', + [TASK_START]: 'Starts bundler / server', + [TASK_EXPORT]: 'Export the app into deployable binary', +}; diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index 280baa80c9..af0203f86c 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -9,6 +9,7 @@ import { registerAllPlatformEngines, } from '../engines'; import { + DEFAULT_TASK_DESCRIPTIONS, TASK_BUILD, TASK_CONFIGURE, TASK_CONFIGURE_SOFT, @@ -38,6 +39,9 @@ type TaskOption = { asArray?: string[]; subCommand?: string; subTasks?: TaskOption[]; + description?: string; + isGlobalScope?: boolean; + isPrivate?: boolean; }; export const registerCustomTask = async (_c: RnvContext, task: RnvTask) => { @@ -67,9 +71,13 @@ const _getTaskOption = ({ taskInstance }: TaskObj): TaskOption => { command: '', name: '', asArray, + description: taskInstance.description, + isGlobalScope: taskInstance.isGlobalScope, + isPrivate: taskInstance.isPrivate, }; if (taskInstance.description && taskInstance.description !== '') { + output.description = taskInstance.description; output.name = `${taskInstance.task} ${chalk().grey(`(${taskInstance.description})`)}`; } else { output.name = taskInstance.task; @@ -104,32 +112,35 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr let task = ''; if (!specificTask) { if (!c.command) { - const suitableTaskInstances: Record = {}; + const suitableTasks: Record = {}; REGISTERED_ENGINES.forEach((engine) => { Object.values(engine.tasks).forEach((taskInstance) => { - const taskObj = _getTaskObj(taskInstance); - suitableTaskInstances[taskObj.key] = taskObj; + const taskObj = _getTaskOption(_getTaskObj(taskInstance)); + if (!suitableTasks[taskObj.value]) { + suitableTasks[taskObj.value] = taskObj; + } else { + // In case of multiple competing tasks (same task name but coming from different engines) + // We try to revert to generic description instead. + taskObj.description = DEFAULT_TASK_DESCRIPTIONS[taskObj.value] || taskObj.description; + } }); }); Object.values(CUSTOM_TASKS).forEach((taskInstance) => { - const taskObj = _getTaskObj(taskInstance); - suitableTaskInstances[taskObj.key] = taskObj; + const taskObj = _getTaskOption(_getTaskObj(taskInstance)); + suitableTasks[taskObj.value] = taskObj; }); - const taskInstances = Object.values(suitableTaskInstances); + const taskInstances = Object.values(suitableTasks); let tasks: TaskOption[]; let defaultCmd: string | undefined = 'new'; - let filteredTasks; let addendum = ''; if (!c.paths.project.configExists) { - filteredTasks = taskInstances.filter((v) => v.taskInstance.isGlobalScope && !v.taskInstance.isPrivate); - tasks = filteredTasks.map((v) => _getTaskOption(v)).sort(); + tasks = taskInstances.filter((v) => v.isGlobalScope && !v.isPrivate).sort(); addendum = ' (Not a ReNative project. options will be limited)'; } else { - filteredTasks = taskInstances.filter((v) => !v.taskInstance.isPrivate); - tasks = filteredTasks.map((v) => _getTaskOption(v)).sort(); - defaultCmd = tasks.find((v) => v.value.startsWith('run'))?.name; + tasks = taskInstances.filter((v) => !v.isPrivate).sort(); + defaultCmd = tasks.find((v) => v.value === 'run')?.name; } const commonTasks: TaskOption[] = []; diff --git a/packages/engine-lightning/src/tasks/task.rnv.run.ts b/packages/engine-lightning/src/tasks/task.rnv.run.ts index 8abaa048b3..9dcc9d2e01 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.run.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.run.ts @@ -37,7 +37,7 @@ More info at: https://renative.org/docs/api-cli }; const Task = { - description: 'Run your app on target device or emulator', + description: 'Run your lightning app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: 'run', diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.run.ts b/packages/engine-rn-electron/src/tasks/task.rnv.run.ts index c1bb9099c0..6f7bd4e66e 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.run.ts @@ -35,7 +35,7 @@ export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => { }; export default { - description: 'Run your app on target device or emulator', + description: 'Run your electron app on target device or emulator', fn: taskRnvRun, task: TASK_RUN, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.run.ts b/packages/engine-rn-macos/src/tasks/task.rnv.run.ts index be301eaa3d..eb72316aa9 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.run.ts @@ -51,7 +51,7 @@ More info at: https://renative.org/docs/api-cli }; const Task = { - description: 'Run your app on target device or emulator', + description: 'Run your macos app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: TASK_RUN, diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts index 1d8ff53c14..16578a496a 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts @@ -72,7 +72,7 @@ More info at: https://renative.org/docs/api-cli }; const Task = { - description: 'Run your app on target device or emulator', + description: 'Run your tv app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: TASK_RUN, diff --git a/packages/engine-rn/src/tasks/task.rnv.run.ts b/packages/engine-rn/src/tasks/task.rnv.run.ts index fad7fb29bc..4f18987837 100644 --- a/packages/engine-rn/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn/src/tasks/task.rnv.run.ts @@ -80,7 +80,7 @@ More info at: https://renative.org/docs/api-cli }; const Task = { - description: 'Run your app on target device or emulator', + description: 'Run your rn app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: TASK_RUN, From a5e4b823320d6b782c5082bd60a925dcf96a6a9a Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 21:42:31 +0100 Subject: [PATCH 07/10] move common tasks to generic constants before integrating isPriorityOrder --- packages/core/src/constants.ts | 11 +++++++++++ packages/core/src/tasks/index.ts | 15 +-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 0a8fe4d536..93545a4e6c 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -199,3 +199,14 @@ export const DEFAULT_TASK_DESCRIPTIONS: Record = { [TASK_START]: 'Starts bundler / server', [TASK_EXPORT]: 'Export the app into deployable binary', }; + +export const COMMON_TASKS = [ + TASK_RUN, + TASK_BUILD, + TASK_CONFIGURE, + TASK_NEW, + TASK_HELP, + TASK_PACKAGE, + TASK_START, + TASK_EXPORT, +]; diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index af0203f86c..e2cc9599fe 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -8,18 +8,7 @@ import { getEngineSubTasks, registerAllPlatformEngines, } from '../engines'; -import { - DEFAULT_TASK_DESCRIPTIONS, - TASK_BUILD, - TASK_CONFIGURE, - TASK_CONFIGURE_SOFT, - TASK_EXPORT, - TASK_HELP, - TASK_NEW, - TASK_PACKAGE, - TASK_RUN, - TASK_START, -} from '../constants'; +import { COMMON_TASKS, DEFAULT_TASK_DESCRIPTIONS, TASK_CONFIGURE_SOFT } from '../constants'; import { RnvContext } from '../context/types'; import { RnvTask, RnvTaskMap, TaskItemMap, TaskObj } from './types'; import { RnvEngine } from '../engines/types'; @@ -104,8 +93,6 @@ const _getTaskObj = (taskInstance: RnvTask) => { }; }; -const COMMON_TASKS = [TASK_RUN, TASK_BUILD, TASK_CONFIGURE, TASK_NEW, TASK_HELP, TASK_PACKAGE, TASK_START, TASK_EXPORT]; - export const findSuitableTask = async (c: RnvContext, specificTask?: string): Promise => { logTask('findSuitableTask'); const REGISTERED_ENGINES = getRegisteredEngines(c); From 28d25ef143aec965d9e6ec168f7eb2cc3a430931 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Mon, 12 Feb 2024 21:52:17 +0100 Subject: [PATCH 08/10] move common tasks to isPriorityOrder controlled by each task --- packages/core/src/constants.ts | 11 --------- packages/core/src/tasks/index.ts | 24 +++++++------------ packages/core/src/tasks/types.ts | 14 +++++++++++ .../engine-core/src/tasks/task.rnv.help.ts | 1 + .../engine-core/src/tasks/task.rnv.new.ts | 1 + 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 93545a4e6c..0a8fe4d536 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -199,14 +199,3 @@ export const DEFAULT_TASK_DESCRIPTIONS: Record = { [TASK_START]: 'Starts bundler / server', [TASK_EXPORT]: 'Export the app into deployable binary', }; - -export const COMMON_TASKS = [ - TASK_RUN, - TASK_BUILD, - TASK_CONFIGURE, - TASK_NEW, - TASK_HELP, - TASK_PACKAGE, - TASK_START, - TASK_EXPORT, -]; diff --git a/packages/core/src/tasks/index.ts b/packages/core/src/tasks/index.ts index e2cc9599fe..6d019f60a4 100644 --- a/packages/core/src/tasks/index.ts +++ b/packages/core/src/tasks/index.ts @@ -8,9 +8,9 @@ import { getEngineSubTasks, registerAllPlatformEngines, } from '../engines'; -import { COMMON_TASKS, DEFAULT_TASK_DESCRIPTIONS, TASK_CONFIGURE_SOFT } from '../constants'; +import { DEFAULT_TASK_DESCRIPTIONS, TASK_CONFIGURE_SOFT } from '../constants'; import { RnvContext } from '../context/types'; -import { RnvTask, RnvTaskMap, TaskItemMap, TaskObj } from './types'; +import { RnvTask, RnvTaskMap, TaskItemMap, TaskObj, TaskOption } from './types'; import { RnvEngine } from '../engines/types'; import { inquirerPrompt, inquirerSeparator, pressAnyKeyToContinue } from '../api'; import { getApi } from '../api/provider'; @@ -21,18 +21,6 @@ let executedTasks: Record = {}; const CUSTOM_TASKS: RnvTaskMap = {}; -type TaskOption = { - name: string; - value: string; - command: string; - asArray?: string[]; - subCommand?: string; - subTasks?: TaskOption[]; - description?: string; - isGlobalScope?: boolean; - isPrivate?: boolean; -}; - export const registerCustomTask = async (_c: RnvContext, task: RnvTask) => { if (task.task) { CUSTOM_TASKS[task.task] = task; @@ -60,6 +48,7 @@ const _getTaskOption = ({ taskInstance }: TaskObj): TaskOption => { command: '', name: '', asArray, + isPriorityOrder: taskInstance.isPriorityOrder, description: taskInstance.description, isGlobalScope: taskInstance.isGlobalScope, isPrivate: taskInstance.isPrivate, @@ -102,13 +91,16 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr const suitableTasks: Record = {}; REGISTERED_ENGINES.forEach((engine) => { Object.values(engine.tasks).forEach((taskInstance) => { - const taskObj = _getTaskOption(_getTaskObj(taskInstance)); + let taskObj: TaskOption = _getTaskOption(_getTaskObj(taskInstance)); if (!suitableTasks[taskObj.value]) { suitableTasks[taskObj.value] = taskObj; } else { + taskObj = suitableTasks[taskObj.value]; // In case of multiple competing tasks (same task name but coming from different engines) // We try to revert to generic description instead. taskObj.description = DEFAULT_TASK_DESCRIPTIONS[taskObj.value] || taskObj.description; + // In case of multiple competing tasks we assume they are "commonly used" + taskObj.isPriorityOrder = true; } }); }); @@ -145,7 +137,7 @@ export const findSuitableTask = async (c: RnvContext, specificTask?: string): Pr taskGroups[task.command] = groupTask; groupedTasks.push(groupTask); } - } else if (COMMON_TASKS.includes(task.value)) { + } else if (task.isPriorityOrder) { commonTasks.push(task); } else { ungroupedTasks.push(task); diff --git a/packages/core/src/tasks/types.ts b/packages/core/src/tasks/types.ts index 8e6cdddc53..eb99c30aa2 100644 --- a/packages/core/src/tasks/types.ts +++ b/packages/core/src/tasks/types.ts @@ -10,6 +10,20 @@ export type RnvTask = { fn?: RnvTaskFn; fnHelp?: RnvTaskFn; isPrivate?: boolean; + isPriorityOrder?: boolean; +}; + +export type TaskOption = { + name: string; + value: string; + command: string; + asArray?: string[]; + subCommand?: string; + subTasks?: TaskOption[]; + description?: string; + isGlobalScope?: boolean; + isPrivate?: boolean; + isPriorityOrder?: boolean; }; export type RnvTaskParameter = { diff --git a/packages/engine-core/src/tasks/task.rnv.help.ts b/packages/engine-core/src/tasks/task.rnv.help.ts index 6e15a2563e..9517c8c710 100644 --- a/packages/engine-core/src/tasks/task.rnv.help.ts +++ b/packages/engine-core/src/tasks/task.rnv.help.ts @@ -51,6 +51,7 @@ const Task: RnvTask = { params: PARAMS.withBase(), platforms: [], isGlobalScope: true, + isPriorityOrder: true, }; export default Task; diff --git a/packages/engine-core/src/tasks/task.rnv.new.ts b/packages/engine-core/src/tasks/task.rnv.new.ts index 7a2ebc7145..50beb32e57 100644 --- a/packages/engine-core/src/tasks/task.rnv.new.ts +++ b/packages/engine-core/src/tasks/task.rnv.new.ts @@ -805,6 +805,7 @@ const Task: RnvTask = { params: PARAMS.withBase(), platforms: [], isGlobalScope: true, + isPriorityOrder: true, }; export default Task; From 422407791f0785d80495f774126429ab99e27c7e Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Tue, 13 Feb 2024 21:00:47 +0100 Subject: [PATCH 09/10] typed tasks for engine-rn --- packages/engine-lightning/src/tasks/task.rnv.build.ts | 2 ++ .../engine-lightning/src/tasks/task.rnv.configure.ts | 2 ++ packages/engine-lightning/src/tasks/task.rnv.run.ts | 9 +++++---- packages/engine-rn-electron/src/tasks/task.rnv.run.ts | 2 +- packages/engine-rn/src/tasks/task.rnv.build.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.configure.ts | 5 ++++- .../engine-rn/src/tasks/task.rnv.crypto.installCerts.ts | 7 +++++-- .../src/tasks/task.rnv.crypto.installProfiles.ts | 7 +++++-- .../engine-rn/src/tasks/task.rnv.crypto.updateProfile.ts | 7 +++++-- .../src/tasks/task.rnv.crypto.updateProfiles.ts | 7 +++++-- packages/engine-rn/src/tasks/task.rnv.debug.ts | 6 ++++-- packages/engine-rn/src/tasks/task.rnv.deploy.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.eject.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.export.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.log.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.package.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.run.ts | 9 +++++---- packages/engine-rn/src/tasks/task.rnv.start.ts | 5 ++++- 18 files changed, 71 insertions(+), 27 deletions(-) diff --git a/packages/engine-lightning/src/tasks/task.rnv.build.ts b/packages/engine-lightning/src/tasks/task.rnv.build.ts index 307c6dbdfa..03196dd40c 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.build.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.build.ts @@ -38,3 +38,5 @@ export default { params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TIZEN, WEBOS], }; + +export default Task; diff --git a/packages/engine-lightning/src/tasks/task.rnv.configure.ts b/packages/engine-lightning/src/tasks/task.rnv.configure.ts index ee778e300f..3418741619 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.configure.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.configure.ts @@ -36,3 +36,5 @@ export default { params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TIZEN, WEBOS], }; + +export default Task; diff --git a/packages/engine-lightning/src/tasks/task.rnv.run.ts b/packages/engine-lightning/src/tasks/task.rnv.run.ts index 9dcc9d2e01..b75ec7c550 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.run.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.run.ts @@ -9,6 +9,7 @@ import { TASK_CONFIGURE, PARAMS, executeOrSkipTask, + RnvTask, } from '@rnv/core'; import { runLightningProject } from '../sdks/sdk-lightning'; @@ -36,14 +37,14 @@ More info at: https://renative.org/docs/api-cli `); }; -const Task = { +const Task: RnvTask = { description: 'Run your lightning app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: 'run', - dependencies: { - before: TASK_CONFIGURE, - }, + // dependencies: { + // before: TASK_CONFIGURE, + // }, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [TIZEN, WEBOS], }; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.run.ts b/packages/engine-rn-electron/src/tasks/task.rnv.run.ts index 6f7bd4e66e..60fe29f233 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.run.ts @@ -35,7 +35,7 @@ export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => { }; export default { - description: 'Run your electron app on target device or emulator', + description: 'Run your electron app on your machine', fn: taskRnvRun, task: TASK_RUN, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), diff --git a/packages/engine-rn/src/tasks/task.rnv.build.ts b/packages/engine-rn/src/tasks/task.rnv.build.ts index 22e3cc0818..ae07afc484 100644 --- a/packages/engine-rn/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn/src/tasks/task.rnv.build.ts @@ -14,6 +14,7 @@ import { ANDROID_WEAR, MACOS, IOS, + RnvTask, } from '@rnv/core'; import { buildReactNativeAndroid } from '@rnv/sdk-react-native'; import { buildXcodeProject } from '@rnv/sdk-apple'; @@ -44,10 +45,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, ANDROID, ANDROID_TV, ANDROID_WEAR, MACOS], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.configure.ts b/packages/engine-rn/src/tasks/task.rnv.configure.ts index 8c66f7c931..42ecbd2d90 100644 --- a/packages/engine-rn/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn/src/tasks/task.rnv.configure.ts @@ -15,6 +15,7 @@ import { MACOS, IOS, jetifyIfRequired, + RnvTask, } from '@rnv/core'; import { configureGradleProject } from '@rnv/sdk-android'; import { configureXcodeProject } from '@rnv/sdk-apple'; @@ -53,10 +54,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => return true; }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, task: 'configure', params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.crypto.installCerts.ts b/packages/engine-rn/src/tasks/task.rnv.crypto.installCerts.ts index 78c5150d07..7e6d80da06 100644 --- a/packages/engine-rn/src/tasks/task.rnv.crypto.installCerts.ts +++ b/packages/engine-rn/src/tasks/task.rnv.crypto.installCerts.ts @@ -10,6 +10,7 @@ import { TASK_CRYPTO_INSTALL_CERTS, getFileListSync, logWarning, + RnvTask, } from '@rnv/core'; export const taskRnvCryptoInstallCerts: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -36,11 +37,13 @@ export const taskRnvCryptoInstallCerts: RnvTaskFn = async (c, _parentTask, origi } }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvCryptoInstallCerts, task: TASK_CRYPTO_INSTALL_CERTS, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.crypto.installProfiles.ts b/packages/engine-rn/src/tasks/task.rnv.crypto.installProfiles.ts index f1c4678603..1e8a4cdfc0 100644 --- a/packages/engine-rn/src/tasks/task.rnv.crypto.installProfiles.ts +++ b/packages/engine-rn/src/tasks/task.rnv.crypto.installProfiles.ts @@ -13,6 +13,7 @@ import { logWarning, getFileListSync, logDebug, + RnvTask, } from '@rnv/core'; export const taskRnvCryptoInstallProfiles: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -49,11 +50,13 @@ export const taskRnvCryptoInstallProfiles: RnvTaskFn = async (c, _parentTask, or return true; }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvCryptoInstallProfiles, task: TASK_CRYPTO_INSTALL_PROFILES, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfile.ts b/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfile.ts index a37fe3d976..c85481cc6e 100644 --- a/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfile.ts +++ b/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfile.ts @@ -7,6 +7,7 @@ import { IOS, TASK_PROJECT_CONFIGURE, TASK_CRYPTO_UPDATE_PROFILE, + RnvTask, } from '@rnv/core'; import { updateProfile } from '@rnv/sdk-apple'; @@ -20,11 +21,13 @@ export const taskRnvCryptoUpdateProfile: RnvTaskFn = async (c, _parentTask, orig await updateProfile(c); }; -export default { +const Task: RnvTask = { description: 'Update provisioning profile', fn: taskRnvCryptoUpdateProfile, task: TASK_CRYPTO_UPDATE_PROFILE, params: PARAMS.withBase(), platforms: [IOS], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfiles.ts b/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfiles.ts index cadec92fb9..d0f67a35ff 100644 --- a/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfiles.ts +++ b/packages/engine-rn/src/tasks/task.rnv.crypto.updateProfiles.ts @@ -10,6 +10,7 @@ import { listAppConfigsFoldersSync, TASK_PROJECT_CONFIGURE, TASK_CRYPTO_UPDATE_PROFILES, + RnvTask, } from '@rnv/core'; import { updateProfile } from '@rnv/sdk-apple'; @@ -45,11 +46,13 @@ export const taskRnvCryptoUpdateProfiles: RnvTaskFn = async (c, _parentTask, ori return Promise.reject(`updateProfiles: Platform ${c.platform} not supported`); }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvCryptoUpdateProfiles, task: TASK_CRYPTO_UPDATE_PROFILES, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.debug.ts b/packages/engine-rn/src/tasks/task.rnv.debug.ts index d5cc643f9c..a967b72252 100644 --- a/packages/engine-rn/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn/src/tasks/task.rnv.debug.ts @@ -1,4 +1,4 @@ -import { logErrorPlatform, logTask, PARAMS, RnvTaskFn } from '@rnv/core'; +import { logErrorPlatform, logTask, PARAMS, RnvTask, RnvTaskFn } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { logTask('taskRnvDebug', `parent:${parentTask}`); @@ -10,10 +10,12 @@ export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { } }; -export default { +const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, task: 'debug', params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.deploy.ts b/packages/engine-rn/src/tasks/task.rnv.deploy.ts index 4a2ea51a4f..d98b742863 100644 --- a/packages/engine-rn/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn/src/tasks/task.rnv.deploy.ts @@ -12,6 +12,7 @@ import { MACOS, IOS, TASK_DEPLOY, + RnvTask, } from '@rnv/core'; export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { @@ -25,10 +26,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment intgeration or buld hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.eject.ts b/packages/engine-rn/src/tasks/task.rnv.eject.ts index 6674006235..1bc75bf373 100644 --- a/packages/engine-rn/src/tasks/task.rnv.eject.ts +++ b/packages/engine-rn/src/tasks/task.rnv.eject.ts @@ -13,6 +13,7 @@ import { MACOS, IOS, TASK_EJECT, + RnvTask, } from '@rnv/core'; import { ejectGradleProject } from '@rnv/sdk-android'; import { ejectXcodeProject } from '@rnv/sdk-apple'; @@ -57,10 +58,12 @@ export const taskRnvEject: RnvTaskFn = async (c, _parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Eject current project app to self contained native project', fn: taskRnvEject, task: TASK_EJECT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.export.ts b/packages/engine-rn/src/tasks/task.rnv.export.ts index 6d13df5492..ab8e49a03d 100644 --- a/packages/engine-rn/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn/src/tasks/task.rnv.export.ts @@ -13,6 +13,7 @@ import { ANDROID_WEAR, MACOS, IOS, + RnvTask, } from '@rnv/core'; import { exportXcodeProject } from '@rnv/sdk-apple'; @@ -39,10 +40,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.log.ts b/packages/engine-rn/src/tasks/task.rnv.log.ts index 9ad8d6339d..5e3ed05e61 100644 --- a/packages/engine-rn/src/tasks/task.rnv.log.ts +++ b/packages/engine-rn/src/tasks/task.rnv.log.ts @@ -11,6 +11,7 @@ import { IOS, TASK_WORKSPACE_CONFIGURE, TASK_PROJECT_CONFIGURE, + RnvTask, } from '@rnv/core'; import { runAndroidLog, checkAndConfigureAndroidSdks } from '@rnv/sdk-android'; import { runAppleLog } from '@rnv/sdk-apple'; @@ -36,7 +37,7 @@ export const taskRnvLog: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Attach logger to device or emulator and print out logs', fn: taskRnvLog, task: 'log', @@ -44,3 +45,5 @@ export default { platforms: [IOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.package.ts b/packages/engine-rn/src/tasks/task.rnv.package.ts index d3d12a7691..8227f5852a 100644 --- a/packages/engine-rn/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn/src/tasks/task.rnv.package.ts @@ -15,6 +15,7 @@ import { IOS, getConfigProp, TASK_EJECT, + RnvTask, } from '@rnv/core'; import { packageAndroid } from '@rnv/sdk-android'; import { packageBundleForXcode } from '@rnv/sdk-apple'; @@ -58,10 +59,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, task: 'package', params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.run.ts b/packages/engine-rn/src/tasks/task.rnv.run.ts index 4f18987837..1d86c41adb 100644 --- a/packages/engine-rn/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn/src/tasks/task.rnv.run.ts @@ -16,6 +16,7 @@ import { TASK_RUN, getConfigProp, logSummary, + RnvTask, } from '@rnv/core'; import { packageAndroid, runAndroid, getAndroidDeviceToRunOn } from '@rnv/sdk-android'; import { runXcodeProject, getIosDeviceToRunOn } from '@rnv/sdk-apple'; @@ -79,14 +80,14 @@ More info at: https://renative.org/docs/api-cli `); }; -const Task = { +const Task: RnvTask = { description: 'Run your rn app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: TASK_RUN, - dependencies: { - before: TASK_CONFIGURE, - }, + // dependencies: { + // before: TASK_CONFIGURE, + // }, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; diff --git a/packages/engine-rn/src/tasks/task.rnv.start.ts b/packages/engine-rn/src/tasks/task.rnv.start.ts index 711cefc8b6..574d24d1a8 100644 --- a/packages/engine-rn/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn/src/tasks/task.rnv.start.ts @@ -14,6 +14,7 @@ import { ANDROID_WEAR, MACOS, IOS, + RnvTask, } from '@rnv/core'; import { startReactNative } from '@rnv/sdk-react-native'; @@ -48,10 +49,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; + +export default Task; From dfd694d9345d2228755b368817158ce2ffc8fda3 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Tue, 13 Feb 2024 21:22:48 +0100 Subject: [PATCH 10/10] typed task exports for all engines --- packages/core/src/constants.ts | 5 +++++ packages/engine-core/src/tasks/task.rnv.clean.ts | 3 ++- packages/engine-core/src/tasks/task.rnv.help.ts | 4 ++-- packages/engine-core/src/tasks/task.rnv.install.ts | 3 ++- packages/engine-core/src/tasks/task.rnv.link.ts | 3 ++- packages/engine-core/src/tasks/task.rnv.new.ts | 3 ++- .../src/tasks/task.rnv.platform.eject.ts | 2 +- .../engine-core/src/tasks/task.rnv.platform.list.ts | 2 +- .../engine-core/src/tasks/task.rnv.plugin.add.ts | 2 +- .../engine-core/src/tasks/task.rnv.plugin.list.ts | 2 +- .../engine-core/src/tasks/task.rnv.plugin.update.ts | 2 +- packages/engine-core/src/tasks/task.rnv.status.ts | 4 ++-- .../engine-core/src/tasks/task.rnv.target.launch.ts | 2 +- .../engine-core/src/tasks/task.rnv.target.list.ts | 3 ++- .../src/tasks/task.rnv.telemetry.disable.ts | 13 +++++++++++-- .../src/tasks/task.rnv.telemetry.enable.ts | 13 +++++++++++-- .../src/tasks/task.rnv.telemetry.status.ts | 4 ++-- .../engine-core/src/tasks/task.rnv.template.add.ts | 2 +- .../src/tasks/task.rnv.template.apply.ts | 2 +- .../engine-core/src/tasks/task.rnv.template.list.ts | 2 +- packages/engine-core/src/tasks/task.rnv.unlink.ts | 3 ++- .../src/tasks/task.rnv.workspace.configure.ts | 3 ++- .../engine-lightning/src/tasks/task.rnv.build.ts | 3 ++- .../src/tasks/task.rnv.configure.ts | 5 +++-- packages/engine-lightning/src/tasks/task.rnv.run.ts | 2 +- .../engine-rn-electron/src/tasks/task.rnv.build.ts | 5 ++++- .../src/tasks/task.rnv.configure.ts | 5 ++++- .../engine-rn-electron/src/tasks/task.rnv.debug.ts | 8 +++++--- .../engine-rn-electron/src/tasks/task.rnv.deploy.ts | 5 ++++- .../engine-rn-electron/src/tasks/task.rnv.export.ts | 5 ++++- .../src/tasks/task.rnv.package.ts | 5 ++++- .../engine-rn-electron/src/tasks/task.rnv.run.ts | 5 ++++- .../engine-rn-electron/src/tasks/task.rnv.start.ts | 5 ++++- .../engine-rn-macos/src/tasks/task.rnv.build.ts | 5 ++++- .../engine-rn-macos/src/tasks/task.rnv.configure.ts | 7 +++++-- .../engine-rn-macos/src/tasks/task.rnv.deploy.ts | 5 ++++- .../engine-rn-macos/src/tasks/task.rnv.export.ts | 5 ++++- .../engine-rn-macos/src/tasks/task.rnv.package.ts | 7 +++++-- packages/engine-rn-macos/src/tasks/task.rnv.run.ts | 9 +++++---- .../engine-rn-macos/src/tasks/task.rnv.start.ts | 5 ++++- packages/engine-rn-next/src/tasks/task.rnv.build.ts | 5 ++++- .../engine-rn-next/src/tasks/task.rnv.configure.ts | 5 ++++- packages/engine-rn-next/src/tasks/task.rnv.debug.ts | 8 +++++--- .../engine-rn-next/src/tasks/task.rnv.deploy.ts | 5 ++++- .../engine-rn-next/src/tasks/task.rnv.export.ts | 5 ++++- .../engine-rn-next/src/tasks/task.rnv.package.ts | 7 +++++-- packages/engine-rn-next/src/tasks/task.rnv.run.ts | 5 ++++- packages/engine-rn-next/src/tasks/task.rnv.start.ts | 5 ++++- packages/engine-rn-tvos/src/tasks/task.rnv.build.ts | 5 ++++- .../engine-rn-tvos/src/tasks/task.rnv.configure.ts | 7 +++++-- .../src/tasks/task.rnv.crypto.installCerts.ts | 7 +++++-- .../src/tasks/task.rnv.crypto.installProfiles.ts | 7 +++++-- .../src/tasks/task.rnv.crypto.updateProfile.ts | 7 +++++-- .../src/tasks/task.rnv.crypto.updateProfiles.ts | 7 +++++-- packages/engine-rn-tvos/src/tasks/task.rnv.debug.ts | 8 +++++--- .../engine-rn-tvos/src/tasks/task.rnv.deploy.ts | 5 ++++- .../engine-rn-tvos/src/tasks/task.rnv.export.ts | 5 ++++- packages/engine-rn-tvos/src/tasks/task.rnv.log.ts | 8 ++++++-- .../engine-rn-tvos/src/tasks/task.rnv.package.ts | 7 +++++-- packages/engine-rn-tvos/src/tasks/task.rnv.run.ts | 9 +++++---- packages/engine-rn-tvos/src/tasks/task.rnv.start.ts | 5 ++++- packages/engine-rn-web/src/tasks/task.rnv.build.ts | 5 ++++- .../engine-rn-web/src/tasks/task.rnv.configure.ts | 5 ++++- packages/engine-rn-web/src/tasks/task.rnv.debug.ts | 7 +++++-- packages/engine-rn-web/src/tasks/task.rnv.deploy.ts | 5 ++++- packages/engine-rn-web/src/tasks/task.rnv.export.ts | 5 ++++- .../engine-rn-web/src/tasks/task.rnv.package.ts | 7 +++++-- packages/engine-rn-web/src/tasks/task.rnv.run.ts | 5 ++++- packages/engine-rn-web/src/tasks/task.rnv.start.ts | 5 ++++- .../engine-rn-windows/src/tasks/task.rnv.build.ts | 5 ++++- .../src/tasks/task.rnv.configure.ts | 5 ++++- .../engine-rn-windows/src/tasks/task.rnv.debug.ts | 8 +++++--- .../engine-rn-windows/src/tasks/task.rnv.deploy.ts | 5 ++++- .../engine-rn-windows/src/tasks/task.rnv.export.ts | 5 ++++- .../engine-rn-windows/src/tasks/task.rnv.package.ts | 7 +++++-- .../engine-rn-windows/src/tasks/task.rnv.run.ts | 5 ++++- .../engine-rn-windows/src/tasks/task.rnv.start.ts | 5 ++++- packages/engine-rn/src/tasks/task.rnv.configure.ts | 2 +- packages/engine-rn/src/tasks/task.rnv.debug.ts | 4 ++-- packages/engine-rn/src/tasks/task.rnv.log.ts | 3 ++- packages/engine-rn/src/tasks/task.rnv.package.ts | 2 +- 81 files changed, 296 insertions(+), 114 deletions(-) diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 0a8fe4d536..ce867d0574 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -133,6 +133,8 @@ export const TASK_PACKAGE = 'package'; export const TASK_DEPLOY = 'deploy'; export const TASK_LOG = 'log'; export const TASK_CLEAN = 'clean'; +export const TASK_LINK = 'link'; +export const TASK_UNLINK = 'unlink'; export const TASK_INSTALL = 'install'; export const TASK_PUBLISH = 'publish'; export const TASK_STATUS = 'status'; @@ -174,6 +176,9 @@ export const TASK_WORKSPACE_CONFIGURE = 'workspace configure'; export const TASK_CONFIGURE_SOFT = 'configureSoft'; export const TASK_KILL = 'kill'; export const TASK_EJECT = 'eject'; +export const TASK_TELEMETRY_DISABLE = 'telemetry disable'; +export const TASK_TELEMETRY_ENABLE = 'telemetry enable'; +export const TASK_TELEMETRY_STATUS = 'telemetry status'; export const INJECTABLE_CONFIG_PROPS: Array = [ 'id', diff --git a/packages/engine-core/src/tasks/task.rnv.clean.ts b/packages/engine-core/src/tasks/task.rnv.clean.ts index 8507d999a5..255dff46cd 100644 --- a/packages/engine-core/src/tasks/task.rnv.clean.ts +++ b/packages/engine-core/src/tasks/task.rnv.clean.ts @@ -14,6 +14,7 @@ import { RnvTaskFn, inquirerPrompt, RnvTask, + TASK_CLEAN, } from '@rnv/core'; function clearWindowsCacheFiles() { @@ -211,7 +212,7 @@ export const taskRnvClean: RnvTaskFn = async (c) => { const Task: RnvTask = { description: 'Automatically removes all node_modules and lock in your project and its dependencies', fn: taskRnvClean, - task: 'clean', + task: TASK_CLEAN, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.help.ts b/packages/engine-core/src/tasks/task.rnv.help.ts index 9517c8c710..0a01cbe20f 100644 --- a/packages/engine-core/src/tasks/task.rnv.help.ts +++ b/packages/engine-core/src/tasks/task.rnv.help.ts @@ -1,4 +1,4 @@ -import { chalk, logToSummary, logTask, PARAMS, getRegisteredEngines, RnvTaskFn, RnvTask } from '@rnv/core'; +import { chalk, logToSummary, logTask, PARAMS, getRegisteredEngines, RnvTaskFn, RnvTask, TASK_HELP } from '@rnv/core'; export const taskRnvHelp: RnvTaskFn = async (c) => { logTask('taskRnvHelp'); @@ -47,7 +47,7 @@ ${optsString} const Task: RnvTask = { description: 'Display generic help', fn: taskRnvHelp, - task: 'help', + task: TASK_HELP, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.install.ts b/packages/engine-core/src/tasks/task.rnv.install.ts index 6b5992ec33..b370d64e05 100644 --- a/packages/engine-core/src/tasks/task.rnv.install.ts +++ b/packages/engine-core/src/tasks/task.rnv.install.ts @@ -6,6 +6,7 @@ import { logInfo, RnvTaskFn, RnvTask, + TASK_INSTALL, } from '@rnv/core'; export const taskRnvInstall: RnvTaskFn = async (c, parentTask, _) => { @@ -32,7 +33,7 @@ export const taskRnvInstall: RnvTaskFn = async (c, parentTask, _) => { const Task: RnvTask = { description: 'Install package node_modules via yarn or npm', fn: taskRnvInstall, - task: 'install', + task: TASK_INSTALL, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.link.ts b/packages/engine-core/src/tasks/task.rnv.link.ts index 126e290c92..af91b6f9d0 100644 --- a/packages/engine-core/src/tasks/task.rnv.link.ts +++ b/packages/engine-core/src/tasks/task.rnv.link.ts @@ -10,6 +10,7 @@ import { RnvTaskFn, RnvContext, RnvTask, + TASK_LINK, } from '@rnv/core'; import { RNV_PACKAGES } from '../constants'; @@ -42,7 +43,7 @@ export const taskRnvLink: RnvTaskFn = async (c, _parentTask, _originalTask) => { const Task: RnvTask = { description: 'Links development version or renative with this project', fn: taskRnvLink, - task: 'link', + task: TASK_LINK, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.new.ts b/packages/engine-core/src/tasks/task.rnv.new.ts index 50beb32e57..df806c6c8e 100644 --- a/packages/engine-core/src/tasks/task.rnv.new.ts +++ b/packages/engine-core/src/tasks/task.rnv.new.ts @@ -36,6 +36,7 @@ import { commandExistsSync, PromptParams, RnvTask, + TASK_NEW, } from '@rnv/core'; import { ConfigFileProject, ConfigFileTemplate } from '@rnv/core/lib/schema/configFiles/types'; @@ -801,7 +802,7 @@ const findEngineKeyById = (c: RnvContext, id: string) => { const Task: RnvTask = { description: 'Create new ReNative project', fn: taskRnvNew, - task: 'new', + task: TASK_NEW, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.platform.eject.ts b/packages/engine-core/src/tasks/task.rnv.platform.eject.ts index e65eb5801b..dbe402d476 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.eject.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.eject.ts @@ -74,7 +74,7 @@ TIP: You can select options with ${chalk().white('SPACE')} key before pressing E const Task: RnvTask = { description: 'Copy all platform files directly to project', fn: taskRnvPlatformEject, - task: 'platform eject', + task: TASK_PLATFORM_EJECT, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.platform.list.ts b/packages/engine-core/src/tasks/task.rnv.platform.list.ts index faff0d3f6d..aa6e7f6667 100644 --- a/packages/engine-core/src/tasks/task.rnv.platform.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.platform.list.ts @@ -24,7 +24,7 @@ export const taskRnvPlatformList: RnvTaskFn = async (c, _parentTask, originTask) const Task: RnvTask = { description: 'List all available platforms', fn: taskRnvPlatformList, - task: 'platform list', + task: TASK_PLATFORM_LIST, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.plugin.add.ts b/packages/engine-core/src/tasks/task.rnv.plugin.add.ts index 30d18c5e36..807391d6db 100644 --- a/packages/engine-core/src/tasks/task.rnv.plugin.add.ts +++ b/packages/engine-core/src/tasks/task.rnv.plugin.add.ts @@ -105,7 +105,7 @@ export const taskRnvPluginAdd: RnvTaskFn = async (c, _parentTask, originTask) => const Task: RnvTask = { description: 'Add selected plugin to the project', fn: taskRnvPluginAdd, - task: 'plugin add', + task: TASK_PLUGIN_ADD, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.plugin.list.ts b/packages/engine-core/src/tasks/task.rnv.plugin.list.ts index 2d30c5ffd1..c6de97eb65 100644 --- a/packages/engine-core/src/tasks/task.rnv.plugin.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.plugin.list.ts @@ -26,7 +26,7 @@ export const taskRnvPluginList: RnvTaskFn = async (c, _parentTask, originTask) = const Task: RnvTask = { description: 'Show list of all available plugins', fn: taskRnvPluginList, - task: 'plugin list', + task: TASK_PLUGIN_LIST, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.plugin.update.ts b/packages/engine-core/src/tasks/task.rnv.plugin.update.ts index a53230ffc6..bdec8b88b4 100644 --- a/packages/engine-core/src/tasks/task.rnv.plugin.update.ts +++ b/packages/engine-core/src/tasks/task.rnv.plugin.update.ts @@ -52,7 +52,7 @@ export const taskRnvPluginUpdate: RnvTaskFn = async (c, _parentTask, originTask) const Task: RnvTask = { description: 'Update specific plugin to latest supported version (rnv)', fn: taskRnvPluginUpdate, - task: 'plugin update', + task: TASK_PLUGIN_UPDATE, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.status.ts b/packages/engine-core/src/tasks/task.rnv.status.ts index 335d9856a7..88c2bf4799 100644 --- a/packages/engine-core/src/tasks/task.rnv.status.ts +++ b/packages/engine-core/src/tasks/task.rnv.status.ts @@ -1,11 +1,11 @@ -import { PARAMS, RnvTask } from '@rnv/core'; +import { PARAMS, RnvTask, TASK_STATUS } from '@rnv/core'; export const taskRnvStatus = async () => Promise.resolve(); const Task: RnvTask = { description: 'Show current info about the project', fn: taskRnvStatus, - task: 'status', + task: TASK_STATUS, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.target.launch.ts b/packages/engine-core/src/tasks/task.rnv.target.launch.ts index ba4df820c8..5302d26193 100644 --- a/packages/engine-core/src/tasks/task.rnv.target.launch.ts +++ b/packages/engine-core/src/tasks/task.rnv.target.launch.ts @@ -92,7 +92,7 @@ export const taskRnvTargetLaunch: RnvTaskFn = async (c, parentTask, originTask) const Task: RnvTask = { description: 'Launch specific target', fn: taskRnvTargetLaunch, - task: 'target launch', + task: TASK_TARGET_LAUNCH, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.target.list.ts b/packages/engine-core/src/tasks/task.rnv.target.list.ts index a609562d5d..76fb69d22a 100644 --- a/packages/engine-core/src/tasks/task.rnv.target.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.target.list.ts @@ -16,6 +16,7 @@ import { executeTask, RnvTaskFn, RnvTask, + TASK_TARGET_LIST, } from '@rnv/core'; import { listAndroidTargets } from '@rnv/sdk-android'; import { listAppleDevices } from '@rnv/sdk-apple'; @@ -58,7 +59,7 @@ export const taskRnvTargetList: RnvTaskFn = async (c, _parentTask, originTask) = const Task: RnvTask = { description: 'List all available targets for specific platform', fn: taskRnvTargetList, - task: 'target list', + task: TASK_TARGET_LIST, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts b/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts index a8cc69fea8..a672b93023 100644 --- a/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts +++ b/packages/engine-core/src/tasks/task.rnv.telemetry.disable.ts @@ -1,4 +1,13 @@ -import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn, writeFileSync } from '@rnv/core'; +import { + chalk, + logTask, + logToSummary, + PARAMS, + RnvTask, + RnvTaskFn, + TASK_TELEMETRY_DISABLE, + writeFileSync, +} from '@rnv/core'; export const taskRnvTelemetryDisable: RnvTaskFn = async (c) => { logTask('taskRnvTelemetryDisable'); @@ -21,7 +30,7 @@ export const taskRnvTelemetryDisable: RnvTaskFn = async (c) => { const Task: RnvTask = { description: 'Disables rnv telemetry on your machine', fn: taskRnvTelemetryDisable, - task: 'telemetry disable', + task: TASK_TELEMETRY_DISABLE, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts b/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts index f5087ec0b3..32e9b49599 100644 --- a/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts +++ b/packages/engine-core/src/tasks/task.rnv.telemetry.enable.ts @@ -1,4 +1,13 @@ -import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn, writeFileSync } from '@rnv/core'; +import { + chalk, + logTask, + logToSummary, + PARAMS, + RnvTask, + RnvTaskFn, + TASK_TELEMETRY_ENABLE, + writeFileSync, +} from '@rnv/core'; export const taskRnvTelemetryEnable: RnvTaskFn = async (c) => { logTask('taskRnvTelemetryEnable'); @@ -21,7 +30,7 @@ export const taskRnvTelemetryEnable: RnvTaskFn = async (c) => { const Task: RnvTask = { description: 'Enables rnv telemetry on your machine', fn: taskRnvTelemetryEnable, - task: 'telemetry enable', + task: TASK_TELEMETRY_ENABLE, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts b/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts index 8135bf3761..77690eec04 100644 --- a/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts +++ b/packages/engine-core/src/tasks/task.rnv.telemetry.status.ts @@ -1,4 +1,4 @@ -import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn } from '@rnv/core'; +import { chalk, logTask, logToSummary, PARAMS, RnvTask, RnvTaskFn, TASK_TELEMETRY_STATUS } from '@rnv/core'; export const taskRnvTelemetryStatus: RnvTaskFn = async (c) => { logTask('taskRnvTelemetryStatus'); @@ -28,7 +28,7 @@ export const taskRnvTelemetryStatus: RnvTaskFn = async (c) => { const Task: RnvTask = { description: 'Show current rnv telemetry status on your machine', fn: taskRnvTelemetryStatus, - task: 'telemetry status', + task: TASK_TELEMETRY_STATUS, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.template.add.ts b/packages/engine-core/src/tasks/task.rnv.template.add.ts index a7efaf47ab..3e6d72491f 100644 --- a/packages/engine-core/src/tasks/task.rnv.template.add.ts +++ b/packages/engine-core/src/tasks/task.rnv.template.add.ts @@ -57,7 +57,7 @@ export const taskRnvTemplateAdd: RnvTaskFn = async (c, _parentTask, originTask) const Task: RnvTask = { description: 'Install additional template to the project', fn: taskRnvTemplateAdd, - task: 'template add', + task: TASK_TEMPLATE_ADD, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.template.apply.ts b/packages/engine-core/src/tasks/task.rnv.template.apply.ts index 91c3bb3808..70e82ae765 100644 --- a/packages/engine-core/src/tasks/task.rnv.template.apply.ts +++ b/packages/engine-core/src/tasks/task.rnv.template.apply.ts @@ -48,7 +48,7 @@ export const taskRnvTemplateApply: RnvTaskFn = async (c, _parentTask, originTask const Task: RnvTask = { description: 'Reset project to specific template', fn: taskRnvTemplateApply, - task: 'template apply', + task: TASK_TEMPLATE_APPLY, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-core/src/tasks/task.rnv.template.list.ts b/packages/engine-core/src/tasks/task.rnv.template.list.ts index e33fcb4ff5..abd2a649ba 100644 --- a/packages/engine-core/src/tasks/task.rnv.template.list.ts +++ b/packages/engine-core/src/tasks/task.rnv.template.list.ts @@ -24,7 +24,7 @@ export const taskRnvTemplateList: RnvTaskFn = async (c, _parentTask, originTask) const Task: RnvTask = { description: 'Show list of available templates', fn: taskRnvTemplateList, - task: 'template list', + task: TASK_TEMPLATE_LIST, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.unlink.ts b/packages/engine-core/src/tasks/task.rnv.unlink.ts index b9e76ebcfa..661c75e986 100644 --- a/packages/engine-core/src/tasks/task.rnv.unlink.ts +++ b/packages/engine-core/src/tasks/task.rnv.unlink.ts @@ -11,6 +11,7 @@ import { RnvTaskFn, RnvContext, RnvTask, + TASK_UNLINK, } from '@rnv/core'; import { RNV_PACKAGES } from '../constants'; @@ -46,7 +47,7 @@ export const taskRnvUnlink: RnvTaskFn = async (c) => { const Task: RnvTask = { description: 'Replaces rnv version in project with original node_modules version', fn: taskRnvUnlink, - task: 'unlink', + task: TASK_UNLINK, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts b/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts index 950a3159e6..6803901c52 100644 --- a/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts +++ b/packages/engine-core/src/tasks/task.rnv.workspace.configure.ts @@ -14,6 +14,7 @@ import { logInfo, RnvTaskFn, RnvTask, + TASK_WORKSPACE_CONFIGURE, } from '@rnv/core'; export const taskRnvWorkspaceConfigure: RnvTaskFn = async (c) => { @@ -90,7 +91,7 @@ export const taskRnvWorkspaceConfigure: RnvTaskFn = async (c) => { const Task: RnvTask = { description: '', fn: taskRnvWorkspaceConfigure, - task: 'workspace configure', + task: TASK_WORKSPACE_CONFIGURE, params: PARAMS.withBase(), platforms: [], isGlobalScope: true, diff --git a/packages/engine-lightning/src/tasks/task.rnv.build.ts b/packages/engine-lightning/src/tasks/task.rnv.build.ts index 03196dd40c..a9a317c666 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.build.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.build.ts @@ -9,6 +9,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { buildLightningProject } from '../sdks/sdk-lightning'; @@ -31,7 +32,7 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, diff --git a/packages/engine-lightning/src/tasks/task.rnv.configure.ts b/packages/engine-lightning/src/tasks/task.rnv.configure.ts index 3418741619..c05d004418 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.configure.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.configure.ts @@ -8,6 +8,7 @@ import { PARAMS, executeTask, RnvTaskFn, + RnvTask, } from '@rnv/core'; import { configureLightningProject } from '../sdks/sdk-lightning'; @@ -29,10 +30,10 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, - task: 'configure', + task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TIZEN, WEBOS], }; diff --git a/packages/engine-lightning/src/tasks/task.rnv.run.ts b/packages/engine-lightning/src/tasks/task.rnv.run.ts index b75ec7c550..5dcd566355 100644 --- a/packages/engine-lightning/src/tasks/task.rnv.run.ts +++ b/packages/engine-lightning/src/tasks/task.rnv.run.ts @@ -41,7 +41,7 @@ const Task: RnvTask = { description: 'Run your lightning app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, - task: 'run', + task: TASK_RUN, // dependencies: { // before: TASK_CONFIGURE, // }, diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.build.ts b/packages/engine-rn-electron/src/tasks/task.rnv.build.ts index 61dd48994f..5c384fc7ac 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.build.ts @@ -10,6 +10,7 @@ import { logErrorPlatform, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { buildElectron } from '../sdk'; @@ -32,10 +33,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.configure.ts b/packages/engine-rn-electron/src/tasks/task.rnv.configure.ts index 904a203b49..b2dde30e65 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.configure.ts @@ -12,6 +12,7 @@ import { executeTask, shouldSkipTask, configureEntryPoint, + RnvTask, } from '@rnv/core'; import { configureElectronProject } from '../sdk'; @@ -40,10 +41,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.debug.ts b/packages/engine-rn-electron/src/tasks/task.rnv.debug.ts index f04631d86a..afa9e55b2c 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.debug.ts @@ -1,4 +1,4 @@ -import { RnvTaskFn, logErrorPlatform, logTask, MACOS, WINDOWS, LINUX, PARAMS } from '@rnv/core'; +import { RnvTaskFn, logErrorPlatform, logTask, MACOS, WINDOWS, LINUX, PARAMS, RnvTask, TASK_DEBUG } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c) => { logTask('taskRnvDebug'); @@ -10,10 +10,12 @@ export const taskRnvDebug: RnvTaskFn = async (c) => { } }; -export default { +const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, - task: 'debug', + task: TASK_DEBUG, params: PARAMS.withBase(), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.deploy.ts b/packages/engine-rn-electron/src/tasks/task.rnv.deploy.ts index 5841d098b1..a63292b440 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.deploy.ts @@ -9,6 +9,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { @@ -22,10 +23,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment intgeration or buld hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.export.ts b/packages/engine-rn-electron/src/tasks/task.rnv.export.ts index 93899d61a5..0afd9e2884 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.export.ts @@ -10,6 +10,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { exportElectron } from '../sdk'; @@ -31,10 +32,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.package.ts b/packages/engine-rn-electron/src/tasks/task.rnv.package.ts index 023d78f854..1f3b368beb 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.package.ts @@ -8,6 +8,7 @@ import { TASK_CONFIGURE, PARAMS, executeOrSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { @@ -19,10 +20,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.run.ts b/packages/engine-rn-electron/src/tasks/task.rnv.run.ts index 60fe29f233..6291e5f194 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.run.ts @@ -10,6 +10,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { runElectron } from '../sdk'; @@ -34,10 +35,12 @@ export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Run your electron app on your machine', fn: taskRnvRun, task: TASK_RUN, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-electron/src/tasks/task.rnv.start.ts b/packages/engine-rn-electron/src/tasks/task.rnv.start.ts index 9e17bc7766..f33943b524 100644 --- a/packages/engine-rn-electron/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn-electron/src/tasks/task.rnv.start.ts @@ -12,6 +12,7 @@ import { PARAMS, executeTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { openBrowser, waitForHost } from '@rnv/sdk-utils'; @@ -44,10 +45,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS, WINDOWS, LINUX], }; + +export default Task; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.build.ts b/packages/engine-rn-macos/src/tasks/task.rnv.build.ts index 71df7e912f..ec6b44a68f 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.build.ts @@ -9,6 +9,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { buildXcodeProject } from '@rnv/sdk-apple'; @@ -32,10 +33,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS], }; + +export default Task; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.configure.ts b/packages/engine-rn-macos/src/tasks/task.rnv.configure.ts index 165d3c9870..6828e691ad 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.configure.ts @@ -9,6 +9,7 @@ import { executeTask, shouldSkipTask, configureEntryPoint, + RnvTask, } from '@rnv/core'; import { configureXcodeProject } from '@rnv/sdk-apple'; @@ -34,10 +35,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, - task: 'configure', + task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS], }; + +export default Task; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.deploy.ts b/packages/engine-rn-macos/src/tasks/task.rnv.deploy.ts index 22759c2989..96094c376b 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.deploy.ts @@ -7,6 +7,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { @@ -20,10 +21,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment integeration or build hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS], }; + +export default Task; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.export.ts b/packages/engine-rn-macos/src/tasks/task.rnv.export.ts index b27ee27b0e..433698fa43 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.export.ts @@ -8,6 +8,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { exportXcodeProject } from '@rnv/sdk-apple'; @@ -27,10 +28,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS], }; + +export default Task; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.package.ts b/packages/engine-rn-macos/src/tasks/task.rnv.package.ts index b88a799db2..2630e5e024 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.package.ts @@ -9,6 +9,7 @@ import { getConfigProp, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { packageBundleForXcode } from '@rnv/sdk-apple'; @@ -35,10 +36,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, - task: 'package', + task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS], }; + +export default Task; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.run.ts b/packages/engine-rn-macos/src/tasks/task.rnv.run.ts index eb72316aa9..0e611f3d07 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.run.ts @@ -11,6 +11,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { runXcodeProject } from '@rnv/sdk-apple'; import { startBundlerIfRequired, waitForBundlerIfRequired } from '@rnv/sdk-react-native'; @@ -50,14 +51,14 @@ More info at: https://renative.org/docs/api-cli `); }; -const Task = { +const Task: RnvTask = { description: 'Run your macos app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: TASK_RUN, - dependencies: { - before: TASK_CONFIGURE, - }, + // dependencies: { + // before: TASK_CONFIGURE, + // }, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [MACOS], }; diff --git a/packages/engine-rn-macos/src/tasks/task.rnv.start.ts b/packages/engine-rn-macos/src/tasks/task.rnv.start.ts index 222fd716e1..410fd080ff 100644 --- a/packages/engine-rn-macos/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn-macos/src/tasks/task.rnv.start.ts @@ -10,6 +10,7 @@ import { TASK_CONFIGURE_SOFT, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; import { startReactNative } from '@rnv/sdk-react-native'; @@ -47,10 +48,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [MACOS], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.build.ts b/packages/engine-rn-next/src/tasks/task.rnv.build.ts index c9627ef167..60e9d37718 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.build.ts @@ -10,6 +10,7 @@ import { executeOrSkipTask, shouldSkipTask, TASK_EXPORT, + RnvTask, } from '@rnv/core'; import { buildWebNext } from '../sdk'; @@ -35,10 +36,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.configure.ts b/packages/engine-rn-next/src/tasks/task.rnv.configure.ts index 33769b8861..2afc14559d 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.configure.ts @@ -9,6 +9,7 @@ import { PARAMS, executeTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { configureNextIfRequired } from '../sdk'; @@ -32,10 +33,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.debug.ts b/packages/engine-rn-next/src/tasks/task.rnv.debug.ts index ee817edf7b..b46055af15 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.debug.ts @@ -1,4 +1,4 @@ -import { RnvTaskFn, logErrorPlatform, logTask, WEB, CHROMECAST, PARAMS } from '@rnv/core'; +import { RnvTaskFn, logErrorPlatform, logTask, WEB, CHROMECAST, PARAMS, RnvTask, TASK_DEBUG } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { logTask('taskRnvDebug', `parent:${parentTask}`); @@ -10,10 +10,12 @@ export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { } }; -export default { +const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, - task: 'debug', + task: TASK_DEBUG, params: PARAMS.withBase(), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.deploy.ts b/packages/engine-rn-next/src/tasks/task.rnv.deploy.ts index ff5bac5522..e7dc75f11c 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.deploy.ts @@ -9,6 +9,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { deployWebNext } from '../sdk'; @@ -30,10 +31,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment intgeration or buld hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.export.ts b/packages/engine-rn-next/src/tasks/task.rnv.export.ts index 02b06352f8..1034033136 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.export.ts @@ -9,6 +9,7 @@ import { shouldSkipTask, executeOrSkipTask, TASK_BUILD, + RnvTask, } from '@rnv/core'; import { exportWebNext } from '../sdk'; @@ -29,10 +30,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.package.ts b/packages/engine-rn-next/src/tasks/task.rnv.package.ts index 7040d236ca..db683731f8 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.package.ts @@ -7,6 +7,7 @@ import { TASK_CONFIGURE, PARAMS, executeOrSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { @@ -17,10 +18,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, - task: 'package', + task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.run.ts b/packages/engine-rn-next/src/tasks/task.rnv.run.ts index 6c37be0aef..89e96c2ce8 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.run.ts @@ -9,6 +9,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { runWebNext } from '../sdk'; @@ -30,10 +31,12 @@ export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Run your app in browser', fn: taskRnvRun, task: TASK_RUN, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-next/src/tasks/task.rnv.start.ts b/packages/engine-rn-next/src/tasks/task.rnv.start.ts index d00bbfb575..6c7c8a3382 100644 --- a/packages/engine-rn-next/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn-next/src/tasks/task.rnv.start.ts @@ -10,6 +10,7 @@ import { PARAMS, executeTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { runWebNext } from '../sdk'; import { openBrowser, waitForHost } from '@rnv/sdk-utils'; @@ -46,10 +47,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.build.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.build.ts index 084522a5f9..7dee258dc2 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.build.ts @@ -11,6 +11,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { buildReactNativeAndroid } from '@rnv/sdk-react-native'; import { buildXcodeProject } from '@rnv/sdk-apple'; @@ -38,10 +39,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.configure.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.configure.ts index 777812ca2b..d36d49d60f 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.configure.ts @@ -12,6 +12,7 @@ import { executeTask, shouldSkipTask, configureEntryPoint, + RnvTask, } from '@rnv/core'; import { configureGradleProject } from '@rnv/sdk-android'; import { configureXcodeProject } from '@rnv/sdk-apple'; @@ -43,10 +44,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, - task: 'configure', + task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installCerts.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installCerts.ts index df9937ed10..a32c57b00b 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installCerts.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installCerts.ts @@ -10,6 +10,7 @@ import { TASK_CRYPTO_INSTALL_CERTS, TASK_PROJECT_CONFIGURE, PARAMS, + RnvTask, } from '@rnv/core'; export const taskRnvCryptoInstallCerts: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -36,11 +37,13 @@ export const taskRnvCryptoInstallCerts: RnvTaskFn = async (c, _parentTask, origi } }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvCryptoInstallCerts, task: TASK_CRYPTO_INSTALL_CERTS, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installProfiles.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installProfiles.ts index 0aa28d2dc5..18ac74c4fb 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installProfiles.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.installProfiles.ts @@ -14,6 +14,7 @@ import { TASK_CRYPTO_INSTALL_PROFILES, TASK_PROJECT_CONFIGURE, PARAMS, + RnvTask, } from '@rnv/core'; export const taskRnvCryptoInstallProfiles: RnvTaskFn = async (c, _parentTask, originTask) => { @@ -50,11 +51,13 @@ export const taskRnvCryptoInstallProfiles: RnvTaskFn = async (c, _parentTask, or return true; }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvCryptoInstallProfiles, task: TASK_CRYPTO_INSTALL_PROFILES, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfile.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfile.ts index a6d5037948..5db110d58c 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfile.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfile.ts @@ -7,6 +7,7 @@ import { TASK_PROJECT_CONFIGURE, TVOS, PARAMS, + RnvTask, } from '@rnv/core'; import { updateProfile } from '@rnv/sdk-apple'; @@ -20,11 +21,13 @@ export const taskRnvCryptoUpdateProfile: RnvTaskFn = async (c, _parentTask, orig await updateProfile(c); }; -export default { +const Task: RnvTask = { description: 'Update provisioning profile', fn: taskRnvCryptoUpdateProfile, task: TASK_CRYPTO_UPDATE_PROFILE, params: PARAMS.withBase(), platforms: [TVOS], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfiles.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfiles.ts index 4fcc04a138..d5acc5f94f 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfiles.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.crypto.updateProfiles.ts @@ -10,6 +10,7 @@ import { PARAMS, executeTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { updateProfile } from '@rnv/sdk-apple'; @@ -45,11 +46,13 @@ export const taskRnvCryptoUpdateProfiles: RnvTaskFn = async (c, _parentTask, ori return Promise.reject(`updateProfiles: Platform ${c.platform} not supported`); }; -export default { +const Task: RnvTask = { description: '', fn: taskRnvCryptoUpdateProfiles, task: TASK_CRYPTO_UPDATE_PROFILES, params: PARAMS.withBase(), platforms: [], - skipPlatforms: true, + // skipPlatforms: true, }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.debug.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.debug.ts index 372c0d8b03..9eb4dd741e 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.debug.ts @@ -1,4 +1,4 @@ -import { RnvTaskFn, logErrorPlatform, logTask, PARAMS } from '@rnv/core'; +import { RnvTaskFn, logErrorPlatform, logTask, PARAMS, RnvTask, TASK_DEBUG } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { logTask('taskRnvDebug', `parent:${parentTask}`); @@ -10,10 +10,12 @@ export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { } }; -export default { +const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, - task: 'debug', + task: TASK_DEBUG, params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.deploy.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.deploy.ts index 814e3845e8..ce4e0a36df 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.deploy.ts @@ -9,6 +9,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { @@ -22,10 +23,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment intgeration or buld hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.export.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.export.ts index 8842cc1fa0..b1057746e7 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.export.ts @@ -10,6 +10,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { exportXcodeProject } from '@rnv/sdk-apple'; @@ -33,10 +34,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.log.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.log.ts index 3670a46e9f..127be327a2 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.log.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.log.ts @@ -9,6 +9,8 @@ import { executeTask, logErrorPlatform, RnvTaskFn, + RnvTask, + TASK_LOG, } from '@rnv/core'; import { runAppleLog } from '@rnv/sdk-apple'; @@ -31,11 +33,13 @@ export const taskRnvLog: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Attach logger to device or emulator and print out logs', fn: taskRnvLog, - task: 'log', + task: TASK_LOG, params: PARAMS.withBase(), platforms: [TVOS, ANDROID_TV, FIRE_TV], isGlobalScope: true, }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.package.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.package.ts index 102a6c397f..ec80d7806a 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.package.ts @@ -12,6 +12,7 @@ import { executeOrSkipTask, shouldSkipTask, TASK_EJECT, + RnvTask, } from '@rnv/core'; import { packageAndroid } from '@rnv/sdk-android'; import { packageBundleForXcode } from '@rnv/sdk-apple'; @@ -50,10 +51,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, - task: 'package', + task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; + +export default Task; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts index 16578a496a..d924a51c80 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.run.ts @@ -13,6 +13,7 @@ import { logErrorPlatform, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { packageAndroid, runAndroid, getAndroidDeviceToRunOn } from '@rnv/sdk-android'; import { runXcodeProject, getIosDeviceToRunOn } from '@rnv/sdk-apple'; @@ -71,14 +72,14 @@ More info at: https://renative.org/docs/api-cli `); }; -const Task = { +const Task: RnvTask = { description: 'Run your tv app on target device or emulator', fn: taskRnvRun, fnHelp: taskRnvRunHelp, task: TASK_RUN, - dependencies: { - before: TASK_CONFIGURE, - }, + // dependencies: { + // before: TASK_CONFIGURE, + // }, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; diff --git a/packages/engine-rn-tvos/src/tasks/task.rnv.start.ts b/packages/engine-rn-tvos/src/tasks/task.rnv.start.ts index 06f63592e2..94e6ffba00 100644 --- a/packages/engine-rn-tvos/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn-tvos/src/tasks/task.rnv.start.ts @@ -14,6 +14,7 @@ import { TASK_CONFIGURE_SOFT, PARAMS, RnvTaskFn, + RnvTask, } from '@rnv/core'; import { startReactNative } from '@rnv/sdk-react-native'; @@ -55,10 +56,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [TVOS, ANDROID_TV, FIRE_TV], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.build.ts b/packages/engine-rn-web/src/tasks/task.rnv.build.ts index 64d5e69973..5fd8641c18 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.build.ts @@ -15,6 +15,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { buildWeb } from '@rnv/sdk-webpack'; import { buildTizenProject } from '@rnv/sdk-tizen'; @@ -55,10 +56,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, WEBTV, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.configure.ts b/packages/engine-rn-web/src/tasks/task.rnv.configure.ts index b09a9e5316..66b296590a 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.configure.ts @@ -17,6 +17,7 @@ import { executeTask, shouldSkipTask, configureEntryPoint, + RnvTask, } from '@rnv/core'; import { configureWebProject, configureChromecastProject } from '@rnv/sdk-webpack'; import { configureKaiOSProject } from '@rnv/sdk-kaios'; @@ -55,10 +56,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, WEBTV, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.debug.ts b/packages/engine-rn-web/src/tasks/task.rnv.debug.ts index 317aa286a5..cadcab59aa 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.debug.ts @@ -9,6 +9,7 @@ import { TASK_DEBUG, executeAsync, shouldSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c, parentTask, originTask) => { @@ -28,10 +29,12 @@ export const taskRnvDebug: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, - task: 'debug', + task: TASK_DEBUG, params: PARAMS.withBase(), platforms: [WEB, WEBTV, TIZEN], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.deploy.ts b/packages/engine-rn-web/src/tasks/task.rnv.deploy.ts index 30bff1d00f..f4f8339b5e 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.deploy.ts @@ -15,6 +15,7 @@ import { PARAMS, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { deployWeb } from '@rnv/sdk-webpack'; @@ -37,10 +38,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment intgeration or buld hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, WEBTV, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.export.ts b/packages/engine-rn-web/src/tasks/task.rnv.export.ts index a0283e36f1..a6ca33f9a2 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.export.ts @@ -15,6 +15,7 @@ import { executeOrSkipTask, shouldSkipTask, WEBTV, + RnvTask, } from '@rnv/core'; import { exportWeb } from '@rnv/sdk-webpack'; @@ -43,10 +44,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.package.ts b/packages/engine-rn-web/src/tasks/task.rnv.package.ts index ffb789df59..82de911034 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.package.ts @@ -12,6 +12,7 @@ import { TASK_CONFIGURE, PARAMS, executeOrSkipTask, + RnvTask, } from '@rnv/core'; export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { @@ -22,10 +23,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { return true; }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, - task: 'package', + task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.run.ts b/packages/engine-rn-web/src/tasks/task.rnv.run.ts index 83336c73c9..069684d7f4 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.run.ts @@ -23,6 +23,7 @@ import { executeTask, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import ip from 'ip'; import path from 'path'; @@ -108,10 +109,12 @@ export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Run your app in browser', fn: taskRnvRun, task: TASK_RUN, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [WEB, WEBTV, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-web/src/tasks/task.rnv.start.ts b/packages/engine-rn-web/src/tasks/task.rnv.start.ts index 21b53fe034..7af4ffa004 100644 --- a/packages/engine-rn-web/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn-web/src/tasks/task.rnv.start.ts @@ -19,6 +19,7 @@ import { PARAMS, executeTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { openBrowser, waitForHost } from '@rnv/sdk-utils'; @@ -62,10 +63,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WEB, WEBTV, TIZEN, WEBOS, TIZEN_MOBILE, TIZEN_WATCH, KAIOS, CHROMECAST], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.build.ts b/packages/engine-rn-windows/src/tasks/task.rnv.build.ts index 44b5ea15af..c3f32142f2 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.build.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.build.ts @@ -9,6 +9,7 @@ import { PARAMS, logTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { ruWindowsProject } from '../sdks/sdk-windows'; @@ -29,10 +30,12 @@ export const taskRnvBuild: RnvTaskFn = async (c, _parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Build project binary', fn: taskRnvBuild, task: TASK_BUILD, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.configure.ts b/packages/engine-rn-windows/src/tasks/task.rnv.configure.ts index 4378363639..42cb101c28 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.configure.ts @@ -11,6 +11,7 @@ import { configureEntryPoint, executeTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { SDKWindows } from '../sdks'; @@ -38,10 +39,12 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => } }; -export default { +const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.debug.ts b/packages/engine-rn-windows/src/tasks/task.rnv.debug.ts index d5cc643f9c..f2d3ac2c11 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.debug.ts @@ -1,4 +1,4 @@ -import { logErrorPlatform, logTask, PARAMS, RnvTaskFn } from '@rnv/core'; +import { logErrorPlatform, logTask, PARAMS, RnvTask, RnvTaskFn, TASK_DEBUG } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { logTask('taskRnvDebug', `parent:${parentTask}`); @@ -10,10 +10,12 @@ export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { } }; -export default { +const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, - task: 'debug', + task: TASK_DEBUG, params: PARAMS.withBase(), platforms: [], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.deploy.ts b/packages/engine-rn-windows/src/tasks/task.rnv.deploy.ts index e490df5baa..8587bfff8a 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.deploy.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.deploy.ts @@ -9,6 +9,7 @@ import { TASK_EXPORT, TASK_DEPLOY, executeOrSkipTask, + RnvTask, } from '@rnv/core'; import { SDKWindows } from '../sdks'; @@ -33,10 +34,12 @@ export const taskRnvDeploy: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Deploy the binary via selected deployment intgeration or buld hook', fn: taskRnvDeploy, task: TASK_DEPLOY, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.export.ts b/packages/engine-rn-windows/src/tasks/task.rnv.export.ts index de38dccacc..0954a96bae 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.export.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.export.ts @@ -9,6 +9,7 @@ import { TASK_EXPORT, executeOrSkipTask, shouldSkipTask, + RnvTask, } from '@rnv/core'; import { SDKWindows } from '../sdks'; @@ -34,10 +35,12 @@ export const taskRnvExport: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Export the app into deployable binary', fn: taskRnvExport, task: TASK_EXPORT, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.package.ts b/packages/engine-rn-windows/src/tasks/task.rnv.package.ts index d3e2e8c1c4..be5851ec45 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.package.ts @@ -10,6 +10,7 @@ import { shouldSkipTask, getConfigProp, TASK_PACKAGE, + RnvTask, } from '@rnv/core'; import { SDKWindows } from '../sdks'; @@ -39,10 +40,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, - task: 'package', + task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.run.ts b/packages/engine-rn-windows/src/tasks/task.rnv.run.ts index 000151abaa..c01e88b8a5 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.run.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.run.ts @@ -9,6 +9,7 @@ import { executeOrSkipTask, shouldSkipTask, TASK_RUN, + RnvTask, } from '@rnv/core'; import { SDKWindows } from '../sdks'; import { startBundlerIfRequired, waitForBundlerIfRequired } from '@rnv/sdk-react-native'; @@ -38,10 +39,12 @@ export const taskRnvRun: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Run your app in a window on desktop', fn: taskRnvRun, task: TASK_RUN, params: PARAMS.withBase(PARAMS.withConfigure(PARAMS.withRun())), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn-windows/src/tasks/task.rnv.start.ts b/packages/engine-rn-windows/src/tasks/task.rnv.start.ts index a218502fb7..bdcce7c26f 100644 --- a/packages/engine-rn-windows/src/tasks/task.rnv.start.ts +++ b/packages/engine-rn-windows/src/tasks/task.rnv.start.ts @@ -11,6 +11,7 @@ import { TASK_START, TASK_CONFIGURE_SOFT, logError, + RnvTask, } from '@rnv/core'; import { startReactNative } from '@rnv/sdk-react-native'; @@ -50,10 +51,12 @@ export const taskRnvStart: RnvTaskFn = async (c, parentTask, originTask) => { } }; -export default { +const Task: RnvTask = { description: 'Starts bundler / server', fn: taskRnvStart, task: TASK_START, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [WINDOWS, XBOX], }; + +export default Task; diff --git a/packages/engine-rn/src/tasks/task.rnv.configure.ts b/packages/engine-rn/src/tasks/task.rnv.configure.ts index 42ecbd2d90..293b9e6594 100644 --- a/packages/engine-rn/src/tasks/task.rnv.configure.ts +++ b/packages/engine-rn/src/tasks/task.rnv.configure.ts @@ -57,7 +57,7 @@ export const taskRnvConfigure: RnvTaskFn = async (c, parentTask, originTask) => const Task: RnvTask = { description: 'Configure current project', fn: taskRnvConfigure, - task: 'configure', + task: TASK_CONFIGURE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], }; diff --git a/packages/engine-rn/src/tasks/task.rnv.debug.ts b/packages/engine-rn/src/tasks/task.rnv.debug.ts index a967b72252..f2d3ac2c11 100644 --- a/packages/engine-rn/src/tasks/task.rnv.debug.ts +++ b/packages/engine-rn/src/tasks/task.rnv.debug.ts @@ -1,4 +1,4 @@ -import { logErrorPlatform, logTask, PARAMS, RnvTask, RnvTaskFn } from '@rnv/core'; +import { logErrorPlatform, logTask, PARAMS, RnvTask, RnvTaskFn, TASK_DEBUG } from '@rnv/core'; export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { logTask('taskRnvDebug', `parent:${parentTask}`); @@ -13,7 +13,7 @@ export const taskRnvDebug: RnvTaskFn = async (c, parentTask) => { const Task: RnvTask = { description: 'Debug your app on target device or emulator', fn: taskRnvDebug, - task: 'debug', + task: TASK_DEBUG, params: PARAMS.withBase(), platforms: [], }; diff --git a/packages/engine-rn/src/tasks/task.rnv.log.ts b/packages/engine-rn/src/tasks/task.rnv.log.ts index 5e3ed05e61..d96bdce763 100644 --- a/packages/engine-rn/src/tasks/task.rnv.log.ts +++ b/packages/engine-rn/src/tasks/task.rnv.log.ts @@ -12,6 +12,7 @@ import { TASK_WORKSPACE_CONFIGURE, TASK_PROJECT_CONFIGURE, RnvTask, + TASK_LOG, } from '@rnv/core'; import { runAndroidLog, checkAndConfigureAndroidSdks } from '@rnv/sdk-android'; import { runAppleLog } from '@rnv/sdk-apple'; @@ -40,7 +41,7 @@ export const taskRnvLog: RnvTaskFn = async (c, parentTask, originTask) => { const Task: RnvTask = { description: 'Attach logger to device or emulator and print out logs', fn: taskRnvLog, - task: 'log', + task: TASK_LOG, params: PARAMS.withBase(), platforms: [IOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], isGlobalScope: true, diff --git a/packages/engine-rn/src/tasks/task.rnv.package.ts b/packages/engine-rn/src/tasks/task.rnv.package.ts index 8227f5852a..4c36176edb 100644 --- a/packages/engine-rn/src/tasks/task.rnv.package.ts +++ b/packages/engine-rn/src/tasks/task.rnv.package.ts @@ -62,7 +62,7 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => { const Task: RnvTask = { description: 'Package source files into bundle', fn: taskRnvPackage, - task: 'package', + task: TASK_PACKAGE, params: PARAMS.withBase(PARAMS.withConfigure()), platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR], };