Skip to content
This repository has been archived by the owner on Jun 11, 2020. It is now read-only.

Support scoped packages #155

Closed
mhegazy opened this issue Oct 3, 2016 · 11 comments
Closed

Support scoped packages #155

mhegazy opened this issue Oct 3, 2016 · 11 comments

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Oct 3, 2016

@types can not support scoped packages. this will require:

  • figuring out how they should be defined on DefinitelyTyped
  • How they would be published
  • changes to the ts compiler to find them
@Codesleuth
Copy link

Codesleuth commented Feb 25, 2017

I'd really like to publish typings for @slack/client but I see no way of doing it with the types publisher.
Has anyone made any headway towards thinking about this?

Is it possible to have a package URL such as this: npmjs.com/package/@types/@slack/client?

If not, could we possibly bundle definitions under a common package, so the package could be npmjs.com/package/@types/@slack with package files that match the scoped package e.g. client.d.ts?

@mhegazy
Copy link
Contributor Author

mhegazy commented Mar 2, 2017

I do not think npm supports nested scopes. one option is we can publish to @types/_slack, then use the _ to mean @ later on in the compiler when it is resolving the import.

@blakeembrey
Copy link

@mhegazy Would that mean tossing every definition into the same NPM package and losing versioning as a result? I don't think there's a way to achieve everything without changes to NPM at this point.

@mhegazy
Copy link
Contributor Author

mhegazy commented Mar 2, 2017

Would that mean tossing every definition into the same NPM package and losing versioning as a result?

not sure i understand the question, can you elaborate?

@blakeembrey
Copy link

You suggested putting it under _slack (the module name in this example is @slack/client -> @types/_slack). Is that implying that you would put /client under the @types/_slack module, and if you do, doesn't that mean you can not version this module properly because it's a giant mix of everything under @slack now?

@Codesleuth
Copy link

Codesleuth commented Mar 2, 2017

You're right, a single package for @slack is a bad suggestion; sorry. I think it's unrealistic to expect a change to NPM to support this, and I think using an underscore is probably going to cause further problems in the future.

I don't have a better suggestion for now though... other than to prefix with something unlikely to be chosen for a package name.

@mhegazy
Copy link
Contributor Author

mhegazy commented Mar 4, 2017

Well i was actually thinking of multiple packages.. something like _slack_client or $slack$client.. some sort of serialization...

@blakeembrey
Copy link

Right, but now it'll be difficult for people to install and you can end up with conflicts because the current packages don't serialise in any way - unless they get made consistent with whatever approach you use. That's what I was looking at doing for Typings, but I figured it was reasonable for Typings since a separate tool was doing those mappings - in this case a human needs to do them and do them consistently. It might not be bad if there's an obvious way it'd work.

@Codesleuth
Copy link

Perhaps it's time to open up discussions with NPM? Maybe they have something in the pipeline that will enable support for nested scopes.

@ghost
Copy link

ghost commented Mar 21, 2017

@mhegazy @RyanCavanaugh Can we commit to using @types/foo__bar to represent @foo/bar? Would like to start using it on DefinitelyTyped even if we don't have compiler support yet. See DefinitelyTyped/DefinitelyTyped#15279 (and DefinitelyTyped/DefinitelyTyped#15155).
(Useful: https://github.com/npm/validate-npm-package-name)

appsforartists added a commit to appsforartists/DefinitelyTyped that referenced this issue Nov 30, 2017
Fixes DefinitelyTyped#19974

The type definitions in `@types/jss` don't match the `jss` package on npm, which has nearly 400k monthly downloads.  I'm not sure where to put the definitions currently squatting at `jss`, as it [doesn't appear that](https://www.npmjs.com/~dvtng) @dvtng has published them.

@andy-ms recommended using `__` as a separator in microsoft/types-publisher#155.  Thus, I'm using it for now to free up the `@types/jss` name for the actual `jss` package.  If @dvtng publishes his library to npm, or if types-publisher gets formal scoped package support, the location of the squatting definitions can be revisited.
appsforartists added a commit to appsforartists/DefinitelyTyped that referenced this issue Nov 30, 2017
Fixes DefinitelyTyped#19974

The type definitions in `@types/jss` don't match the `jss` package on npm, which has nearly 400k monthly downloads.  I'm not sure where to put the definitions currently squatting at `jss`, as it [doesn't appear that](https://www.npmjs.com/~dvtng) @dvtng has published them.

@andy-ms recommended using `__` as a separator in microsoft/types-publisher#155.  Thus, I'm using it for now to free up the `@types/jss` name for the actual `jss` package.  If @dvtng publishes his library to npm, or if types-publisher gets formal scoped package support, the location of the squatting definitions can be revisited.
@amcasey
Copy link
Member

amcasey commented Jan 9, 2018

@andy-ms Can this be closed?

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants