From 4b4ec37880b69d89faf8ec780d20471ee82a288b Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 8 Dec 2021 15:52:15 -0600 Subject: [PATCH] Fix relative paths (#4594) * Add tests for relativeRoot * Remove path.posix.join Since this is for file system paths it feels incorrect to use it on URL paths as they are different in many ways. * Rewrite cookie path logic Before we relied on the client to resolve the base given to it by the backend against the path. Instead have the client pass that information along so we can resolve it on the backend. This means the client has to do less work. * Do not remove out directory before watch This is re-used for incremental compilation. Also remove del since that was the only use (and we can use fs.rmdir in the future if we need something like this). * Remove unused function resolveBase --- ci/dev/watch.ts | 12 ------- package.json | 1 - src/browser/pages/login.html | 7 ++-- src/common/util.ts | 21 ++++-------- src/node/http.ts | 57 ++++++++++++++++++++++++++++---- src/node/routes/login.ts | 12 ++----- src/node/routes/logout.ts | 15 +++------ src/node/routes/vscode.ts | 2 +- src/node/util.ts | 2 +- test/unit/common/util.test.ts | 36 -------------------- test/unit/node/http.test.ts | 11 +++++++ vendor/package.json | 2 +- vendor/yarn.lock | 4 +-- yarn.lock | 62 +++++------------------------------ 14 files changed, 91 insertions(+), 153 deletions(-) create mode 100644 test/unit/node/http.test.ts diff --git a/ci/dev/watch.ts b/ci/dev/watch.ts index 6f729109..8ed59c42 100644 --- a/ci/dev/watch.ts +++ b/ci/dev/watch.ts @@ -1,5 +1,4 @@ import { spawn, fork, ChildProcess } from "child_process" -import del from "del" import { promises as fs } from "fs" import * as path from "path" import { CompilationStats, onLine, OnLineCallback } from "../../src/node/util" @@ -57,8 +56,6 @@ class Watcher { process.on(event, () => this.dispose(0)) } - this.cleanFiles() - for (const [processName, devProcess] of Object.entries(this.compilers)) { if (!devProcess) continue @@ -121,15 +118,6 @@ class Watcher { //#region Utilities - /** - * Cleans files from previous builds. - */ - private cleanFiles(): Promise { - console.log("[Watcher]", "Cleaning files from previous builds...") - - return del(["out/**/*"]) - } - /** * Emits a file containing compilation data. * This is especially useful when Express needs to determine if VS Code is still compiling. diff --git a/package.json b/package.json index b031fbd4..39eb0226 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "@typescript-eslint/parser": "^5.0.0", "audit-ci": "^5.0.0", "codecov": "^3.8.3", - "del": "^6.0.0", "doctoc": "^2.0.0", "eslint": "^7.7.0", "eslint-config-prettier": "^8.1.0", diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index 75aa86dc..6149ecf1 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -30,7 +30,8 @@