(
outputFolder: string,
prerelease: boolean,
packageName: string,
vscodePlatformId?: string
)
| 11 | |
| 12 | /// Packaging (VSIX) Tasks |
| 13 | export async function createPackageAsync( |
| 14 | outputFolder: string, |
| 15 | prerelease: boolean, |
| 16 | packageName: string, |
| 17 | vscodePlatformId?: string |
| 18 | ): Promise<string> { |
| 19 | const vsceArgs = []; |
| 20 | let packagePath = undefined; |
| 21 | |
| 22 | if (!(await util.fileExists(vscePath))) { |
| 23 | throw new Error(`vsce does not exist at expected location: '${vscePath}'`); |
| 24 | } |
| 25 | |
| 26 | vsceArgs.push(vscePath); |
| 27 | vsceArgs.push('package'); // package command |
| 28 | |
| 29 | if (!fs.existsSync(outputFolder)) { |
| 30 | fs.mkdirSync(outputFolder); |
| 31 | } |
| 32 | |
| 33 | vsceArgs.push('-o'); |
| 34 | packagePath = path.join(outputFolder, packageName); |
| 35 | vsceArgs.push(packagePath); |
| 36 | |
| 37 | if (vscodePlatformId !== undefined) { |
| 38 | vsceArgs.push('--target'); |
| 39 | vsceArgs.push(vscodePlatformId); |
| 40 | } |
| 41 | |
| 42 | if (prerelease) { |
| 43 | vsceArgs.push('--pre-release'); |
| 44 | } |
| 45 | |
| 46 | vsceArgs.push('--baseContentUrl', 'https://github.com/dotnet/vscode-csharp'); |
| 47 | |
| 48 | const spawnResult = await spawnNode(vsceArgs); |
| 49 | if (spawnResult.code != 0) { |
| 50 | throw new Error(`'${vsceArgs.join(' ')}' failed with code ${spawnResult.code}.`); |
| 51 | } |
| 52 | |
| 53 | if (packagePath) { |
| 54 | if (!(await util.fileExists(packagePath))) { |
| 55 | throw new Error(`vsce failed to create: '${packagePath}'`); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | return packagePath; |
| 60 | } |
| 61 | |
| 62 | export async function generateVsixManifest(vsixPath: string) { |
| 63 | const vsceArgs = []; |
no test coverage detected