Skip to content

Commit 3321ad8

Browse files
Add ability to configure working directory for unzipping/running node modules
Added support for environment variable WEBCOMPILER_WORKING_DIRECTORY in CompilerService. If set, we will unzip node.exe and node modules into a subdirectory of this directory instead of into the system temp directory. This is intended for CI or build server environments where temp directories are often cleaned after every run, or are set per-build-agent.
1 parent 586295b commit 3321ad8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ x64/
2525
_NCrunch_WebCompiler#Node
2626

2727
#Node
28-
src/WebCompiler/Node/node_modules/*
28+
src/WebCompiler/Node/node_modules/*
29+
src/WebCompiler/Node/node.exe

src/WebCompiler/Compile/CompilerService.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ namespace WebCompiler
1010
/// </summary>
1111
public static class CompilerService
1212
{
13-
internal const string Version = "1.4.167";
14-
private static readonly string _path = Path.Combine(Path.GetTempPath(), "WebCompiler" + Version);
13+
internal const string Version = "1.12.0";
14+
internal const string WorkingDirectoryEnvVarName = "WEBCOMPILER_WORKING_DIRECTORY";
15+
private static readonly string _path = GetWorkingDirectoryPath();
1516
private static object _syncRoot = new object(); // Used to lock on the initialize step
1617

1718
/// <summary>A list of allowed file extensions.</summary>
1819
public static readonly string[] AllowedExtensions = new[] { ".LESS", ".SCSS", ".SASS", ".STYL", ".COFFEE", ".ICED", ".JS", ".JSX", ".ES6", ".HBS", ".HANDLEBARS" };
1920

21+
internal static string GetWorkingDirectoryPath()
22+
{
23+
var envValue = Environment.GetEnvironmentVariable(WorkingDirectoryEnvVarName);
24+
return Path.Combine(envValue ?? Path.GetTempPath(), "WebCompiler" + Version);
25+
}
26+
2027
/// <summary>
2128
/// Test if a file type is supported by the compilers.
2229
/// </summary>

0 commit comments

Comments
 (0)