MCPcopy
hub / github.com/dotnet/vscode-csharp / doPackageOffline

Function doPackageOffline

tasks/packaging/offlinePackagingTasks.ts:339–377  ·  view source on GitHub ↗
(vsixPlatform: VSIXPlatformInfo | undefined, prerelease: boolean)

Source from the content-addressed store, hash-verified

337}
338
339async function doPackageOffline(vsixPlatform: VSIXPlatformInfo | undefined, prerelease: boolean) {
340 await cleanAsync();
341 // Set the package.json version based on the value in version.json.
342 const versionInfo = await nbgv.getVersion();
343 console.log(versionInfo.npmPackageVersion);
344 await nbgv.setPackageVersion();
345
346 if (prerelease) {
347 console.log('Packaging prerelease version.');
348 } else {
349 console.log('Packaging release version.');
350 }
351
352 try {
353 // Now that we've updated the version, get the package.json.
354 const packageJSON = getPackageJSON();
355
356 if (process.platform === 'win32' && !vsixPlatform?.rid.startsWith('win')) {
357 console.warn(
358 `Skipping packaging for ${vsixPlatform?.rid} on Windows since runtime executables will not be marked executable in *nix packages.`
359 );
360 return;
361 }
362
363 if (vsixPlatform === undefined) {
364 await buildVsix(packageJSON, packedVsixOutputRoot, prerelease);
365 } else {
366 await buildVsix(packageJSON, packedVsixOutputRoot, prerelease, vsixPlatform);
367 }
368 } catch (err) {
369 const message = (err instanceof Error ? err.stack : err) ?? '<unknown error>';
370 // NOTE: Extra `\n---` at the end is because gulp will print this message following by the
371 // stack trace of this line. So that seperates the two stack traces.
372 throw Error(`Failed to create package ${vsixPlatform?.vsceTarget ?? 'undefined'}. ${message}\n---`);
373 } finally {
374 // Reset package version to the placeholder value.
375 await nbgv.resetPackageVersionPlaceholder();
376 }
377}
378
379async function cleanAsync() {
380 // Read the .gitignore file and remove all directories which are in the form `.{folder}}/`

Callers 4

vsixReleasePackageTaskFunction · 0.85

Calls 6

getPackageJSONFunction · 0.90
cleanAsyncFunction · 0.85
buildVsixFunction · 0.85
ErrorInterface · 0.85
logMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected