Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Ensure package is published by calling publish.sh, not by 'npm publish'

Jan Curn7f44e255e6fc
diff --git a/package.json b/package.json
index 7665c7cc7..defcf3107 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
"test": "npm run build && mocha --compilers js:babel-core/register --recursive",
"test-cov": "npm run build && babel-node node_modules/isparta/bin/isparta cover --report html --report text node_modules/.bin/_mocha",
"prepare": "npm run build",
- "prepublishOnly": "npm test && npm run lint",
+ "prepublishOnly": "(test $RUNNING_FROM_SCRIPT || (echo \"You must use publish.sh instead of 'npm publish' directly!\"; exit 1)) && npm test && npm run lint",
"clean": "rm -rf build",
"lint": "npm run build && eslint src test"
},
diff --git a/publish.sh b/publish.sh
index 4071fb357..3b0d6589a 100755
--- a/publish.sh
+++ b/publish.sh
@@ -26,7 +26,7 @@ echo "Pushing to git ..."
git push
echo "Publishing version ${PACKAGE_VERSION} with tag \"${NPM_TAG}\" ..."
-npm publish --tag $NPM_TAG
+RUNNING_FROM_SCRIPT=1 npm publish --tag $NPM_TAG
echo "Tagging git with ${GIT_TAG} ..."
git tag ${GIT_TAG}