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.

fix: convert `@apilink` to `@link` on build (#2949)

Martin Adámekabe1deeb87ad
diff --git a/scripts/typescript_fixes.mjs b/scripts/typescript_fixes.mjs
index dcf1eef65..b936da520 100644
--- a/scripts/typescript_fixes.mjs
+++ b/scripts/typescript_fixes.mjs
@@ -1,11 +1,11 @@
-import { readFileSync, writeFileSync } from 'fs';
+import { readFileSync, writeFileSync } from 'node:fs';
import { globby } from 'globby';
-const files = await globby('packages/*/dist/**/*.d.ts');
+const dtsFiles = await globby('packages/*/dist/**/*.d.ts');
// fix types references
-for (const filepath of files) {
+for (const filepath of dtsFiles) {
const input = readFileSync(filepath, { encoding: 'utf8' }).split('\n');
const output = [];
let changed = false;
@@ -33,6 +33,9 @@ for (const filepath of files) {
output.push('// @ts-ignore optional peer dependency or compatibility with es2022');
output.push(line);
changed = true;
+ } else if (line.includes('@apilink')) {
+ output.push(line.replaceAll('@apilink', '@link'));
+ changed = true;
} else {
output.push(line);
}
@@ -44,3 +47,26 @@ for (const filepath of files) {
writeFileSync(filepath, output.join('\n'));
}
}
+
+const jsFiles = await globby('packages/*/dist/**/*.js');
+
+// convert `@apilink` to `@link` in JS files too
+for (const filepath of jsFiles) {
+ const input = readFileSync(filepath, { encoding: 'utf8' }).split('\n');
+ const output = [];
+ let changed = false;
+
+ for (const line of input) {
+ if (line.includes('@apilink')) {
+ output.push(line.replaceAll('@apilink', '@link'));
+ changed = true;
+ } else {
+ output.push(line);
+ }
+ }
+
+ if (changed === true) {
+ console.log('Writing', filepath);
+ writeFileSync(filepath, output.join('\n'));
+ }
+}