⚡ Sangsakala Proxy 🏠 Home
Skip to content

Commit e413ddd

Browse files
committed
package udpates, dotnet global tools support
1 parent 611a24f commit e413ddd

17 files changed

Lines changed: 63 additions & 46 deletions

‎NuGet.config‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<configuration>
33
<packageSources>
44
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
5+
<add key="solutionPackages" value="nupkg" />
56
</packageSources>
67
</configuration>

‎README.md‎

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,45 @@
33
[![NuGet](https://img.shields.io/nuget/dt/NetCoreStack.Hisar.WebCli.Tools.svg?longCache=true&style=flat-square)](https://www.nuget.org/packages/NetCoreStack.Hisar.WebCli.Tools)
44

55

6-
Hisar WebCLI provides modular component development without dependencies.
6+
Hisar WebCli provides modular component development without dependencies.
77
[NetCoreStack.Hisar](https://github.com/NetCoreStack/Hisar) supports any standalone MVC app that it can be part of
88
hosting application package as a component. Please check out NetCoreStack.Hisar on [Github]([NetCoreStack.Hisar](https://github.com/NetCoreStack/Hisar)) for more details.
99
Each component-module should know what layout.cshtml looks like and then this tool can manage it for you.
1010
If you don't specify the main application directory it will create the default _Layout.cshtml page.
1111

12-
For example:
1312

14-
dotnet hisar --appdir the-full-path-of-your-main-app
13+
### Install
14+
Download the .NET Core SDK 2.1.0 or newer. Once installed, run this command:
1515

16-
or serve static files only
16+
dotnet tool install --global dotnet-hisar --version 2.1.1
1717

18-
dotnet hisar --static <the-full-path-of-your-static-files>
18+
### Usage
19+
20+
Usage: dotnet hisar [options] [[--] <arg>...]
21+
22+
Options:
23+
-?|-h|--help Show help information
24+
-a|--appdir Main application directory
25+
-b|--build Component directory
26+
-c|--clean To clean NetCoreStackHisarWebCliTools temp directory and SQLite data which stores Layout.cshtml(s)
27+
-s|--static It launches a server in the current working directory and serves all files in it.
28+
-v|--verbose Show verbose output
29+
30+
Remarks:
31+
Hisar WebCli provides modular component development environements.
32+
You can manage all the files you specified with --appdir option or serve static files with --static option.
33+
However, NetCoreStack.Hisar rely on this tool to templating and create appropriate component packages.
34+
If you don't specify the main application directory it will create a default simple _Layout.cshtml page.
35+
36+
For example: dotnet hisar --appdir <the-full-path-of-your-main-app>
37+
dotnet hisar --static <the-full-path-of-your-static-files>
38+
dotnet hisar --build <the-component-project-directory> (MsBuild integrated)
39+
40+
Examples:
41+
dotnet hisar
42+
dotnet hisar --appdir C:/users/codes/project/src/Hisar.Hosting
43+
dotnet hisar --static C:/users/codes/project/wwwroot
44+
dotnet hisar --build C:/users/codes/project/src/Hisar.Component.Carousel
1945

2046
![](https://github.com/NetCoreStack/Tools/blob/master/NetCoreStackTools.gif)
2147

‎pack.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dotnet restore NetCoreStack.Tools.sln
22
dotnet build NetCoreStack.Tools.sln
33
cd src/NetCoreStack.Hisar.WebCli.Tools
4-
dotnet pack -o ../../nupkg --version-suffix preview61 -c Release
4+
dotnet pack -o ../../nupkg /p:Version=2.1.1-preview1 -c Release

‎pack.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
dotnet restore NetCoreStack.Tools.sln
44
dotnet build NetCoreStack.Tools.sln
55
cd src/NetCoreStack.Hisar.WebCli.Tools
6-
dotnet pack -o ../../nupkg --version-suffix preview60 -c Release
6+
dotnet pack -o ../../nupkg /p:Version=2.1.1-preview1 -c Release

‎src/NetCoreStack.Hisar.WebCli.Tools/Core/CommandLineOptions.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dotnet hisar
6363
var cleanTemp = app.Option("-c|--clean", "To clean NetCoreStackHisarWebCliTools temp directory and SQLite data which stores Layout.cshtml(s)",
6464
CommandOptionType.NoValue);
6565

66-
var staticServer = app.Option("-s|--static", "Static files serve",
66+
var staticServer = app.Option("-s|--static", "It launches a server in the current working directory and serves all files in it",
6767
CommandOptionType.SingleValue, inherited: true);
6868

6969
var optVerbose = app.Option("-v|--verbose", "Show verbose output", CommandOptionType.NoValue);

‎src/NetCoreStack.Hisar.WebCli.Tools/Core/EnvironmentContext.cs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.AspNetCore.Hosting;
22
using Microsoft.Extensions.Configuration;
3-
using Microsoft.Extensions.PlatformAbstractions;
43
using System;
54
using System.Collections.Generic;
65
using System.IO;
@@ -40,10 +39,10 @@ public EnvironmentContext(IConfiguration configuration,
4039
EnvironmentName = HostingEnvironment.EnvironmentName;
4140
ContentRootPath = HostingEnvironment.ContentRootPath;
4241
WebRootPath = HostingEnvironment.WebRootPath;
43-
ApplicationBasePath = PlatformServices.Default.Application.ApplicationBasePath;
42+
ApplicationBasePath = AppDomain.CurrentDomain.BaseDirectory;
4443
AppDirectory = cliEnv.AppDirectory;
4544
DatabasePath = cliEnv.DatabaseFullPath;
46-
Version = PlatformServices.Default.Application.ApplicationVersion;
45+
Version = Assembly.GetEntryAssembly().GetName().Version.ToString();
4746
AssemblyPath = Assembly.GetEntryAssembly().Location;
4847
MainAppDirectoryWebRoot = cliEnv.MainAppDirectoryWebRoot;
4948
ExecutionPath = Directory.GetCurrentDirectory();

‎src/NetCoreStack.Hisar.WebCli.Tools/Core/HostingHelper.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static int GetHostingPort()
2525
{
2626
port = HostingPort(1444);
2727
}
28-
catch (Exception ex)
28+
catch (Exception)
2929
{
3030
port = HostingPort();
3131
}

‎src/NetCoreStack.Hisar.WebCli.Tools/Core/PathUtility.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ public static ComponentDefinition GetComponentInfo(string directory)
154154
}
155155

156156
var dependencyTree = document.Element("Project")?.Descendants("PackageReference").ToList();
157-
var dependencies = dependencyTree.ToDictionary(x => x.Attribute("Include").Value, x => x.Attribute("Version").Value);
157+
var dependencies = dependencyTree.Where(t => t.Attribute("Version") != null)
158+
.ToDictionary(x => x.Attribute("Include").Value, x => x.Attribute("Version").Value);
159+
158160
return new ComponentDefinition(elementValue, directory, dependencies);
159161
}
160162
}

‎src/NetCoreStack.Hisar.WebCli.Tools/NetCoreStack.Hisar.WebCli.Tools.csproj‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.0</TargetFramework>
3+
<TargetFramework>netcoreapp2.1</TargetFramework>
44
<AssemblyName>dotnet-hisar</AssemblyName>
5-
<Description>Command line tool to build hisar application and components.</Description>
6-
<PackageTags>dotnet;hisar</PackageTags>
7-
<PackageId>NetCoreStack.Hisar.WebCli.Tools</PackageId>
8-
<OutputType>exe</OutputType>
9-
<PackageType>DotnetCliTool</PackageType>
10-
<IsPackable>True</IsPackable>
5+
<Description>Global tool to build Hisar web application and components.</Description>
6+
<PackageTags>dotnet, global tools, hisar</PackageTags>
7+
<OutputType>Exe</OutputType>
8+
<IsPackable>true</IsPackable>
9+
<PackAsTool>true</PackAsTool>
10+
<DebugType>embedded</DebugType>
11+
<RootNamespace>NetCoreStack.Hisar.WebCli.Tools</RootNamespace>
1112
</PropertyGroup>
1213

1314
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
15+
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
1517
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
16-
<PackageReference Include="NetCoreStack.WebSockets" Version="2.3.1" />
17-
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
18-
</ItemGroup>
19-
20-
<ItemGroup>
21-
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
18+
<PackageReference Include="NetCoreStack.WebSockets" Version="2.4.0" />
2219
</ItemGroup>
2320

2421
<ItemGroup>

‎src/NetCoreStack.Hisar.WebCli.Tools/Startup.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void ConfigureServices(IServiceCollection services)
5757
Location = ResponseCacheLocation.None,
5858
NoStore = true
5959
});
60-
});
60+
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
6161
}
6262

6363
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)

0 commit comments

Comments
 (0)