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

Only use the last fragment of the package name #28

Merged
merged 5 commits into from
Aug 12, 2016
Merged

Conversation

Poetro
Copy link
Member

@Poetro Poetro commented Aug 11, 2016

Description

Only use the last fragment of the package name

Motivation and Context

Solves #26

How Was This Tested?

See #4;
also

mkdir temp && cd temp && npm init -y --scope=@zambezi && \
mkdir src && touch src/index.js && ez-build --production && \
ls temp-min.js
temp-min.js

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change follows the style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the contribution guidelines
  • I have added tests to cover my changes
  • All new and existing tests passed

@@ -25,13 +25,14 @@ async function main() {

var pkg = await readPkg(pkgFile)

pkg.name = (pkg.name || 'unknown').split('/').pop()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think readPkg works if there's no name, but in any event if there's no name we should just exit early with an error rather than default a name.

@mstade
Copy link
Member

mstade commented Aug 11, 2016

This is a way to solve the output issue for sure, but really the scope is part of the package name and so this is fixing it in the wrong place. I think we should probably just fix this where the files are actually written, here and here. Indeed, as you pointed out in chat, the -o,--out <prefix> option is broken so those two lines should be changed to use opts.out instead of pkg.name altogether, fixing two bugs in one PR. We should obviously fix the default of that option by popping off just the package name. That oughta do it.

@mstade
Copy link
Member

mstade commented Aug 11, 2016

Solid PR, thanks!

@mstade
Copy link
Member

mstade commented Aug 12, 2016

This works great – thanks! I'll release 0.4.1, and add tests in a later PR.

@mstade mstade merged commit 33ee7da into master Aug 12, 2016
@mstade mstade deleted the scoped-package-26 branch August 12, 2016 12:04
mstade added a commit that referenced this pull request Aug 15, 2016
Bug fixed in PR #28, these tests verify it.
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 this pull request may close these issues.

None yet

2 participants