Skip to content

Commit 8db2dd8

Browse files
committed
Change build system to hereby
This eliminates a significant number of dependencies, eliminating all npm audit issues, speeding up `npm ci` by 20%, and overall making the build faster (faster startup, direct code is faster than streams, etc) and clearer to understand. I'm finding it much easier to make build changes for the module transform with this; I can more clearly indicate task dependencies and prevent running tasks that don't need to be run. Given we're changing our build process entirely (new deps, new steps), it seems like this is a good time to change things up.
1 parent 09c2a03 commit 8db2dd8

32 files changed

+3749
-12114
lines changed

Diff for: .devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
ARG VARIANT="14-buster"
55
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
66

7-
RUN sudo -u node npm install -g gulp-cli
7+
RUN sudo -u node npm install -g hereby

Diff for: .github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Thank you for submitting a pull request!
44
Please verify that:
55
* [ ] There is an associated issue in the `Backlog` milestone (**required**)
66
* [ ] Code is up-to-date with the `main` branch
7-
* [ ] You've successfully run `gulp runtests` locally
7+
* [ ] You've successfully run `hereby runtests` locally
88
* [ ] There are new or updated unit tests validating the change
99
1010
Refer to CONTRIBUTING.MD for more details.

Diff for: .github/workflows/accept-baselines-fix-lints.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
git config user.name "TypeScript Bot"
1818
npm install
1919
git rm -r --quiet tests/baselines/reference :^tests/baselines/reference/docker :^tests/baselines/reference/user
20-
gulp runtests-parallel --ci --fix || true
21-
gulp baseline-accept
20+
npx hereby runtests-parallel --ci --fix || true
21+
npx hereby baseline-accept
2222
git add ./src
2323
git add ./tests/baselines/reference
2424
git diff --cached

Diff for: .github/workflows/ci.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ jobs:
6969
- name: Adding playwright
7070
run: npm install --no-save --no-package-lock playwright
7171

72-
- name: Build local
73-
run: gulp local
74-
7572
- name: Validate the browser can import TypeScript
76-
run: gulp test-browser-integration
73+
run: npx hereby test-browser-integration
7774

7875
typecheck:
7976
runs-on: ubuntu-latest
@@ -102,10 +99,10 @@ jobs:
10299
- run: npm ci
103100

104101
- name: Build scripts
105-
run: gulp scripts
102+
run: npx hereby scripts
106103

107104
- name: ESLint tests
108-
run: gulp run-eslint-rules-tests
105+
run: npx hereby run-eslint-rules-tests
109106

110107
self-check:
111108
runs-on: ubuntu-latest
@@ -119,10 +116,10 @@ jobs:
119116
- run: npm ci
120117

121118
- name: Build tsc
122-
run: gulp tsc
119+
run: npx hereby tsc
123120

124121
- name: Clean
125-
run: gulp clean-src
122+
run: npx hereby clean-src
126123

127124
- name: Self build
128-
run: gulp build-src --built
125+
run: npx hereby build-src --built

Diff for: .github/workflows/new-release-branch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
2222
sed -i -e 's/const version\(: string\)\{0,1\} = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts
2323
npm ci
24-
gulp LKG
24+
npx hereby LKG
2525
npm test
2626
git diff
2727
git add package.json

Diff for: .github/workflows/nightly.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
run: |
2424
npm whoami
2525
npm ci
26-
gulp configure-nightly
27-
gulp LKG
28-
gulp runtests-parallel
29-
gulp clean
26+
npx hereby configure-nightly
27+
npx hereby LKG
28+
npx hereby runtests-parallel
29+
npx hereby clean
3030
npm publish --tag next
3131
env:
3232
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Diff for: .github/workflows/release-branch-artifact.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
- name: Adding playwright
2020
run: npm install --no-save --no-package-lock playwright
2121
- name: Validate the browser can import TypeScript
22-
run: gulp test-browser-integration
22+
run: npx hereby test-browser-integration
2323
- name: LKG, clean, and pack
2424
run: |
25-
gulp LKG
26-
gulp clean
25+
npx hereby LKG
26+
npx hereby clean
2727
npm pack ./
2828
mv typescript-*.tgz typescript.tgz
2929
- name: Upload built tarfile

Diff for: .github/workflows/set-version.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
2828
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
2929
npm ci
30-
gulp LKG
30+
npx hereby LKG
3131
npm test
3232
git diff
3333
git add package.json

