-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove reliance on func cli for 'Create new project' (#63)
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
- Loading branch information
Showing
12 changed files
with
361 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { localize } from './localize'; | ||
|
||
export namespace DialogResponses { | ||
export const skipForNow: string = localize('azFunc.SkipForNow', 'Skip for now'); | ||
export const yes: string = localize('azFunc.Yes', 'Yes'); | ||
export const no: string = localize('azFunc.No', 'No'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as cp from 'child_process'; | ||
import * as vscode from 'vscode'; | ||
import { localize } from '../localize'; | ||
|
||
export namespace cpUtils { | ||
export async function executeCommand(outputChannel: vscode.OutputChannel | undefined, workingDirectory: string, command: string, ...args: string[]): Promise<void> { | ||
await new Promise((resolve: () => void, reject: (e: Error) => void): void => { | ||
const options: cp.SpawnOptions = { | ||
cwd: workingDirectory, | ||
shell: true | ||
}; | ||
const childProc: cp.ChildProcess = cp.spawn(command, args, options); | ||
|
||
if (outputChannel) { | ||
childProc.stdout.on('data', (data: string | Buffer) => outputChannel.append(data.toString())); | ||
childProc.stderr.on('data', (data: string | Buffer) => outputChannel.append(data.toString())); | ||
} | ||
|
||
childProc.on('error', reject); | ||
childProc.on('close', (code: number) => { | ||
if (code !== 0) { | ||
reject(new Error(localize('azFunc.commandError', 'Command "{0} {1}" failed with exit code "{2}".', command, args.toString(), code))); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
Oops, something went wrong.