- Notifications
You must be signed in to change notification settings - Fork 74
@W-19441295 Bundles CLI - sfdx-core #1236
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
Conversation
added the nessary commands to endit the sfdx json for bundle aliases and entries
…18671326/Package-Bundle-Create-command feat: added commands for bundles
src/sfProject.ts Outdated
| /** | ||
| * Has at least one package bundle alias defined in the project. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/require-await |
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.
Please add a return type, remove async if it's not required
| return this.packageBundleAliases; | ||
| } | ||
| | ||
| public getPackageBundleIdFromAlias(alias: string): Optional<string> { |
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.
might be an equivalent type, but this actually returns string | undefined
test/unit/project.test.ts Outdated
| const json = await SfProjectJson.create(); | ||
| json.set('packageBundleAliases', { MyName: 'someBundle' }); | ||
| await json.write(); | ||
| // @ts-expect-error possibly undefined |
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.
we can remove this directive by using a ! on the type where it's undefined, or by asserting that the response is defined.
consider this because you'll see this in the consuming code otherwise
| it('should add a new package bundle when no package bundles exist', () => { | ||
| $$.setConfigStubContents('SfProjectJson', { | ||
| contents: { | ||
| packageBundles: [], |
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.
would this packageBundles key exist before package bundles exist, what about the case when there's nothing new in sfdx-project.json?
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 new test case
| project.getSfProjectJson().addPackageBundle({ | ||
| name: 'testBundle', | ||
| versionName: 'testBundle', | ||
| versionNumber: '1.0.0.0', |
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.
could consider changing something in this one that you're adding (and asserting the new value is present), to ensure it's adding correctly
test/unit/project.test.ts Outdated
| }); | ||
| | ||
| const project = SfProject.getInstance(); | ||
| expect(project.getSfProjectJson().getPackageBundleAliases()).to.not.be.ok; |
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.
to.be.undefined
test/unit/project.test.ts Outdated
| }); | ||
| | ||
| const project = SfProject.getInstance(); | ||
| expect(project.getSfProjectJson().hasPackageBundleAliases()).to.not.be.false; |
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.
"'should return false no bundlealiases are defined'"
=>
to.not.be.false;
something isn't lining up here
test/unit/project.test.ts Outdated
| }); | ||
| | ||
| const project = SfProject.getInstance(); | ||
| expect(project.getSfProjectJson().hasPackageBundleAliases()).to.not.be.true; |
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.
same comment , why the double negatives? to.be.false?
test/unit/project.test.ts Outdated
| alias1: '1Flxxxxxxxxxxxxxxx', | ||
| }); | ||
| }); | ||
| it('should not find id of alias by name when name not in aliases collection', () => { |
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.
"should not find id of aliias" => we're expecting the result to equal what it's defined as
src/sfProject.ts Outdated
| * @param bundleEntry | ||
| */ | ||
| public addPackageBundle(bundleEntry: BundleEntry): void { | ||
| const bundles: BundleEntry[] = this.getPackageBundles(); |
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.
we may be able to allow TS to infer this type : BundleEntry[] from the method returns, so try removing that and the type definition on 362 and see if it'll work
@W-19441295@
What does this PR do?
What issues does this PR fix or reference?