Diff for: .github/workflows/update-lkg.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
git config user.email "typescriptbot@microsoft.com"
1717
git config user.name "TypeScript Bot"
1818
npm ci
19-
gulp LKG
19+
npx hereby LKG
2020
npm test
2121
git diff
2222
git add ./lib

Diff for: .gulp.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const cp = require("child_process");
2+
const path = require("path");
3+
const chalk = require("chalk");
4+
5+
const argv = process.argv.slice(2);
6+
7+
// --tasks-simple is used by VS Code to infer a task list; try and keep that working.
8+
if (!argv.includes("--tasks-simple")) {
9+
console.error(chalk.yellowBright("Warning: using gulp shim; please consider running hereby directly."));
10+
}
11+
12+
const args = [
13+
...process.execArgv,
14+
path.join(__dirname, "node_modules", "hereby", "bin", "hereby.js"),
15+
...argv,
16+
];
17+
18+
const { status } = cp.spawnSync(process.execPath, args, { stdio: "inherit" });
19+
process.exit(status ?? 1);

Diff for: .vscode/launch.template.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"configurations": [
2121
{
2222
"type": "node",
23-
"protocol": "inspector",
2423
"request": "launch",
2524
"name": "Mocha Tests (currently opened test)",
2625
"runtimeArgs": ["--nolazy"],
@@ -43,20 +42,20 @@
4342
},
4443
"sourceMaps": true,
4544
"smartStep": true,
46-
"preLaunchTask": "gulp: tests",
45+
"preLaunchTask": "npm: build:tests",
4746
"console": "integratedTerminal",
4847
"outFiles": [
4948
"${workspaceRoot}/built/local/run.js"
5049
],
51-
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue",
50+
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
5251
},
5352
{
5453
// See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
5554
"type": "node",
5655
"request": "attach",
5756
"name": "Attach to VS Code TS Server via Port",
5857
"processId": "${command:PickProcess}",
59-
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue",
58+
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
6059
}
6160
]
6261
}

Diff for: .vscode/settings.template.json

+8
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@
1212
// "--ignore-revs-file",
1313
// ".git-blame-ignore-revs"
1414
// ]
15+
16+
// These options search the repo recursively and slow down
17+
// the build task menu. We define our own in tasks.json.
18+
"typescript.tsc.autoDetect": "off",
19+
"npm.autoDetect": "off",
20+
"grunt.autoDetect": "off",
21+
"jake.autoDetect": "off",
22+
"gulp.autoDetect": "off"
1523
}

Diff for: .vscode/tasks.json

+29-20
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,51 @@
44
"version": "2.0.0",
55
"tasks": [
66
{
7-
"type": "gulp",
8-
"label": "gulp: local",
9-
"task": "local",
10-
"group": {
11-
"kind": "build",
12-
"isDefault": true
13-
},
7+
// Kept for backwards compat for old launch.json files so it's
8+
// less annoying if moving up to the new build or going back to
9+
// the old build.
10+
//
11+
// This is first because the acutal "npm: build:tests" task
12+
// below has the same script value, and VS Code ignores labels
13+
// and deduplicates them.
14+
// https://github.com/microsoft/vscode/issues/93001
15+
"label": "gulp: tests",
16+
"type": "npm",
17+
"script": "build:tests",
18+
"group": "build",
19+
"hide": true,
1420
"problemMatcher": [
1521
"$tsc"
1622
]
1723
},
1824
{
19-
"type": "gulp",
20-
"label": "gulp: tsc",
21-
"task": "tsc",
25+
"label": "tsc: watch ./src",
26+
"type": "shell",
27+
"command": "node",
28+
"args": ["${workspaceFolder}/lib/tsc.js", "--build", "${workspaceFolder}/src", "--watch"],
2229
"group": "build",
30+
"isBackground": true,
2331
"problemMatcher": [
24-
"$tsc"
32+
"$tsc-watch"
2533
]
2634
},
2735
{
28-
"type": "gulp",
29-
"label": "gulp: tests",
30-
"task": "tests",
36+
"label": "npm: build:compiler",
37+
"type": "npm",
38+
"script": "build:compiler",
3139
"group": "build",
3240
"problemMatcher": [
3341
"$tsc"
3442
]
3543
},
3644
{
37-
"type": "gulp",
38-
"task": "services",
39-
"label": "gulp: services",
45+
"label": "npm: build:tests",
46+
"type": "npm",
47+
"script": "build:tests",
48+
"group": "build",
4049
"problemMatcher": [
4150
"$tsc"
42-
],
43-
}
51+
]
52+
},
4453
]
45-
}
54+
}

0 commit comments

Comments
 (0)