1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Remove automatic npm install feature (#58731)

This commit is contained in:
Kevin Heis
2025-12-05 10:15:15 -08:00
committed by GitHub
parent 0d02a28be6
commit d176fe25ae
6 changed files with 1 additions and 70 deletions

3
.gitignore vendored
View File

@@ -13,8 +13,7 @@
# JetBrains IDE files # JetBrains IDE files
.idea/ .idea/
# Tracks package-lock.json installation state
.installed.package-lock.json
# Linkinator full site link check results # Linkinator full site link check results
.linkinator/ .linkinator/

1
package-lock.json generated
View File

@@ -5,7 +5,6 @@
"packages": { "packages": {
"": { "": {
"name": "docs.github.com", "name": "docs.github.com",
"hasInstallScript": true,
"license": "(MIT AND CC-BY-4.0)", "license": "(MIT AND CC-BY-4.0)",
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.13.1", "@elastic/elasticsearch": "8.13.1",

View File

@@ -21,7 +21,6 @@
"check-github-github-links": "tsx src/links/scripts/check-github-github-links.ts", "check-github-github-links": "tsx src/links/scripts/check-github-github-links.ts",
"clone-early-access": "./src/early-access/scripts/clone-locally", "clone-early-access": "./src/early-access/scripts/clone-locally",
"clone-translations": "./src/languages/scripts/clone-translations.sh", "clone-translations": "./src/languages/scripts/clone-translations.sh",
"cmp-files": "tsx src/workflows/cmp-files.ts",
"content-changes-table-comment": "tsx src/workflows/content-changes-table-comment.ts", "content-changes-table-comment": "tsx src/workflows/content-changes-table-comment.ts",
"copy-fixture-data": "tsx src/tests/scripts/copy-fixture-data.ts", "copy-fixture-data": "tsx src/tests/scripts/copy-fixture-data.ts",
"count-translation-corruptions": "cross-env NODE_OPTIONS=--max-old-space-size=8192 tsx src/languages/scripts/count-translation-corruptions.ts", "count-translation-corruptions": "cross-env NODE_OPTIONS=--max-old-space-size=8192 tsx src/languages/scripts/count-translation-corruptions.ts",
@@ -66,7 +65,6 @@
"openapi-docs": "tsx src/rest/docs.ts", "openapi-docs": "tsx src/rest/docs.ts",
"playwright-test": "playwright test --config src/fixtures/playwright.config.ts --project=\"Google Chrome\"", "playwright-test": "playwright test --config src/fixtures/playwright.config.ts --project=\"Google Chrome\"",
"lint-report": "tsx src/content-linter/scripts/lint-report.ts", "lint-report": "tsx src/content-linter/scripts/lint-report.ts",
"postinstall": "cp package-lock.json .installed.package-lock.json && echo \"Updated .installed.package-lock.json\" # see husky/post-checkout and husky/post-merge",
"precompute-pageinfo": "tsx src/article-api/scripts/precompute-pageinfo.ts", "precompute-pageinfo": "tsx src/article-api/scripts/precompute-pageinfo.ts",
"prepare": "husky src/workflows/husky", "prepare": "husky src/workflows/husky",
"prettier": "prettier -w \"**/*.{ts,tsx,scss,yml,yaml}\"", "prettier": "prettier -w \"**/*.{ts,tsx,scss,yml,yaml}\"",

View File

@@ -1,29 +0,0 @@
// [start-readme]
//
// Given N files. Exit 0 if they all exist and are identical in content.
//
// [end-readme]
import fs from 'fs'
import { program } from 'commander'
program.description('Compare N files').arguments('[files...]').parse(process.argv)
main(program.args)
function main(files: string[]) {
if (files.length < 2) throw new Error('Must be at least 2 files')
try {
const contents = files.map((file) => fs.readFileSync(file, 'utf-8'))
if (new Set(contents).size > 1) {
process.exit(1)
}
} catch (error: any) {
if (error.code === 'ENOENT') {
process.exit(1)
} else {
throw error
}
}
}

View File

@@ -1,18 +0,0 @@
#!/bin/sh
[ -n "$CI" ] && exit 0
# Ignore this check if user has DOCS_NO_AUTO_NPM set in their environment
if [ -n "$DOCS_NO_AUTO_NPM" ]; then
echo "Skipping auto-npm install because DOCS_NO_AUTO_NPM is set"
exit 0
fi
# Same process in husky/post-merge
echo "Checking if packages need to be installed..."
if npm run cmp-files -- package-lock.json .installed.package-lock.json; then
echo "Packages are up-to-date"
else
echo "Installing packages..."
npm install
echo "Packages are now up-to-date"
fi

View File

@@ -1,18 +0,0 @@
#!/bin/sh
[ -n "$CI" ] && exit 0
# Ignore this check if user has DOCS_NO_AUTO_NPM set in their environment
if [ -n "$DOCS_NO_AUTO_NPM" ]; then
echo "Skipping auto-npm install because DOCS_NO_AUTO_NPM is set"
exit 0
fi
# Same process in husky/post-checkout
echo "Checking if packages need to be installed..."
if npm run cmp-files -- package-lock.json .installed.package-lock.json; then
echo "Packages are up-to-date"
else
echo "Installing packages..."
npm install
echo "Packages are now up-to-date"
fi