Browse Source

remove: `AddScriptsToPackageJsonAsync` function that uses redundant ngcc compilation method

pull/23384/head
sumeyye 7 months ago
parent
commit
e492ececa5
  1. 24
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs

24
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularSourceCodeAdder.cs

@ -36,7 +36,6 @@ public class AngularSourceCodeAdder : ITransientDependency
await AddPathsToTsConfigAsync(angularPath, angularProjectsPath, projects);
await CreateTsConfigProdJsonAsync(angularPath);
await AddScriptsToPackageJsonAsync(angularPath);
await AddProjectsToAngularJsonAsync(angularPath, projects);
}
catch (Exception e)
@ -58,7 +57,6 @@ public class AngularSourceCodeAdder : ITransientDependency
await AddPathsToTsConfigAsync(angularPath, angularProjectsPath, projects);
await CreateTsConfigProdJsonAsync(angularPath);
await AddScriptsToPackageJsonAsync(angularPath);
await AddProjectsToAngularJsonAsync(angularPath, projects);
}
catch (Exception e)
@ -124,28 +122,6 @@ public class AngularSourceCodeAdder : ITransientDependency
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");

Loading…
Cancel
Save