Merge pull request #7864 from abpframework/auto-merge/rel-4-2/172

Merge branch dev with rel-4.2
pull/7866/head
maliming 5 years ago committed by GitHub
commit 34916da469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,7 +50,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
return;
}
//Begin a new, independent unit of work
using (var uow = unitOfWorkManager.Begin(options))
{
var result = await next();
@ -58,6 +57,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
{
await uow.CompleteAsync(context.HttpContext.RequestAborted);
}
else
{
await uow.RollbackAsync(context.HttpContext.RequestAborted);
}
}
}

@ -55,7 +55,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
return;
}
//Begin a new, independent unit of work
using (var uow = unitOfWorkManager.Begin(options))
{
var result = await next();
@ -63,6 +62,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow
{
await uow.CompleteAsync(context.HttpContext.RequestAborted);
}
else
{
await uow.RollbackAsync(context.HttpContext.RequestAborted);
}
}
}

@ -34,7 +34,8 @@ namespace Volo.Abp.Cli.ProjectModification
}
await AddPathsToTsConfigAsync(angularPath, angularProjectsPath, projects);
await CreateTsConfigProdJsonAsync(angularPath);
await AddScriptsToPackageJsonAsync(angularPath);
await AddProjectToAngularJsonAsync(angularPath, projects);
}
catch (Exception e)
@ -93,6 +94,61 @@ namespace Volo.Abp.Cli.ProjectModification
File.WriteAllText(angularJsonFilePath, json.ToString(Formatting.Indented));
}
private async Task AddScriptsToPackageJsonAsync(string angularPath)
{
var packageJsonFilePath = Path.Combine(angularPath, "package.json");
var fileContent = File.ReadAllText(packageJsonFilePath);
var json = JObject.Parse(fileContent);
var scriptsJobject = (JObject) json["scripts"];
if (scriptsJobject == null || scriptsJobject["postinstall"] != null || scriptsJobject["compile:ivy"] != null)
{
return;
}
scriptsJobject["postinstall"] = "npm run compile:ivy";
scriptsJobject["compile:ivy"] = "yarn ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points --tsconfig './tsconfig.prod.json' --source node_modules";
File.WriteAllText(packageJsonFilePath, json.ToString(Formatting.Indented));
}
private async Task CreateTsConfigProdJsonAsync(string angularPath)
{
var tsConfigProdJsonFilePath = Path.Combine(angularPath, "tsconfig.prod.json");
if (File.Exists(tsConfigProdJsonFilePath))
{
return;
}
var json = new JObject(
new JProperty("compileOnSave", false),
new JProperty("compilerOptions", new JObject(
new JProperty("baseUrl", "./"),
new JProperty("outDir", "./dist/out-tsc"),
new JProperty("sourceMap", true),
new JProperty("declaration", false),
new JProperty("downlevelIteration", true),
new JProperty("experimentalDecorators", true),
new JProperty("module", "esnext"),
new JProperty("moduleResolution", "node"),
new JProperty("importHelpers", true),
new JProperty("target", "es2015"),
new JProperty("typeRoots", new JArray(new JValue("node_modules/@types"))),
new JProperty("lib", new JArray(new JValue("es2018"), new JValue("dom"))),
new JProperty("types", new JArray(new JValue("jest")))
)),
new JProperty("angularCompilerOptions", new JObject(
new JProperty("fullTemplateTypeCheck", true),
new JProperty("strictInjectionParameters", true)
))
);
File.WriteAllText(tsConfigProdJsonFilePath, json.ToString(Formatting.Indented));
}
private async Task AddPathsToTsConfigAsync(string angularPath, string angularProjectsPath,
List<string> projects)
{
@ -105,7 +161,8 @@ namespace Volo.Abp.Cli.ProjectModification
{
var projectPackageName = await GetProjectPackageNameAsync(angularProjectsPath, project);
var publicApis = Directory.GetFiles(Path.Combine(angularProjectsPath, project), "*public-api.ts", SearchOption.AllDirectories)
var publicApis = Directory.GetFiles(Path.Combine(angularProjectsPath, project), "*public-api.ts",
SearchOption.AllDirectories)
.Where(p => !p.Contains("\\node_modules\\"))
.Select(p => p.RemovePreFix(angularPath).Replace("\\", "/").RemovePreFix("/"));
@ -171,8 +228,10 @@ namespace Volo.Abp.Cli.ProjectModification
{
continue;
}
Directory.Move(folderUnderProject, Path.Combine(folder, Path.GetFileName(folderUnderProject)));
}
projectsInFolder = Directory.GetDirectories(folder);
}

Loading…
Cancel
Save