-
Notifications
You must be signed in to change notification settings - Fork 409
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
Use functions-core
lib for Create Function
command
#3429
Conversation
let showTextDocumentStub: SinonStub; | ||
let gatherStub: SinonStub; | ||
const functionInfoJS = { | ||
type: 'CONTINUE' as 'CONTINUE', |
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 hurts my eyes a little bit, but I get a typescript error when I don't include as CONTINUE
switch (language) { | ||
case LANGUAGE_JAVASCRIPT: | ||
metadata = MetadataDictionary.getInfo(FUNCTION_TYPE_JS); | ||
metadata!.suffix = '.js'; |
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 don't think we need to use metadata!.suffix. A const fileExtension
or something seems cleaner to me. Thoughts?
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.
Agree! But, all the definitions in metadataDictionary (apexclass, triggers etc) all use suffix and this will be a much bigger refactor. I'm fine with that if you still want to, but can we make it a separate PR?
); | ||
const document = await vscode.workspace.openTextDocument(outputFile); | ||
vscode.window.showTextDocument(document); | ||
channelService.appendLine('Installing dependencies...'); |
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 if it's also worth using spawn
instead of exec
below and streaming the install output so users can see specifically what is going on
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.
In this particular case, product wanted this to be a background process with limited user visibility and we don't show any notification popups either.
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.
Ah I seem should I remove this line as well then?
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.
As discussed on slack, this can remain as is.
@@ -88,6 +88,7 @@ export type LocalComponent = DirFileNameSelection & { | |||
suffix?: string; | |||
}; | |||
|
|||
export type FunctionInfo = DirFileNameSelection & { | |||
export type FunctionInfo = { | |||
fileName: 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.
Why don't we need the directory path anymore?
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.
Ok, so generateFunction takes language and figures out the path itself it looks like.
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 previously we used DirFileNameSelection
which provided outputDir
in order to satisfy the requirements of BaseTemplateCommand
, but it was never actually set.
Merged by #3476 |
What does this PR do?
Replace CLI usage with library for
Create Function
, reducing execution time greatly. Additionally, add typescript supportWhat issues does this PR fix or reference?
@W-9620937@
Functionality Before
<insert gif and/or summary>
Functionality After
<insert gif and/or summary>