apify / browser-pool

A Node.js library to easily manage and rotate a pool of web browsers, using any of the popular browser automation libraries like Puppeteer, Playwright, or SecretAgent.
87 stars 14 forks source link

Support Typescript #83

Closed milad2golnia closed 1 year ago

milad2golnia commented 1 year ago

Do you have any support for typescript?

$ npm i --save-dev @types/browser-pool                                                                                                                             ─╯
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fbrowser-pool - Not found
npm ERR! 404 
npm ERR! 404  '@types/browser-pool@*' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/milad/.npm/_logs/2022-11-12T13_54_46_128Z-debug-0.log
B4nan commented 1 year ago

This repository is no longer maintained, browser pool is now part of crawlee, and yes, it is full TS rewrite:

https://github.com/apify/crawlee/tree/master/packages/browser-pool

B4nan commented 1 year ago

Actually even browser pool v2 was full TS project. There are no @types packages - those are only for non-TS projects, the types were always included in the main package.

milad2golnia commented 1 year ago

The problem was that when I included browser-pool:

import { BrowserPool, PlaywrightPlugin } from 'browser-pool';

It gave me following error:

Could not find a declaration file for module 'browser-pool'. '[...]/node_modules/browser-pool/dist/index.mjs' implicitly has an 'any' type.
  Try `npm i --save-dev @types/browser-pool` if it exists or add a new declaration (.d.ts) file containing `declare module 'browser-pool';

And this is why I tried to install @types. Thank you for introducing crawlee, It's working fine.

Suggestion: If this repository is not longer maintained, I suggest to mark it as deprecated in both github and npm and also give a link to crawlee in deprecation message.

Thanks for your great packages and team <3