Remove all submodules - just force clone and reset on run instead (#33425)

This commit is contained in:
Wesley Wigham
2019-09-13 16:14:33 -07:00
committed by GitHub
parent 99229f88dd
commit 038d95144d
23 changed files with 31 additions and 56 deletions

12
.gitignore vendored
View File

@@ -81,4 +81,14 @@ tests/cases/user/*/**/*.d.ts
tests/baselines/reference/dt
.failed-tests
TEST-results.xml
package-lock.json
package-lock.json
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
tests/cases/user/create-react-app/create-react-app
tests/cases/user/webpack/webpack
tests/cases/user/puppeteer/puppeteer
tests/cases/user/axios-src/axios-src
tests/cases/user/prettier/prettier

40
.gitmodules vendored
View File

@@ -1,40 +0,0 @@
[submodule "tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter"]
path = tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
url = https://github.com/Microsoft/TypeScript-React-Starter
ignore = all
[submodule "tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter"]
path = tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
url = https://github.com/Microsoft/TypeScript-Node-Starter.git
ignore = all
[submodule "tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter"]
path = tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
url = https://github.com/Microsoft/TypeScript-React-Native-Starter.git
ignore = all
[submodule "tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter"]
path = tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
url = https://github.com/Microsoft/TypeScript-Vue-Starter.git
ignore = all
[submodule "tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter"]
path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git
ignore = all
[submodule "tests/cases/user/create-react-app/create-react-app"]
path = tests/cases/user/create-react-app/create-react-app
url = https://github.com/facebook/create-react-app.git
ignore = all
[submodule "tests/cases/user/webpack/webpack"]
path = tests/cases/user/webpack/webpack
url = https://github.com/webpack/webpack.git
ignore = all
[submodule "tests/cases/user/puppeteer/puppeteer"]
path = tests/cases/user/puppeteer/puppeteer
url = https://github.com/GoogleChrome/puppeteer.git
ignore = all
[submodule "tests/cases/user/axios-src/axios-src"]
path = tests/cases/user/axios-src/axios-src
url = https://github.com/axios/axios.git
ignore = all
[submodule "tests/cases/user/prettier/prettier"]
path = tests/cases/user/prettier/prettier
url = https://github.com/prettier/prettier.git
ignore = all

View File

@@ -10,6 +10,7 @@ interface ExecResult {
interface UserConfig {
types: string[];
cloneUrl: string;
path?: string;
}
@@ -49,13 +50,17 @@ abstract class ExternalCompileRunnerBase extends RunnerBase {
const stdio = isWorker ? "pipe" : "inherit";
let types: string[] | undefined;
if (fs.existsSync(path.join(cwd, "test.json"))) {
const submoduleDir = path.join(cwd, directoryName);
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
exec("git", ["clean", "-f"], { cwd: submoduleDir });
exec("git", ["submodule", "update", "--init", "--remote", "."], { cwd: originalCwd });
const config = JSON.parse(fs.readFileSync(path.join(cwd, "test.json"), { encoding: "utf8" })) as UserConfig;
ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present.");
ts.Debug.assert(!!config.cloneUrl, "Bad format from test.json: cloneUrl field must be present.");
const submoduleDir = path.join(cwd, directoryName);
if (!fs.existsSync(submoduleDir)) {
exec("git", ["clone", config.cloneUrl, directoryName], { cwd });
}
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
exec("git", ["clean", "-f"], { cwd: submoduleDir });
exec("git", ["pull", "-f"], { cwd: submoduleDir });
types = config.types;
cwd = config.path ? path.join(cwd, config.path) : submoduleDir;

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-Node-Starter.git",
"types": ["jquery"]
}

View File

@@ -1,4 +1,5 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Native-Starter.git",
"types": ["jest"],
"path": "TypeScript-React-Native-Starter/ExampleProject"
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
"types": ["jest", "node"]
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git",
"types": []
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
"types": []
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/axios/axios.git",
"types": ["node"]
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/facebook/create-react-app.git",
"types": []
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/prettier/prettier.git",
"types": ["node"]
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/GoogleChrome/puppeteer.git",
"types": []
}

View File

@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/webpack/webpack.git",
"types": []
}