-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flag for TypeScript modules #126
base: master
Are you sure you want to change the base?
Conversation
29b4a2a
to
0c5865a
Compare
Coverage increased (+0.004%) to 97.41% when pulling 0c5865aaa367d3fa1ae3bd3c8314b85429982b23 on blakeembrey:types-flag into 79279de on npms-io:master. |
Coverage increased (+0.004%) to 97.41% when pulling 0c5865aaa367d3fa1ae3bd3c8314b85429982b23 on blakeembrey:types-flag into 79279de on npms-io:master. |
🎉 So awesome! 🏆 Great idea and great initiative! I will look into more detail tomorrow (it's already 1AM in Portugal 😄). In the meantime, I'm not entirely sure about the "is:typescript", because semantically it means that it's written in TypeScript but the flag just means that it's TypeScript compatible. @satazor look at this! 😃 |
@atduarte Absolutely, that's understandable. Thanks for responding! I was worried no one would after I logged the first issue as a suggestion 😄 I stuck with the Edit: Maybe |
Could you let me know if there was an issue with the PR? |
Sorry I closed this by mistake, I multi-selected several greenkeeper related issues and selected this by mistake! |
Coverage decreased (-0.6%) to 96.802% when pulling 0c5865aaa367d3fa1ae3bd3c8314b85429982b23 on blakeembrey:types-flag into 79279de on npms-io:master. |
lib/analyze/collect/source.js
Outdated
@@ -34,6 +34,7 @@ function inspectFiles(data, dir) { | |||
testsSize: detectRepoTestFiles(dir).then((files) => fileSize(files)), | |||
hasNpmIgnore: isRegularFile(`${dir}/.npmignore`).then((is) => is || null), | |||
hasShrinkwrap: isRegularFile(`${dir}/npm-shrinkwrap.json`).then((is) => is || null), | |||
hasTypes: isRegularFile(path.join(dir, data.typings || data.types || 'index.d.ts')).then((is) => is || null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great, except the hasTypes
which is too generic and doesn't resemble typescript. Can you change to something more explicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. How about naming it hasTypeScript
instead?
@satazor I updated it to |
Coverage increased (+0.005%) to 96.812% when pulling 769f56472839ea0b9fac35b3fc6aeb93e444e5e6 on blakeembrey:types-flag into 69cade6 on npms-io:master. |
1 similar comment
Coverage increased (+0.005%) to 96.812% when pulling 769f56472839ea0b9fac35b3fc6aeb93e444e5e6 on blakeembrey:types-flag into 69cade6 on npms-io:master. |
@blakeembrey Yes I would convert it to a string just to be sure otherwise Regarding the isTypeScript, etc. I agree with @atduarte: we should make it clear that the package has ts typings instead of assuming it's typescript. There are a lot of packages that are not written in ts but offer typings. What about hasTypeScript -> hasTypeScriptTypes, is:typescript has:typescript-types? Too verbose? |
@satazor Yes, I can do that. In that case, should I change For "is typescript", I definitely understand the want to have a better distinction. Since the query is case-insensitive and likely typed often, something simple would be nice. That was why I went with the simple solutions of |
@blakeembrey Yes you can! I like the idea of adding |
Is there an existing approach to aliases? I went ahead with the |
Hopefully this isn't dead, as it would be a great feature to have; since migrating to TS I've found that finding high-quality typed packages to be one of the most difficult, or at least time consuming, aspects. Syntactically, what about something like Also, it'd nice if during the analysis (or whenever), it also checked for a DefinitelyTyped repo under the same name, (e.g. jquery isn't authored in TS or come with bundled definitions, but they exist at |
For the Yarn search powered by Algolia's npm-search index we ended up with this object shape: Not included: {
types: { ts:false }
} In definitely typed: {
types: {
ts: 'definitely-typed',
definitelyTyped: '@types/my-lib',
}
} Embedded inside the dependency {
types: { ts: 'included' }
} Basically: type TypeAvailability =
| { ts: false }
| { ts: "definitely-typed", definitelyTyped: string }
| { ts: "included" }
interface Result {
...
types: TypeAvailability
} This allows tools like the TypeScript playground to make type acquisition with a lot less networking requests, as well as the option to one day add flow support. Maybe having the same shape solves the discussion and lets it be consistent? I know the NPM folks have been interested in getting this feature on the npm site, so it might be worth trying to get this back alive. |
Guidance on a feature like this would be extremely useful. Let me know if anything is missing for this functionality. I am hoping to enable a flag like
is:typescript
(oris:types
?) so people can find NPM packages that publish TypeScript definitions (TypeScript users can have trouble finding modules they can use currently, this feature would show TypeScript users the packages that publish with a type definition).Edit: Also, is there a way to populate the fixtures programmatically so I can enable a test case?