From d838183c9c96ec5db3bf65339ea4e93f5912f3f9 Mon Sep 17 00:00:00 2001 From: ElenaDiachenko Date: Tue, 27 Aug 2024 10:26:30 +0300 Subject: [PATCH 1/3] add --local-template-path / --localTemplatePath option to rnv new --- packages/engine-core/src/taskOptions.ts | 6 ++++++ .../src/tasks/bootstrap/questions/installTemplate.ts | 6 +++--- packages/engine-core/src/tasks/bootstrap/taskNew.ts | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/engine-core/src/taskOptions.ts b/packages/engine-core/src/taskOptions.ts index c25568bdf..2b829bc69 100644 --- a/packages/engine-core/src/taskOptions.ts +++ b/packages/engine-core/src/taskOptions.ts @@ -51,6 +51,12 @@ export const TaskOptions = createTaskOptionsMap([ isValueType: true, description: 'select the template version', }, + { + key: 'local-template-path', + altKey: 'localTemplatePath', + isValueType: true, + description: 'select the local template path (absolute)', + }, { key: 'title', isValueType: true, diff --git a/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts b/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts index 1e2f515d1..b54cec02c 100644 --- a/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts +++ b/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts @@ -45,6 +45,7 @@ const Question = async (data: NewProjectData) => { const c = getContext(); const { templateVersion, projectTemplate } = c.program.opts(); + let { localTemplatePath } = c.program.opts(); const projectTemplates = c.buildConfig.projectTemplates || {}; // c.files.rnvConfigTemplates.config?.projectTemplates || {}; @@ -66,13 +67,12 @@ const Question = async (data: NewProjectData) => { options.push(customTemplate); options.push(localTemplate); options.push(noTemplate); - let localTemplatePath: string | undefined; inputs.template = {}; if (checkInputValue(projectTemplate)) { inputs.template.packageName = projectTemplate; - } else { + } else if (!checkInputValue(localTemplatePath)) { const iRes = await inquirerPrompt({ name: 'inputTemplate', type: 'list', @@ -112,7 +112,7 @@ const Question = async (data: NewProjectData) => { const npmCacheDir = path.join(c.paths.project.dir, RnvFolderName.dotRnv, RnvFolderName.npmCache); - if (localTemplatePath) { + if (checkInputValue(localTemplatePath)) { if (!fsExistsSync(localTemplatePath)) { return Promise.reject(`Local template path ${localTemplatePath} does not exist`); } diff --git a/packages/engine-core/src/tasks/bootstrap/taskNew.ts b/packages/engine-core/src/tasks/bootstrap/taskNew.ts index 2bae994ab..9dedbc531 100644 --- a/packages/engine-core/src/tasks/bootstrap/taskNew.ts +++ b/packages/engine-core/src/tasks/bootstrap/taskNew.ts @@ -95,6 +95,7 @@ export default createTask({ TaskOptions.projectName, TaskOptions.projectTemplate, TaskOptions.templateVersion, + TaskOptions.localTemplatePath, TaskOptions.title, TaskOptions.appVersion, TaskOptions.id, From 34a93cc2311891f80df622780e07349906cf2f4f Mon Sep 17 00:00:00 2001 From: ElenaDiachenko Date: Wed, 28 Aug 2024 13:11:49 +0300 Subject: [PATCH 2/3] fix existing local template --- .../bootstrap/questions/installTemplate.ts | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts b/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts index b54cec02c..65d95b480 100644 --- a/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts +++ b/packages/engine-core/src/tasks/bootstrap/questions/installTemplate.ts @@ -48,31 +48,33 @@ const Question = async (data: NewProjectData) => { let { localTemplatePath } = c.program.opts(); const projectTemplates = c.buildConfig.projectTemplates || {}; // c.files.rnvConfigTemplates.config?.projectTemplates || {}; - - const options: TemplateOption[] = []; - let defaultOverride; - Object.keys(projectTemplates).forEach((k) => { - const value = projectTemplates[k]; - const option: TemplateOption = { - name: `${k} ${chalk().grey(`- ${value.localPath || value.description}`)}`, - value: { ...value, type: 'existing', packageName: value?.packageName || k }, - }; - options.push(option); - if (value.localPath) { - defaultOverride = option.value; - } - }); - - options.push(inquirerSeparator('Advanced:----------------')); - options.push(customTemplate); - options.push(localTemplate); - options.push(noTemplate); + const projectTemplateKeys = Object.keys(projectTemplates); inputs.template = {}; if (checkInputValue(projectTemplate)) { inputs.template.packageName = projectTemplate; } else if (!checkInputValue(localTemplatePath)) { + const options: TemplateOption[] = []; + let defaultOverride; + projectTemplateKeys.forEach((k) => { + const value = projectTemplates[k]; + + const option: TemplateOption = { + name: `${k} ${chalk().grey(`- ${value.localPath || value.description}`)}`, + value: { ...value, type: 'existing', packageName: value?.packageName || k }, + }; + options.push(option); + if (value.localPath) { + defaultOverride = option.value; + } + }); + + options.push(inquirerSeparator('Advanced:----------------')); + options.push(customTemplate); + options.push(localTemplate); + options.push(noTemplate); + const iRes = await inquirerPrompt({ name: 'inputTemplate', type: 'list', @@ -136,6 +138,12 @@ const Question = async (data: NewProjectData) => { inputs.template.packageName = pkg.name; inputs.template.version = pkg.version; inputs.template.localPath = localTemplatePath; + projectTemplateKeys.find((tpl) => { + const value = projectTemplates[tpl]; + if (value.localPath === localTemplatePath && inputs.template) { + inputs.template.type = 'existing'; + } + }); if (!inputs.template) return; From 6d82cab9aab55e9fa1b904a4c3508d2f73b2e8d5 Mon Sep 17 00:00:00 2001 From: pauliusguzas Date: Thu, 29 Aug 2024 11:01:42 +0300 Subject: [PATCH 3/3] chore: update e2e timeouts --- .github/workflows/e2e-harness-ios.yml | 2 +- .github/workflows/e2e-harness-tvos.yml | 2 +- .github/workflows/e2e-template-ios.yml | 2 +- .github/workflows/e2e-template-tvos.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-harness-ios.yml b/.github/workflows/e2e-harness-ios.yml index ad6ff8dc7..dadd873b4 100644 --- a/.github/workflows/e2e-harness-ios.yml +++ b/.github/workflows/e2e-harness-ios.yml @@ -34,7 +34,7 @@ jobs: yarn bootstrap - name: Run run: | - cd packages/app-harness && yarn run:ios-test & sleep 480 + cd packages/app-harness && yarn run:ios-test & sleep 600 - name: E2E run: | cd packages/app-harness && yarn e2e:ios && kill $(lsof -t -i:8092) diff --git a/.github/workflows/e2e-harness-tvos.yml b/.github/workflows/e2e-harness-tvos.yml index a8507fc75..d7cce54b0 100644 --- a/.github/workflows/e2e-harness-tvos.yml +++ b/.github/workflows/e2e-harness-tvos.yml @@ -34,7 +34,7 @@ jobs: yarn bootstrap - name: Run run: | - cd packages/app-harness && yarn run:tvos-test & sleep 420 + cd packages/app-harness && yarn run:tvos-test & sleep 540 - name: E2E run: | cd packages/app-harness && yarn e2e:tvos && kill $(lsof -t -i:8099) diff --git a/.github/workflows/e2e-template-ios.yml b/.github/workflows/e2e-template-ios.yml index 96d208014..0f5192c2b 100644 --- a/.github/workflows/e2e-template-ios.yml +++ b/.github/workflows/e2e-template-ios.yml @@ -34,7 +34,7 @@ jobs: yarn bootstrap - name: Run run: | - cd packages/template-starter && yarn run:ios-test & sleep 540 + cd packages/template-starter && yarn run:ios-test & sleep 600 - name: E2E run: | cd packages/template-starter && yarn e2e:ios && kill $(lsof -t -i:8082) diff --git a/.github/workflows/e2e-template-tvos.yml b/.github/workflows/e2e-template-tvos.yml index 8ae944566..01b2a3456 100644 --- a/.github/workflows/e2e-template-tvos.yml +++ b/.github/workflows/e2e-template-tvos.yml @@ -34,7 +34,7 @@ jobs: yarn bootstrap - name: Run run: | - cd packages/template-starter && yarn run:tvos-test & sleep 420 + cd packages/template-starter && yarn run:tvos-test & sleep 540 - name: E2E run: | cd packages/template-starter && yarn e2e:tvos && kill $(lsof -t -i:8085)