mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Remove some logs
This commit is contained in:
parent
1aa03a03fc
commit
3560604565
@ -17,22 +17,25 @@ namespace BilibiliEvolved.Build.Watcher
|
|||||||
GenericFilter = "*.vue.js";
|
GenericFilter = "*.vue.js";
|
||||||
}
|
}
|
||||||
private Dictionary<string, TaskCompletionSource<string>> waitRequests = new Dictionary<string, TaskCompletionSource<string>>();
|
private Dictionary<string, TaskCompletionSource<string>> waitRequests = new Dictionary<string, TaskCompletionSource<string>>();
|
||||||
public Task<string> WaitForBuild(string path) {
|
public Task<string> WaitForBuild(string path)
|
||||||
|
{
|
||||||
var tcs = new TaskCompletionSource<string>();
|
var tcs = new TaskCompletionSource<string>();
|
||||||
Console.WriteLine($"add request: {path}");
|
// Console.WriteLine($"add request: {path}");
|
||||||
waitRequests[path] = tcs;
|
waitRequests[path] = tcs;
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
protected override void OnFileChanged(FileSystemEventArgs e)
|
protected override void OnFileChanged(FileSystemEventArgs e)
|
||||||
{
|
{
|
||||||
var originalFilename = Path.ChangeExtension(e.FullPath, ".ts").Replace(WatcherPath, "src");
|
var originalFilename = Path.ChangeExtension(e.FullPath, ".ts").Replace(WatcherPath, "src");
|
||||||
if (File.Exists(originalFilename)) {
|
// Console.WriteLine($"test filename: {originalFilename}");
|
||||||
|
if (waitRequests.ContainsKey(originalFilename))
|
||||||
|
{
|
||||||
|
// Console.WriteLine($"set result for: {originalFilename}");
|
||||||
|
waitRequests[originalFilename].SetResult(File.ReadAllText(e.FullPath));
|
||||||
|
if (File.Exists(originalFilename))
|
||||||
|
{
|
||||||
File.Delete(originalFilename);
|
File.Delete(originalFilename);
|
||||||
}
|
}
|
||||||
Console.WriteLine($"test filename: {originalFilename}");
|
|
||||||
if (waitRequests.ContainsKey(originalFilename)) {
|
|
||||||
Console.WriteLine($"set result for: {originalFilename}");
|
|
||||||
waitRequests[originalFilename].SetResult(File.ReadAllText(e.FullPath));
|
|
||||||
waitRequests.Remove(originalFilename);
|
waitRequests.Remove(originalFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,11 +47,13 @@ namespace BilibiliEvolved.Build.Watcher
|
|||||||
{
|
{
|
||||||
GenericFilter = "*.vue";
|
GenericFilter = "*.vue";
|
||||||
}
|
}
|
||||||
public override void Start(ProjectBuilder builder) {
|
public override void Start(ProjectBuilder builder)
|
||||||
|
{
|
||||||
tsWatcher.Start(builder);
|
tsWatcher.Start(builder);
|
||||||
base.Start(builder);
|
base.Start(builder);
|
||||||
}
|
}
|
||||||
public override void Stop() {
|
public override void Stop()
|
||||||
|
{
|
||||||
base.Stop();
|
base.Stop();
|
||||||
tsWatcher.Stop();
|
tsWatcher.Stop();
|
||||||
}
|
}
|
||||||
@ -126,12 +131,12 @@ namespace BilibiliEvolved.Build.Watcher
|
|||||||
{
|
{
|
||||||
var tsFile = path + ".ts";
|
var tsFile = path + ".ts";
|
||||||
var task = tsWatcher.WaitForBuild(tsFile);
|
var task = tsWatcher.WaitForBuild(tsFile);
|
||||||
if (File.Exists(tsFile)) {
|
// if (File.Exists(tsFile)) {
|
||||||
File.Delete(tsFile);
|
// File.Delete(tsFile);
|
||||||
}
|
// }
|
||||||
Console.WriteLine($"writing file {tsFile}");
|
// Console.WriteLine($"writing file {tsFile}");
|
||||||
File.WriteAllText(tsFile, vueFile.Script);
|
File.WriteAllText(tsFile, vueFile.Script);
|
||||||
Console.WriteLine($"waiting for tsc...");
|
// Console.WriteLine($"waiting for tsc...");
|
||||||
var script = task.Result.Replace("export default ", "return {export:Object.assign({template},").Trim().TrimEnd(';');
|
var script = task.Result.Replace("export default ", "return {export:Object.assign({template},").Trim().TrimEnd(';');
|
||||||
compiledText.Append($"{script})}}");
|
compiledText.Append($"{script})}}");
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user