I don't understand the build-site
logic defined in the TypeScript-Website` project.
When running "pnpm build-site
" in the TypeScript-Website
project, it will run: "build-site": "pnpm run --filter=typescriptlang-org build
", and then "build": "pnpm run --filter=!typescriptlang-org build"
.
pnpm build-site
https://github.com/microsoft/TypeScript-Website/blob/v2/package.json
Here is the package.json
:
"scripts": {
"ci:publish": "pnpm changeset tag && pnpm publish -r",
"bootstrap": "pnpm -r run bootstrap && BOOTSTRAPPING=true pnpm -r run build",
"start": "concurrently -p \"[{name}]\" -n \"BUILD,SITE\" -c \"bgBlue.bold,bgMagenta.bold\" \"node watcher.js\" \"pnpm run --filter=typescriptlang-org start\"",
"build": "pnpm run --filter=!typescriptlang-org build",
"build-site": "pnpm run --filter=typescriptlang-org build",
"compile": "pnpm run --filter=typescriptlang-org tsc",
"update-snapshots": "pnpm run --filter=typescriptlang-org update-snapshots",
"clean": "pnpm run --filter=typescriptlang-org gatsby clean",
"clean-twoslash": "rm -rf packages/.cache/twoslash",
"test": "CI=true pnpm -r run test",
"update-test-snapshots": "CI=true pnpm run --filter=@typescript/twoslash --filter=@typescript/vfs test -u"
},
"repository": "microsoft/TypeScript-Website",
But the script inside the "build": "pnpm run --filter=!typescriptlang-org build"
is also "pnpm ... build
". Is it a loop command? As the "pnpm ... build
" will find the "build
" script from package.json
, does it point to itself and will it loop again and again inside the "build
"?
"scripts": {
"build": "pnpm run --filter=!typescriptlang-org build"
"build-site": "pnpm run --filter=typescriptlang-org build",
},
What scripts will be executed when running "pnpm build-site
"?
When you run pnpm build-site
, it builds only the website part of the project using Gatsby.
It runs the build
script inside the typescriptlang-org
folder, which is just:
gatsby build
The build
script in the root is for building everything else except the website.
So no loops — just smart filtering by pnpm
.