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
fix: sandbox client config options #643
Conversation
🦋 Changeset detectedLatest commit: 79acaf7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
LGTM, one additional change to consider
@@ -105,7 +105,7 @@ void describe('sandbox command', () => { | |||
assert.match(output, /--dir-to-watch/); | |||
assert.match(output, /--exclude/); | |||
assert.match(output, /--format/); |
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.
Just chatted with the PMs and they suggested changing this to config-format
for consistency. If you want to roll that into this PR you could, or do a follow up PR.
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 can add that to this PR. What is your opinion on e2e testing config-format
and config-out-dir
? I can follow up with another PR when I address #403 or should it be a part of this PR?
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.
Renamed to config-format
in ece9635
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'm okay with e2e tests going in a follow up PR. When you do get to that, I suggest adding this as an additional assertion on the existing sandbox test rather than a whole new test.
validateDirectory = (option: string, dir: string) => { | ||
let stats; | ||
try { | ||
stats = fs.statSync(dir, {}); |
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.
it seems that check
might be supporting async functions.
Can you give it a try and convert this to async?
Ref: yargs/yargs#1872
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.
Was not aware of this, good to know and done in 4cb5b72.
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.
any file system access if possible should be made async so that event loop is not blocked.
args['config-out-dir'], | ||
args['config-format'] |
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.
can we add a test which asserts that these values are flowing correctly?
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 in 70969c4
@@ -201,4 +196,16 @@ export class SandboxCommand | |||
await this.sandboxFactory.getInstance() | |||
).delete({ name: this.sandboxName }); | |||
}; | |||
|
|||
validateDirectory = async (option: string, dir: 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.
This should be private
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 in 79acaf7
Issue #, if available:
Description of changes:
sandbox --out-dir
option tosandbox --config-out-dir
config-out-dir
to client config lifecycle handler so the option is respectedsandbox --format
was the same and fixed that as wellsandbox --format
option tosandbox --config-format
amplify sandbox --config-out-dir src --config-format ts
will generate the client config in the specifiedsrc
directory and with the provided format:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.