Comments (19)
I think the TypeScript compiler will look for a bundled .d.ts
file first, before an @types/package
, so maybe this logic should be reversed:
npm-search/src/typescript/index.ts
Lines 69 to 87 in d99c31f
I.e. if a package both contains built-in TypeScript declarations and a @types/package
exists, the built-in declarations should take precedence.
from npm-search.
I already tested the solution from @jablko and it seems to work fine
if @Haroenv approves I can create the PR in no time
from npm-search.
Oh, another problem, looks like Microsoft deleted the "create a search index" function in June:
microsoft/DefinitelyTyped-tools#456 (comment)
Maybe a new method is needed for determining this information:
npm-search/src/typescript/index.ts
Lines 24 to 40 in d99c31f
from npm-search.
I can see two possible improvements here:
- make sure to exclude deprecated definitely-typed packages (does that count as builtin or no typescript support? usually it happens when the package adds their own TS definitions, but it could also be deprecated completely)
- improve the check in this project which reads the file names so it also detects yup as having typescript support (if it's correct of course) (this file exists: unpkg.com/browse/[email protected]/es/index.d.ts)
Are you interested in investigating those?
I think @Josehower would take over 2. above, I'll let him continue here.
from npm-search.
DM me on Twitter, I can set you up with a testing account for this :) it needs large limits
from npm-search.
Maybe it's taking the current version [email protected]
which does not have "types": "./index.d.ts"
:
https://registry.npmjs.org/yup/0.32.11
from npm-search.
I have created a PR that applies fix from @jablko
good energy 👍👍👍👍
from npm-search.
I think with the changed order, the point 1 no longer is needed, unless you see some cases where that would still be relevant?
from npm-search.
I think the logic for deciding what's typed is wrong in the algolia index. npm correctly detects that there's .d.ts inside the es
folder, but we don't.
I can see two possible improvements here:
- make sure to exclude deprecated definitely-typed packages (does that count as builtin or no typescript support? usually it happens when the package adds their own TS definitions, but it could also be deprecated completely)
- improve the check in this project which reads the file names so it also detects yup as having typescript support (if it's correct of course) (this file exists: https://unpkg.com/browse/[email protected]/es/index.d.ts)
Are you interested in investigating those?
from npm-search.
Thanks for noticing that, that's indeed problematic. This probably means we need to do a reindex once this is fixed to catch packages that were added to DT since
from npm-search.
Ok added a new issue for this, since it's a bit unrelated: #1090
from npm-search.
Hi @Haroenv thanks for your time,
I have been trying to setup the project on my machine so try to research a bit more about the problem or potential solutions to it, but I can't make the app to run locally is asking me a API key, i tried with the API key we use on one of our services but it didn't work.
➜ npm-search git:(master) yarn dev
Dec 6 15:22:24 🗿 npm ↔️ Algolia replication starts ⛷ 🐌 🛰 { version: '1.7.13' }
Dec 6 15:22:24 💪 Setting up Algolia OFCNCOG2CU [ 'npm-search-bootstrap', 'npm-search' ]
Dec 6 15:22:24 ⛑ API started on port 8000
Dec 6 15:22:25 {
err: {
name: 'ApiError',
message: 'Method not allowed with this API key',
status: 403,
transporterStackTrace: [ [Object] ]
}
}
err: Error: Error during run
at ./dist/src/index.js:99:23
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Dec 6 15:22:25 Close was requested
Dec 6 15:22:25 Stopped Main gracefully
Wondering how can I get that API key to make it work of if there is an specific setup that need to be done, unfortunately I didn't have success with the setup on CONTRIBUTING.md
UPDATE: new error message after testing the setup on https://github.com/algolia/npm-search/blob/master/CONTRIBUTING.md
from npm-search.
That would solve the original problem in upleveled/preflight, I think: https://github.com/upleveled/preflight/blob/5af8a398ec370c79e22ab770307ec81d574c8e29/src/checks/noDependencyProblems/noDependenciesWithoutTypes.ts#L63-L67
where you're getting @types/yup
for a package that contains built-in declarations.
from npm-search.
The order was chosen for performance, as DT doesn't require any extra network requests. Maybe if it's deprecated we still fall through to "included" checks, but regularly we keep DT first?
from npm-search.
I'm not familiar with how Algolia npm-search works, I'm kinda surprised yup
falls through the first case:
npm-search/src/typescript/index.ts
Lines 64 to 67 in d99c31f
Are GetPackage
and NicePackage
not the npm registry metadata, which contains "types": "./index.d.ts"
for yup
? https://registry.npmjs.org/yup
Lines 64 to 67 in d99c31f
Line 134 in d99c31f
from npm-search.
Wonder if that's actually a bug / missing feature in the npm feature of adding types information to the registry:
(because in this case, the index.d.ts
file for [email protected]
is in the esm/
directory)
cc @orta
from npm-search.
Probably that version of yup was published with a version of the npm CLI/pacote that hadn't implemented the RFC yet?
from npm-search.
The order was chosen for performance, as DT doesn't require any extra network requests. Maybe if it's deprecated we still fall through to "included" checks, but regularly we keep DT first?
If Algolia npm-search indexes all the npm packages, and there are only about 8,000 DT types, is the performance of keeping DT first significant?
from npm-search.
@Josehower @Haroenv Thanks for creating and merging #1091 🙌
I think this hasn't taken into account the second improvement that @Haroenv mentioned above though:
- make sure to exclude deprecated definitely-typed packages (does that count as builtin or no typescript support? usually it happens when the package adds their own TS definitions, but it could also be deprecated completely)
@Haroenv can you reopen this? Or should I create a new issue for this improvement?
from npm-search.
Related Issues (20)
- Switch to new source of DefinitelyTyped data? HOT 5
- Fix deployment and deploy the latest version HOT 1
- Package missing from package index
- Published package not showing up in search
- 4+ days indexing delay HOT 25
- Fix FALSE advertising! Algolia npm-search has failed, it's not resilient. HOT 1
- Intermittent npm failing test because of jest timeout HOT 5
- Reconfigure/disable renovate HOT 8
- API Control failed
- [wip] API Control failed
- [wip] API Control failed
- API Control automated check have failed HOT 2
- Consider lowering the importance of "proximity" in ranking HOT 4
- Consider changing "exactOnSingleWordQuery" to "word" HOT 2
- Fix docker publishing HOT 3
- > 5 days delay in indexing HOT 5
- Improve ranking HOT 27
- Outdated package normalization HOT 4
- Gracefully handle 429 responses HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npm-search.