Skip to content
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

Allow using scoped package names #272

Closed
Myhlamaeus opened this issue Dec 25, 2017 · 3 comments · Fixed by #275
Closed

Allow using scoped package names #272

Myhlamaeus opened this issue Dec 25, 2017 · 3 comments · Fixed by #275

Comments

@Myhlamaeus
Copy link
Contributor

When using a scope in the package name, both the @ and the / are stripped from the name; @scope/project-name, for example, gets turned into scope-project-name. This makes it quite hard to use this generator for scoped packages (including all private packages), as the name has to be altered in different ways at different places.

Things to consider

  • Should the package name and its scope be treated separately—adding, for example, an option scope to supply the scope?
  • What should happen to @scope/ if the package name and scope are not treated separately?
  • Should the package name really always be turned into kebab-case? example.com, for example, gets turned into example-com through it.
  • Should the scope appear in the default git remote (i.e. in the GitHub repository’s name)?
  • Some of the links in the generated README.md reference the package, and some reference the repository (e.g. npm-url references the package and travis-url the repo)
@SBoudrias
Copy link
Member

We should handle scoped packages way better.

What's the behavior you would expect?

@SBoudrias
Copy link
Member

I think a piece of the solution would be to get rid of the kebab case modification and validate npm package name with https://www.npmjs.com/package/validate-npm-package-name instead.

@SBoudrias
Copy link
Member

I made a WIP PR to fix some of those issues. Still need to work on the URL issue you pointed out.

Can you check the branch out and tell me if it fixes most of your issues?

mischah pushed a commit that referenced this issue Mar 27, 2018
* Add supports for scoped package (Fix #272)

* Streamline option `githubAccount`

* change option name from `github-account` to `githubAccount` in
git/index.js (githubAccount is used everywhere else, and the result is
the same)
* change option description in readme/index.js to match the description
in app/index.js

* Add option `repositoryName`

Add the option `repositoryName`, being the ‘Name of the GitHub
repository’.

* fixup! Add supports for scoped package (Fix #272)

* Update package-lock.json

* fixup! fixup! Add supports for scoped package (Fix #272)

Fix on node@4.x.x

* Bump dependencies (inquirer-npm-name@3)

* Use package scope as default `githubUser`

If a scoped name is supplied, use the scope part (after the `@` and
before the first `/`) as default value for `githubUser`, even ignoring
the `authorEmail` which is otherwise used to find the default value.

* Drop `name`-option from git-generator

* Only write `repository` into pkg if available

Only write `repository` to the package file if both `githubAccount`
and `repositoryName` are passed to the `git`-generator. Re-read the
package before adding the `origin`-remote to repository in case some
other generator has modified it.

* fixup! Use package scope as default `githubUser`

* fixup! Only write `repository` into pkg if available

* fixup! fixup! Only write `repository` into pkg if available

* Remove _readPkg side effects from git subgenerator

* Remove the side effects of _getModuleNameParts

Have `_getModuleNameParts` return an object with the parts of the module
name instead of directly writing it to `props`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants