-
Notifications
You must be signed in to change notification settings - Fork 136
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
Remove reliance on func cli for 'Create new project' #63
Conversation
Benefits: 1. User can now create project and function without func cli (they only need the cli for debugging) 1. We can now prompt the user to overwrite existing files 1. We can automatically detect if we should git init the folder
@@ -1,6 +1,6 @@ | |||
# Azure Functions for Visual Studio Code (Preview) | |||
|
|||
## Prerequisites | |||
## Prerequisites for local debugging | |||
* [Node v8.0+](https://nodejs.org/) | |||
* Older versions of node will be supported soon. See issue [#1](https://github.com/Microsoft/vscode-azurefunctions/issues/1) | |||
* [.NET Core 2.0](https://www.microsoft.com/net/download/core) |
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.
Are you sure this is true? I had thought apps were supposed to install .net core libs with their app.
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.
Yep: https://docs.microsoft.com/azure/azure-functions/functions-run-local
They're supposed to bundle .net core libs with their app, but they haven't done that quite yet (After all, the cli is still technically in preview)
src/commands/createFunction.ts
Outdated
} else { | ||
async function validateIsFunctionApp(outputChannel: vscode.OutputChannel, functionAppPath: string, ui: IUserInterface): Promise<void> { | ||
if (requiredFunctionAppFiles.find((file: string) => !fse.existsSync(path.join(functionAppPath, file))) !== undefined) { | ||
const message: string = localize('azFunc.notFunctionApp', 'The current folder is not a function app project. Initialize Project?'); |
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.
selected folder?
src/utils/fs.ts
Outdated
|
||
export function isSubPath(fsPath1: string, fsPath2: string): boolean { | ||
const relativePath: string = path.relative(fsPath1, fsPath2); | ||
return relativePath !== '' && !relativePath.startsWith('..'); |
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.
nit: seems like !== '' not necessary
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 I remove that check, then you get 'true' if the paths are the same.
It doesn't seem like /example/path/
is a subfolder of /example/path/
src/utils/fs.ts
Outdated
return relativePath === ''; | ||
} | ||
|
||
export function isSubPath(fsPath1: string, fsPath2: string): boolean { |
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 comment which is being checked as parent and which as child.
test/fsUtils.test.ts
Outdated
import * as assert from 'assert'; | ||
import * as fsUtils from '../src/utils/fs'; | ||
|
||
suite('fsUtils Tests', () => { |
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 want to test with "c:", etc., and paths without a common prefix
Benefits:
This results in a little bit of copied logic between us and the func cli, but the benefits outweigh that drawback
Fixes #24
Fixes #21 (since func cli is not required until debugging anymore)
Fixes #18 (since func cli output isn't logged in the output window anymore)