Skip to content

Commit 038d951

Browse files
authored
Remove all submodules - just force clone and reset on run instead (microsoft#33425)
1 parent 99229f8 commit 038d951

File tree

23 files changed

+29
-54
lines changed

23 files changed

+29
-54
lines changed

.gitignore

+11-1
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,14 @@ tests/cases/user/*/**/*.d.ts
8181
tests/baselines/reference/dt
8282
.failed-tests
8383
TEST-results.xml
84-
package-lock.json
84+
package-lock.json
85+
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
86+
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
87+
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
88+
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
89+
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
90+
tests/cases/user/create-react-app/create-react-app
91+
tests/cases/user/webpack/webpack
92+
tests/cases/user/puppeteer/puppeteer
93+
tests/cases/user/axios-src/axios-src
94+
tests/cases/user/prettier/prettier

.gitmodules

-40
Original file line numberDiff line numberDiff line change
@@ -1,40 +0,0 @@
1-
[submodule "tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter"]
2-
path = tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
3-
url = https://github.com/Microsoft/TypeScript-React-Starter
4-
ignore = all
5-
[submodule "tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter"]
6-
path = tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
7-
url = https://github.com/Microsoft/TypeScript-Node-Starter.git
8-
ignore = all
9-
[submodule "tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter"]
10-
path = tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
11-
url = https://github.com/Microsoft/TypeScript-React-Native-Starter.git
12-
ignore = all
13-
[submodule "tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter"]
14-
path = tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
15-
url = https://github.com/Microsoft/TypeScript-Vue-Starter.git
16-
ignore = all
17-
[submodule "tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter"]
18-
path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
19-
url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git
20-
ignore = all
21-
[submodule "tests/cases/user/create-react-app/create-react-app"]
22-
path = tests/cases/user/create-react-app/create-react-app
23-
url = https://github.com/facebook/create-react-app.git
24-
ignore = all
25-
[submodule "tests/cases/user/webpack/webpack"]
26-
path = tests/cases/user/webpack/webpack
27-
url = https://github.com/webpack/webpack.git
28-
ignore = all
29-
[submodule "tests/cases/user/puppeteer/puppeteer"]
30-
path = tests/cases/user/puppeteer/puppeteer
31-
url = https://github.com/GoogleChrome/puppeteer.git
32-
ignore = all
33-
[submodule "tests/cases/user/axios-src/axios-src"]
34-
path = tests/cases/user/axios-src/axios-src
35-
url = https://github.com/axios/axios.git
36-
ignore = all
37-
[submodule "tests/cases/user/prettier/prettier"]
38-
path = tests/cases/user/prettier/prettier
39-
url = https://github.com/prettier/prettier.git
40-
ignore = all

src/testRunner/externalCompileRunner.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface ExecResult {
1010

1111
interface UserConfig {
1212
types: string[];
13+
cloneUrl: string;
1314
path?: string;
1415
}
1516

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

57-
const config = JSON.parse(fs.readFileSync(path.join(cwd, "test.json"), { encoding: "utf8" })) as UserConfig;
58-
ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present.");
5964
types = config.types;
6065

6166
cwd = config.path ? path.join(cwd, config.path) : submoduleDir;
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/Microsoft/TypeScript-Node-Starter.git",
23
"types": ["jquery"]
34
}
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Native-Starter.git",
23
"types": ["jest"],
34
"path": "TypeScript-React-Native-Starter/ExampleProject"
45
}
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
23
"types": ["jest", "node"]
34
}
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git",
23
"types": []
34
}
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
23
"types": []
34
}

tests/cases/user/axios-src/axios-src

-1
This file was deleted.

tests/cases/user/axios-src/test.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/axios/axios.git",
23
"types": ["node"]
34
}
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/facebook/create-react-app.git",
23
"types": []
34
}

tests/cases/user/prettier/prettier

-1
This file was deleted.

tests/cases/user/prettier/test.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/prettier/prettier.git",
23
"types": ["node"]
34
}

tests/cases/user/puppeteer/puppeteer

-1
This file was deleted.

tests/cases/user/puppeteer/test.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/GoogleChrome/puppeteer.git",
23
"types": []
34
}

tests/cases/user/webpack/test.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"cloneUrl": "https://github.com/webpack/webpack.git",
23
"types": []
34
}

tests/cases/user/webpack/webpack

-1
This file was deleted.

0 commit comments

Comments
 (0)