Adding SQL Edge project template (#13558)

* Checkpoint

* removing flag for not creating subfolder

* Adding Edge template

* Removing janky map function

* Adding templates for additional objects

* Updating tests, fixing bug

* Added Edge project icon

* Updating strings to Drew-approved text

* Cleaning up template scripts and Edge project template names
This commit is contained in:
Benjin Dubishar
2020-12-03 10:33:31 -08:00
committed by GitHub
parent 08735c9434
commit fde031be48
15 changed files with 230 additions and 67 deletions

View File

@@ -282,19 +282,26 @@ export class Project {
* @param contents Contents to be written to the new file
*/
public async addScriptItem(relativeFilePath: string, contents?: string, itemType?: string): Promise<FileProjectEntry> {
// check if file already exists
const absoluteFilePath = path.join(this.projectFolderPath, relativeFilePath);
if (contents !== undefined && contents !== '' && await utils.exists(absoluteFilePath)) {
throw new Error(constants.fileAlreadyExists(path.parse(absoluteFilePath).name));
}
// create the file
if (contents) {
await fs.mkdir(path.dirname(absoluteFilePath), { recursive: true });
await fs.writeFile(absoluteFilePath, contents);
}
//Check that file actually exists
// check that file was successfully created
let exists = await utils.exists(absoluteFilePath);
if (!exists) {
throw new Error(constants.noFileExist(absoluteFilePath));
}
// update sqlproj XML
const fileEntry = this.createFileProjectEntry(relativeFilePath, EntryType.File);
let xmlTag;