Merge pull request #2938 from abpframework/Allow-to-download-react-native-mobile-ui

Allow to download react native mobile ui
pull/2947/head
Yunus Emre Kalkan 5 years ago committed by GitHub
commit 97eaa6ff5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -154,6 +154,8 @@
"SeeTheDocumentForMoreInformation": "See the <a href=\"{1}\">{0} document</a> for more information",
"IndexPageHeroSection": "<span class=\"first-line shine\"><strong>open source</strong></span><span class=\"second-line text-uppercase\">Web Application<br />Framework </span><span class=\"third-line shine2\"><strong>for asp.net core</strong></span>",
"UiFramework": "UI Framework",
"EmailAddress": "Email address"
"EmailAddress": "Email address",
"Mobile": "Mobile",
"ReactNative": "React Native"
}
}

@ -76,6 +76,7 @@ namespace Volo.Abp.Cli.Commands
version,
DatabaseProvider.NotSpecified,
UiFramework.NotSpecified,
MobileApp.None,
gitHubLocalRepositoryPath,
commandLineArgs.Options
)

@ -67,6 +67,12 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("UI Framework: " + uiFramework);
}
var mobileApp = GetMobilePreference(commandLineArgs);
if (mobileApp != MobileApp.None)
{
Logger.LogInformation("Mobile App: " + mobileApp);
}
var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long);
if (gitHubLocalRepositoryPath != null)
{
@ -94,6 +100,7 @@ namespace Volo.Abp.Cli.Commands
version,
databaseProvider,
uiFramework,
mobileApp,
gitHubLocalRepositoryPath,
commandLineArgs.Options
)
@ -208,6 +215,20 @@ namespace Volo.Abp.Cli.Commands
}
}
private MobileApp GetMobilePreference(CommandLineArgs commandLineArgs)
{
var optionValue = commandLineArgs.Options.GetOrNull(Options.Mobile.Short, Options.Mobile.Long);
switch (optionValue)
{
case "none":
return MobileApp.None;
case "react-native":
return MobileApp.ReactNative;
default:
return MobileApp.ReactNative;
}
}
public static class Options
{
public static class Template
@ -244,6 +265,12 @@ namespace Volo.Abp.Cli.Commands
public const string Short = "u";
public const string Long = "ui";
}
public static class Mobile
{
public const string Short = "m";
public const string Long = "mobile";
}
}
}
}

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli.Licensing;

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volo.Abp.Cli.ProjectBuilding.Building
{
public enum MobileApp
{
None,
ReactNative
}
public static class MobileAppExtensions{
public static string GetFolderName(this MobileApp mobileApp)
{
switch (mobileApp)
{
case MobileApp.ReactNative:
return "react-native";
default:
return null;
}
}
}
}

@ -19,6 +19,8 @@ namespace Volo.Abp.Cli.ProjectBuilding
public UiFramework UiFramework { get; set; }
public MobileApp MobileApp { get; set; }
[CanBeNull]
public string AbpGitHubLocalRepositoryPath { get; set; }
@ -31,6 +33,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
[CanBeNull] string version = null,
DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified,
UiFramework uiFramework = UiFramework.NotSpecified,
MobileApp mobileApp = MobileApp.ReactNative,
[CanBeNull] string abpGitHubLocalRepositoryPath = null,
Dictionary<string, string> extraProperties = null)
{
@ -39,6 +42,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
Version = version;
DatabaseProvider = databaseProvider;
UiFramework = uiFramework;
MobileApp = mobileApp;
AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath;
ExtraProperties = extraProperties ?? new Dictionary<string, string>();
}

@ -88,6 +88,8 @@ namespace Volo.Abp.Cli.ProjectBuilding
!x.Key.Equals(NewCommand.Options.OutputFolder.Short, StringComparison.InvariantCultureIgnoreCase))
.Where(x => !x.Key.Equals(NewCommand.Options.UiFramework.Long, StringComparison.InvariantCultureIgnoreCase) &&
!x.Key.Equals(NewCommand.Options.UiFramework.Short, StringComparison.InvariantCultureIgnoreCase))
.Where(x => !x.Key.Equals(NewCommand.Options.Mobile.Long, StringComparison.InvariantCultureIgnoreCase) &&
!x.Key.Equals(NewCommand.Options.Mobile.Short, StringComparison.InvariantCultureIgnoreCase))
.Where(x => !x.Key.Equals(NewCommand.Options.Version.Long, StringComparison.InvariantCultureIgnoreCase) &&
!x.Key.Equals(NewCommand.Options.Version.Short, StringComparison.InvariantCultureIgnoreCase))
.Select(x => x.Key).ToList();

@ -74,6 +74,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
{
steps.Add(new RemoveFolderStep("/angular"));
}
if (context.BuildArgs.MobileApp != MobileApp.ReactNative)
{
steps.Add(new RemoveFolderStep(MobileApp.ReactNative.GetFolderName()?.EnsureStartsWith('/')));
}
}
private static void ConfigureWithoutUi(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
@ -156,7 +161,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
private static void CleanupFolderHierarchy(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
{
if (context.BuildArgs.UiFramework == UiFramework.Mvc)
if (context.BuildArgs.UiFramework == UiFramework.Mvc && context.BuildArgs.MobileApp == MobileApp.None)
{
steps.Add(new MoveFolderStep("/aspnet-core/", "/"));
}

@ -44,6 +44,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates
)
.ToList();
var reactNativeEnvironments = context.Files.Where(x =>
!x.IsDirectory &&
x.Name.EndsWith($"{MobileApp.ReactNative.GetFolderName()}/Environment.js", StringComparison.InvariantCultureIgnoreCase)
)
.ToList();
if (AppTemplateBase.IsAppTemplate(context.Template.Name))
{
// no tiered
@ -127,6 +133,20 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates
environment.SetLines(environmentLines);
}
foreach (var environment in reactNativeEnvironments)
{
environment.NormalizeLineEndings();
var environmentLines = environment.GetLines();
for (var i = 0; i < environmentLines.Length; i++)
{
if (environmentLines[i].Contains(buildInUrl))
{
environmentLines[i] = environmentLines[i].Replace(buildInUrl, $"{buildInUrlWithoutPort}:{newPort}");
}
}
environment.SetLines(environmentLines);
}
}
}
}

Loading…
Cancel
Save