Skip to content

Commit

Permalink
Merge pull request #33 from frisksitron/feature/scripts-directory
Browse files Browse the repository at this point in the history
Allow scripts directory to be specified by user
  • Loading branch information
Eptagone authored Jun 28, 2023
2 parents 4b85b60 + 8af169d commit 26ba975
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Vite.AspNetCore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,11 @@ You can also change the configuration for the middleware as follows.
And there are more options that you can change. All the available options are listed below. ⚙️

| Property | Description |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|--------------------------|------------------------------------------------------------------------------------------------------------------------|
| `Vite:Manifest` | The manifest file name. Default is `manifest.json`. |
| `Vite:Base` | The subfolder where your assets will be located, including the manifest file, relative to the web root path. |
| `Vite:PackageManager` | The name of the package manager to use. Default value is `npm`. |
| `Vite:PackageDirectory` | The directory where the package.json file is located. Default value is the .NET project working directory. |
| `Vite:Server:AutoRun` | Enable or disable the automatic start of the Vite Dev Server. Default value is `false`. |
| `Vite:Server:Port` | The port where the Vite Development Server will be running. Default value is `5173`. |
| `Vite:Server:Host` | The host where the Vite Dev Server will be running. Default value is `localhost`. |
Expand Down
2 changes: 1 addition & 1 deletion src/Vite.AspNetCore/Services/ViteDevMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ViteDevMiddleware(ILogger<ViteDevMiddleware> logger, IConfiguration confi
// Gets the package manager command.
var pkgManagerCommand = this._viteOptions.PackageManager;
// Gets the working directory.
var workingDirectory = environment.ContentRootPath;
var workingDirectory = this._viteOptions.PackageDirectory ?? environment.ContentRootPath;
// Gets the script name.= to run the Vite Dev Server.
var scriptName = this._viteOptions.Server.ScriptName;

Expand Down
6 changes: 6 additions & 0 deletions src/Vite.AspNetCore/ViteOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public record ViteOptions
/// The name of the package manager to use. Default value is "npm".
/// </summary>
public string PackageManager { get; init; } = "npm";

/// <summary>
/// The directory where the package.json file is located.
/// Default value is the .NET project working directory.
/// </summary>
public string? PackageDirectory { get; init; }

/// <summary>
/// Options for the Vite Dev Server.
Expand Down

0 comments on commit 26ba975

Please sign in to comment.