ics-builder 4.1.89 → 4.1.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ics-builder",
3
- "version": "4.1.89",
3
+ "version": "4.1.93",
4
4
  "description": "",
5
5
  "main": "./src/app.js",
6
6
  "preferGlobal": true,
@@ -1,47 +1,37 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
2
15
  Object.defineProperty(exports, "__esModule", { value: true });
3
16
  exports.CsprojFile = void 0;
4
- var xml2js = require("xml2js");
5
- var fs = require("fs");
6
- var CsprojFile = /** @class */ (function () {
7
- function CsprojFile(_path) {
8
- this._path = _path;
17
+ var xmlFile_1 = require("./xmlFile");
18
+ var CsprojFile = /** @class */ (function (_super) {
19
+ __extends(CsprojFile, _super);
20
+ function CsprojFile() {
21
+ return _super !== null && _super.apply(this, arguments) || this;
9
22
  }
10
- CsprojFile.prototype._readFile = function () {
11
- var _this = this;
12
- var file = fs.readFileSync(this._path);
13
- xml2js.parseString(file, function (err, result) { return _this._xmlObj = result; });
14
- };
15
- CsprojFile.prototype.addPostBuildCopy = function (copyToPath) {
23
+ CsprojFile.prototype.setPublishPath = function (publishPath) {
16
24
  if (!this._xmlObj)
17
25
  this._readFile();
18
26
  if (!this._xmlObj.Project)
19
27
  this._xmlObj.Project = {};
20
- this._xmlObj.Project.Target = {
21
- $: {
22
- Name: "CopyTarget",
23
- AfterTargets: "PostBuildEvent"
24
- },
25
- ItemGroup: {
26
- OutputFiles: {
27
- $: {
28
- Include: "$(TargetDir)\\*.*"
29
- }
30
- }
31
- },
32
- Copy: {
33
- $: {
34
- SourceFiles: "@(OutputFiles)",
35
- DestinationFolder: copyToPath,
36
- }
37
- }
38
- };
39
- };
40
- CsprojFile.prototype.save = function (path) {
41
- var builder = new xml2js.Builder();
42
- var xml = builder.buildObject(this._xmlObj);
43
- fs.writeFileSync(path, xml);
28
+ if (!this._xmlObj.Project.PropertyGroup)
29
+ this._xmlObj.Project.PropertyGroup = {};
30
+ var propertyGroup = Array.isArray(this._xmlObj.Project.PropertyGroup)
31
+ ? this._xmlObj.Project.PropertyGroup[0]
32
+ : this._xmlObj.Project.PropertyGroup;
33
+ propertyGroup.PublishDir = publishPath;
44
34
  };
45
35
  return CsprojFile;
46
- }());
36
+ }(xmlFile_1.XmlFile));
47
37
  exports.CsprojFile = CsprojFile;
@@ -21,6 +21,7 @@ var utils_1 = require("../../utils");
21
21
  var dotnetUtils_1 = require("../../dotnetUtils");
22
22
  var packageStructureManager_1 = require("../../services/packageStructure/packageStructureManager");
23
23
  var csprojFile_1 = require("./csprojFile");
24
+ var webConfigFile_1 = require("./webConfigFile");
24
25
  var Net5ApiBuilder = /** @class */ (function (_super) {
25
26
  __extends(Net5ApiBuilder, _super);
26
27
  function Net5ApiBuilder(config) {
@@ -51,20 +52,22 @@ var Net5ApiBuilder = /** @class */ (function (_super) {
51
52
  var slnDir = path.dirname(coreModule.Project);
52
53
  var configuration = ((_a = this.config.api) === null || _a === void 0 ? void 0 : _a.configuration) || "Debug";
53
54
  var tempSlnPath = path.join(slnDir, slnName + ".sln");
54
- var tempProjects = [];
55
55
  try {
56
56
  dotnetUtils_1.DotnetUtils.createTempSln(slnDir, slnName);
57
57
  for (var _i = 0, _b = this.modules; _i < _b.length; _i++) {
58
58
  var m = _b[_i];
59
+ utils_1.Utils.copyFile(m.Project, m.TempProject);
59
60
  var csproj = new csprojFile_1.CsprojFile(m.Project);
60
- csproj.addPostBuildCopy(m.OutputPath);
61
- var tempProjPath = this.getTempProjPath(m.Project);
62
- tempProjects.push(tempProjPath);
63
- csproj.save(tempProjPath);
61
+ csproj.setPublishPath(m.OutputPath);
62
+ csproj.save(m.Project);
64
63
  }
65
- dotnetUtils_1.DotnetUtils.addProjectsToSln(tempSlnPath, tempProjects);
64
+ dotnetUtils_1.DotnetUtils.addProjectsToSln(tempSlnPath, this.modules.map(function (m) { return m.Project; }));
66
65
  dotnetUtils_1.DotnetUtils.restoreNugetPackages(tempSlnPath);
67
66
  dotnetUtils_1.DotnetUtils.publish(tempSlnPath, configuration);
67
+ var webConfigFilePath = path.join(coreModule.OutputPath, "web.config");
68
+ var webConfigFile = new webConfigFile_1.WebConfigFile(webConfigFilePath);
69
+ webConfigFile.addDotnetProcessPath();
70
+ webConfigFile.save();
68
71
  this.modules.filter(function (m) { return !m.IsCoreModule; }).forEach(function (m) {
69
72
  var projectDir = path.dirname(m.Project);
70
73
  _this.copyModuleConfig(projectDir, m.OutputPath, _this.configFile);
@@ -72,13 +75,12 @@ var Net5ApiBuilder = /** @class */ (function (_super) {
72
75
  }
73
76
  finally {
74
77
  utils_1.Utils.deleteFile(tempSlnPath);
75
- tempProjects.forEach(function (p) { return utils_1.Utils.deleteFile(p); });
78
+ this.modules.forEach(function (m) {
79
+ utils_1.Utils.copyFile(m.TempProject, m.Project);
80
+ utils_1.Utils.deleteFile(m.TempProject);
81
+ });
76
82
  }
77
83
  };
78
- Net5ApiBuilder.prototype.getTempProjPath = function (projPath) {
79
- var dir = path.dirname(projPath);
80
- return path.join(dir, utils_1.Utils.getFileName(projPath) + "_temp.csproj");
81
- };
82
84
  Net5ApiBuilder.prototype.collectModuleInfo = function (pkg) {
83
85
  var _this = this;
84
86
  packageStructureManager_1.packageStructureManager.getModuleSourcePaths(pkg, "api", this.config).forEach(function (_a) {
@@ -132,6 +134,8 @@ var ApiModuleInfo = /** @class */ (function () {
132
134
  this.Package = pkg;
133
135
  this.Module = module;
134
136
  this.Project = project;
137
+ var dir = path.dirname(project);
138
+ this.TempProject = path.join(dir, utils_1.Utils.getFileName(project) + "_temp.csproj");
135
139
  this.IsCoreModule = module.name == "_core" && pkg == "mdt";
136
140
  this.OutputPath = this.IsCoreModule
137
141
  ? buildApiFolder
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WebConfigFile = void 0;
17
+ var xmlFile_1 = require("./xmlFile");
18
+ var WebConfigFile = /** @class */ (function (_super) {
19
+ __extends(WebConfigFile, _super);
20
+ function WebConfigFile() {
21
+ return _super !== null && _super.apply(this, arguments) || this;
22
+ }
23
+ WebConfigFile.prototype.addDotnetProcessPath = function () {
24
+ if (!this._xmlObj)
25
+ this._readFile();
26
+ var aspNetCoreSectionOptions = this._xmlObj.configuration.location["system.webServer"].aspNetCore.$;
27
+ aspNetCoreSectionOptions.processPath = "dotnet";
28
+ aspNetCoreSectionOptions.arguments = ".\\Mdt.WebApi.dll";
29
+ aspNetCoreSectionOptions.stdoutLogEnabled = "false";
30
+ };
31
+ return WebConfigFile;
32
+ }(xmlFile_1.XmlFile));
33
+ exports.WebConfigFile = WebConfigFile;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XmlFile = void 0;
4
+ var xml2js = require("xml2js");
5
+ var fs = require("fs");
6
+ var XmlFile = /** @class */ (function () {
7
+ function XmlFile(_path) {
8
+ this._path = _path;
9
+ }
10
+ XmlFile.prototype._readFile = function () {
11
+ var _this = this;
12
+ var file = fs.readFileSync(this._path);
13
+ xml2js.parseString(file, { explicitArray: false }, function (err, result) { return _this._xmlObj = result; });
14
+ };
15
+ XmlFile.prototype.save = function (path) {
16
+ if (path === void 0) { path = null; }
17
+ var builder = new xml2js.Builder();
18
+ var xml = builder.buildObject(this._xmlObj);
19
+ fs.writeFileSync(path !== null && path !== void 0 ? path : this._path, xml);
20
+ };
21
+ return XmlFile;
22
+ }());
23
+ exports.XmlFile = XmlFile;