Skip to content

Commit b937aa1

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 ec996eb commit b937aa1

31 files changed

+3665
-12095
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
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

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
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.

.github/workflows/accept-baselines-fix-lints.yaml

Lines changed: 2 additions & 2 deletions
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

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ jobs:
7070
run: npm install --no-save --no-package-lock playwright
7171

7272
- name: Build local
73-
run: gulp local
73+
run: npx hereby local
7474

7575
- name: Validate the browser can import TypeScript
76-
run: gulp test-browser-integration
76+
run: npx hereby test-browser-integration
7777

7878
typecheck:
7979
runs-on: ubuntu-latest
@@ -102,10 +102,10 @@ jobs:
102102
- run: npm ci
103103

104104
- name: Build scripts
105-
run: gulp scripts
105+
run: npx hereby scripts
106106

107107
- name: ESLint tests
108-
run: gulp run-eslint-rules-tests
108+
run: npx hereby run-eslint-rules-tests
109109

110110
self-check:
111111
runs-on: ubuntu-latest
@@ -119,10 +119,10 @@ jobs:
119119
- run: npm ci
120120

121121
- name: Build tsc
122-
run: gulp tsc
122+
run: npx hereby tsc
123123

124124
- name: Clean
125-
run: gulp clean-src
125+
run: npx hereby clean-src
126126

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

.github/workflows/new-release-branch.yaml

Lines changed: 1 addition & 1 deletion
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

.github/workflows/nightly.yaml

Lines changed: 4 additions & 4 deletions
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}}

.github/workflows/release-branch-artifact.yaml

Lines changed: 3 additions & 3 deletions
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

.github/workflows/set-version.yaml

Lines changed: 1 addition & 1 deletion
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

.github/workflows/update-lkg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
git config user.email "[email protected]"
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

.gulp.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
if (!argv.includes("--tasks-simple")) {
8+
console.error(chalk.red("Warning: using gulp shim; please run hereby directly."));
9+
}
10+
11+
const args = [
12+
...process.execArgv,
13+
path.join(__dirname, "node_modules", ".bin", "hereby"),
14+
...argv,
15+
];
16+
17+
const { status } = cp.spawnSync(process.execPath, args, { stdio: "inherit" });
18+
process.exit(status ?? 1);

.vscode/launch.template.json

Lines changed: 3 additions & 4 deletions
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
}

.vscode/settings.template.json

Lines changed: 8 additions & 0 deletions
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
}

.vscode/tasks.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,43 @@
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+
"label": "tsc --build ./src --watch",
8+
"type": "shell",
9+
"command": "node",
10+
"args": ["${workspaceFolder}/lib/tsc.js", "--build", "${workspaceFolder}/src", "--watch"],
11+
"group": "build",
12+
"isBackground": true,
1413
"problemMatcher": [
15-
"$tsc"
14+
"$tsc-watch"
1615
]
1716
},
1817
{
19-
"type": "gulp",
20-
"label": "gulp: tsc",
21-
"task": "tsc",
18+
"label": "npm: build:compiler",
19+
"type": "npm",
20+
"script": "build:compiler",
2221
"group": "build",
2322
"problemMatcher": [
2423
"$tsc"
2524
]
2625
},
2726
{
28-
"type": "gulp",
29-
"label": "gulp: tests",
30-
"task": "tests",
27+
"label": "npm: build:tests",
28+
"type": "npm",
29+
"script": "build:tests",
3130
"group": "build",
3231
"problemMatcher": [
3332
"$tsc"
3433
]
3534
},
3635
{
37-
"type": "gulp",
38-
"task": "services",
39-
"label": "gulp: services",
36+
"label": "gulp: tests", // Kept for backwards compat for old launch.json files.
37+
"type": "npm",
38+
"script": "build:tests",
39+
"group": "build",
40+
"hide": true,
4041
"problemMatcher": [
4142
"$tsc"
42-
],
43-
}
43+
]
44+
},
4445
]
45-
}
46+
}

0 commit comments

Comments
 (0)