mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
* Initial changes * checkpoint * Constructing project with post deployment script * Correcting to intentionally read from cached list of projects * Adding activation event, fixing fresh workspace bug * Convert netcoreTool and autorestHelper to share a helper class for streamed command * Include npm package version to force update * test checkpoint * Unit tests * Added contextual quickpicks for autorest dialogs * Adding projectController test * Added projectController test, some refactoring for testability * Merge branch 'main' into benjin/autorest * Fixing 'which' import * PR feedback * Fixing tests * Adding additional information for when project provider tests fail * Hopefully fixing failing tests (unable to repro locally) * Adding Generate Project item to workspace menu * PR feedback
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as os from 'os';
|
|
import * as path from 'path';
|
|
import { IProjectType } from 'dataworkspace';
|
|
import { promises as fs } from 'fs';
|
|
import { ProjectProviderRegistry } from '../common/projectProviderRegistry';
|
|
|
|
export const testProjectType: IProjectType = {
|
|
id: 'tp1',
|
|
description: '',
|
|
projectFileExtension: 'testproj',
|
|
icon: '',
|
|
displayName: 'test project'
|
|
};
|
|
|
|
/**
|
|
* Creates a unique test project file
|
|
* @param fileExt
|
|
* @param contents
|
|
*/
|
|
export async function createProjectFile(fileExt: string, contents?: string): Promise<string> {
|
|
const filepath = generateUniqueProjectFilePath(fileExt);
|
|
await fs.writeFile(filepath, contents ?? '');
|
|
|
|
return filepath;
|
|
}
|
|
|
|
export function generateUniqueProjectFilePath(fileExt: string): string {
|
|
return path.join(os.tmpdir(), `TestProject_${new Date().getTime()}.${fileExt}`);
|
|
}
|
|
|
|
export function prettyPrintProviders(): string {
|
|
return `${ProjectProviderRegistry.providers.map(p => `[${p.supportedProjectTypes.map(t => t.id).join(', ')}]`).join('; ')}`;
|
|
}
|