-
Notifications
You must be signed in to change notification settings - Fork 940
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
feat: component marked as peer #8561
feat: component marked as peer #8561
Conversation
|
||
async report([componentId, range]: [string, string]) { | ||
await this.deps.setPeer(componentId, range != null ? range.toString() : range); | ||
return ''; |
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.
write some success message here
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.
done
helper.command.build(); | ||
workspaceCapsulesRootDir = helper.command.capsuleListParsed().workspaceCapsulesRootDir; | ||
}); | ||
it('should save the peer dependency in the model', () => { |
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.
I would add another test with snap/tag and validate the component data after it
for both the always peer component (make sure that data of always peer is stored) and the dependent component (make sure it was stored with peer dep)
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.
done
const existingDependency = this.getExistingDependency(this.allDependencies.dependencies, dependency.id); | ||
const existingDevDependency = this.getExistingDependency(this.allDependencies.devDependencies, dependency.id); | ||
// no need to enter dev dependency to devDependencies if it exists already in dependencies | ||
if (existingDependency || (existingDevDependency && fileType.isTestFile)) { | ||
if (existingDependency || (existingDevDependency && opts.fileType.isTestFile)) { |
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.
I wonder what happens if you have a dependency without the always peer.
then you tag both components.
then you change the always peer to true.
maybe it will get into this condition and won't move to be peer?
worth validating
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.
added a test
} else if (opts.isPeer) { | ||
this.allDependencies.peerDependencies.push(currentComponentsDeps); |
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.
if it's used from a test file, should we make it dev dep or peer dep here?
that's a question. not sure about it.
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.
I think it should be a dev dep in that case. Test files are not used when the package is installed as a dependency, which is when peer deps are useful.
Proposed Changes