mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-29 02:45:58 +01:00
0b56f62682
* build: derive GitHub token from Monaco GitHub App instead of PAT Replace the github-distro-mixin-password PAT (subject to 7-day rotation) with a GitHub App installation token extracted from the persisted checkout credentials. The token is republished under the same variable name to avoid churning the many GITHUB_TOKEN consumers, and the distro netrc auth now uses the x-access-token login. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: probe vscode-distro checkout via Monaco GitHub App endpoint Reverts the failed token-extraction approach (1ES persists only a credential placeholder, so the GitHub App token cannot be read from disk). Instead validate Option A: add microsoft/vscode-distro as a pipeline repository resource authenticated via the Monaco GitHub App endpoint, then check out the exact pinned SHA locally. This probe job confirms the agent can authenticate the distro checkout and that a local `git checkout <sha>` resolves the pinned commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: check out vscode-distro via Monaco GitHub App instead of PAT Replace the PAT-based zipball download of the private microsoft/vscode-distro repository with an agent-authenticated checkout of the distro repository resource (Monaco GitHub App). The distro is checked out into .build/distro and the pinned commit from package.json is checked out locally, preserving the existing contract for mixin-npm.ts / mixin-quality.ts. Self is pinned to the default sources directory so the added distro checkout does not relocate it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: route vscode-capi and vscode-encrypt through Monaco GitHub App The github-distro-mixin-password PAT was also (via netrc) authenticating two other private repositories that are no longer reachable once the netrc is gone: - vscode-capi: cloned by common/mixin-vscode-capi.yml. Now checked out as a Monaco GitHub App repository resource and consumed from .build/vscode-capi. - vscode-encrypt: a cargo git dependency injected by the distro cli-patches. Checked out via the Monaco GitHub App and redirected with git insteadOf to the local checkout so cargo (CARGO_NET_GIT_FETCH_WITH_CLI) resolves it without a PAT. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: also route vsda cargo dependency through Monaco GitHub App The distro cli-patches inject both vscode-encrypt and vsda as private cargo git dependencies. Add vsda as a Monaco GitHub App repository resource and redirect it to a local checkout via git insteadOf, mirroring the vscode-encrypt handling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: drop github-distro-mixin-password PAT Replace the broad github-distro-mixin-password PAT with: - Monaco GitHub App repo-resource checkouts for private repos (vscode-distro, vscode-capi, vscode-encrypt, vsda) - the public github-token-code-oss secret (vscode-oss-build-secrets keyvault) for generic GITHUB_TOKEN rate-limit usages Copilot now checks out vscode-capi via the Monaco App instead of a netrc clone; checkDistroCommit derives the distro branch head from the local checkout instead of the private GitHub API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: check out vscode-extensions-loc via Monaco App The copilot l10n import cloned the private microsoft/vscode-extensions-loc repository with the distro PAT. Replace it with a Monaco GitHub App repo-resource checkout (sparse) so no PAT is needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: download prebuilt Electron from Azure Artifacts feed Replaces the private GitHub release download (which required the github-distro-mixin-password PAT) with an on-demand fetch from the vscode-electron-prebuilt Azure Artifacts feed, via the new asset-resolver support in @vscode/gulp-electron 1.42.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: resolve private vsda/vscode-encrypt git deps via local checkouts The distro's npm postinstall and the CLI cargo patches both depend on the private microsoft/vsda and microsoft/vscode-encrypt repositories. Now that the distro PAT/.netrc is gone, redirect their public GitHub URLs (https and ssh) to local GitHub App checkouts via git insteadOf in download-distro.yml so every job that consumes the distro can resolve them without a PAT. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: download Alpine musl Node.js from Azure Artifacts feed The Alpine build downloaded the musl Node.js tarball from the private microsoft/vscode-node GitHub releases, which the public github-token-code-oss cannot access. Consume the new vscode-node Azure Artifacts feed via az artifacts universal download instead (authenticated with System.AccessToken), mirroring the Electron prebuilt download. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: resolve private vscode-regexp-languagedetection git dep via local checkout The distro's npm dependencies reference microsoft/vscode-regexp-languagedetection in addition to microsoft/vsda. Check it out via the Monaco GitHub App and redirect its public GitHub URL (https and ssh) to the local checkout so the distro npm postinstall resolves it without a PAT. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: download server Node.js from Azure Artifacts feed Fetch the prebuilt server (reh) Node.js binaries on demand from the vscode-node Azure Artifacts feed (gated on VSCODE_NODEJS_INTERNAL_FEED) instead of from a private GitHub release, so the build no longer needs a long-lived PAT. Extracts the shared az universal-package download helper into build/lib/azureFeed.ts, reused by the Electron resolver. Bumps the server node ms_build_id to 449655 to match the feed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: resolve distro private git deps inside the Alpine container The Alpine server build installs the distro's npm dependencies (which reference the private vsda and vscode-regexp-languagedetection git repos) inside a docker container. The host git insteadOf redirects are not visible there and use host paths, so emit a container-pathed gitconfig (.build/.gitconfig-distro) from download-distro.yml and bind-mount it as /root/.gitconfig, replacing the now-unused .netrc mount. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: use Electron/Node feeds job-wide and fix cmd.exe git redirect Promote VSCODE_ELECTRON_PREBUILT_FEED, VSCODE_NODEJS_INTERNAL_FEED and AZURE_DEVOPS_EXT_PAT to job-level variables so every step (including the integration/smoke test steps that download Electron) resolves binaries from our Azure Artifacts feeds instead of private GitHub releases. Also keep the cross-platform private git redirect step to plain 'git config' invocations so it works in cmd.exe on Windows agents, and move the bash-only container gitconfig generation into a Linux-only step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: pin server Node.js to build 438265 to match distro checksums The distro overlays build/checksums/nodejs.txt with checksums for the original 24.15.0-438265 Node.js build (including the Alpine musl binary, whose contents differ from later rebuilds). Republish the original 438265 artifacts to the vscode-node Azure Artifacts feed and pin ms_build_id back to 438265 so feed downloads match the pinned checksums. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: require ADO org/project from pipeline env vars Resolve the Azure Artifacts organization and project from the SYSTEM_COLLECTIONURI / SYSTEM_TEAMPROJECT pipeline variables (the predefined System.CollectionUri / System.TeamProject), failing fast if either is missing instead of falling back to hardcoded values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: remove internal feed variables for Node.js and Electron from build configurations * build: scope AZURE_DEVOPS_EXT_PAT to individual steps Move the System.AccessToken propagation out of the job-level variables in the alpine/darwin/linux/win32 product-build jobs and onto only the steps that actually download Electron or Node.js from the Azure Artifacts feeds. Adds it to the test 'Download Electron and Playwright' step (the sole feed download outside the compile templates); every other download step already declared it at step scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * :lipsitck: * update distro * build: declare vscode-capi for SDL scan in copilot recovery pipeline The Copilot build steps now check out microsoft/vscode-capi via the Monaco GitHub App (instead of a PAT). The product-copilot-recovery pipeline extends the 1ES extension template, which requires every checked-out repository to be declared under sdl.sourceRepositoriesToScan. Re-declare the template's default excludes plus capi to fix 'repository "capi" ... has not been specified'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: add assertDistroCheckout function to validate vscode-distro checkout * build: fix NPM registry corruption in copilot recovery pipeline setup-npm-registry.ts silently substituted the literal string "undefined" into package-lock.json resolved URLs when invoked without a registry URL, producing build/undefined<pkg>/... paths that npm ci could not resolve. - Fail fast in setup-npm-registry.ts when no registry URL is provided. - Set NPM_REGISTRY=none in product-copilot-recovery.yml so the shared copilot/setup-steps.yml skips its registry rewrite; the 1ES extension template already configures the registry via customNPMRegistry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: fix self checkout and l10n in copilot recovery pipeline The 1ES extension template's package job runs import-localized-files before buildSteps, relying on an implicit self checkout. That implicit checkout is disabled because copilot/build-steps.yml checks out microsoft/vscode-capi, so the source tree was missing and the l10n-detection step failed with 'Not found workingDirectory: .../extensions/copilot'. Mirror product-copilot.yml: check out self at the start of buildSteps, import translations via copilot/l10n-steps.yml (with the vscode_loc resource), and disable the template's own l10n jobs/import (l10nShouldProcess: false). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: exclude vscode build-tooling natives from copilot recovery GLIBC check The 1ES extension template's GLIBC/GLIBCXX check scans every .node under the sources root, but only extensions/copilot is packaged into the VSIX. Native modules outside it (e.g. build/node_modules/tree-sitter) belong to the vscode build tooling and are never shipped, yet their newer GLIBC/GLIBCXX deps fail the check. Remove them before the check so it only validates the copilot extension's own shipped natives, alongside the existing pvrecorder removal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build: disable sysroot GLIBC check in copilot recovery pipeline The copilot extension is bundled with esbuild and vendors prebuilt native modules (@os-theme, @picovoice/pvrecorder-node) that depend on a newer GLIBC than the 1ES template's sysroot check allows. The main product build ships these natives without a sysroot or GLIBC check, so set useSysroot: false on the recovery pipeline's Linux platform for parity, which skips the toolchain setup and the GLIBC/GLIBCXX verification. Drop the now-unnecessary native-removal workaround. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: update distro version in package.json --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
279 lines
12 KiB
TypeScript
279 lines
12 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { Readable } from 'stream';
|
|
import vfs from 'vinyl-fs';
|
|
import { filter, jsonEditor } from './gulp/facade.ts';
|
|
import * as util from './util.ts';
|
|
import { getVersion } from './getVersion.ts';
|
|
import { downloadFeedPackage } from './azureFeed.ts';
|
|
import electron from '@vscode/gulp-electron';
|
|
|
|
type DarwinDocumentSuffix = 'document' | 'script' | 'file' | 'source code';
|
|
type DarwinDocumentType = {
|
|
name: string;
|
|
role: string;
|
|
ostypes: string[];
|
|
extensions: string[];
|
|
iconFile: string;
|
|
utis?: string[];
|
|
};
|
|
|
|
function isDocumentSuffix(str?: string): str is DarwinDocumentSuffix {
|
|
return str === 'document' || str === 'script' || str === 'file' || str === 'source code';
|
|
}
|
|
|
|
const root = path.dirname(path.dirname(import.meta.dirname));
|
|
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
|
|
const commit = getVersion(root);
|
|
const useVersionedUpdate = process.platform === 'win32' && (product as typeof product & { win32VersionedUpdate?: boolean })?.win32VersionedUpdate;
|
|
const versionedResourcesFolder = useVersionedUpdate ? commit!.substring(0, 10) : '';
|
|
|
|
function createTemplate(input: string): (params: Record<string, string>) => string {
|
|
return (params: Record<string, string>) => {
|
|
return input.replace(/<%=\s*([^\s]+)\s*%>/g, (match, key) => {
|
|
return params[key] || match;
|
|
});
|
|
};
|
|
}
|
|
|
|
const darwinCreditsTemplate = product.darwinCredits && createTemplate(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
|
|
|
|
/**
|
|
* Generate a `DarwinDocumentType` given a list of file extensions, an icon name, and an optional suffix or file type name.
|
|
* @param extensions A list of file extensions, such as `['bat', 'cmd']`
|
|
* @param icon A sentence-cased file type name that matches the lowercase name of a darwin icon resource.
|
|
* For example, `'HTML'` instead of `'html'`, or `'Java'` instead of `'java'`.
|
|
* This parameter is lowercased before it is used to reference an icon file.
|
|
* @param nameOrSuffix An optional suffix or a string to use as the file type. If a suffix is provided,
|
|
* it is used with the icon parameter to generate a file type string. If nothing is provided,
|
|
* `'document'` is used with the icon parameter to generate file type string.
|
|
*
|
|
* For example, if you call `darwinBundleDocumentType(..., 'HTML')`, the resulting file type is `"HTML document"`,
|
|
* and the `'html'` darwin icon is used.
|
|
*
|
|
* If you call `darwinBundleDocumentType(..., 'Javascript', 'file')`, the resulting file type is `"Javascript file"`.
|
|
* and the `'javascript'` darwin icon is used.
|
|
*
|
|
* If you call `darwinBundleDocumentType(..., 'bat', 'Windows command script')`, the file type is `"Windows command script"`,
|
|
* and the `'bat'` darwin icon is used.
|
|
*/
|
|
function darwinBundleDocumentType(extensions: string[], icon: string, nameOrSuffix?: string | DarwinDocumentSuffix, utis?: string[]): DarwinDocumentType {
|
|
// If given a suffix, generate a name from it. If not given anything, default to 'document'
|
|
if (isDocumentSuffix(nameOrSuffix) || !nameOrSuffix) {
|
|
nameOrSuffix = icon.charAt(0).toUpperCase() + icon.slice(1) + ' ' + (nameOrSuffix ?? 'document');
|
|
}
|
|
|
|
return {
|
|
name: nameOrSuffix,
|
|
role: 'Editor',
|
|
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
|
|
extensions,
|
|
iconFile: 'resources/darwin/' + icon.toLowerCase() + '.icns',
|
|
utis
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Generate several `DarwinDocumentType`s with unique names and a shared icon.
|
|
* @param types A map of file type names to their associated file extensions.
|
|
* @param icon A darwin icon resource to use. For example, `'HTML'` would refer to `resources/darwin/html.icns`
|
|
*
|
|
* Examples:
|
|
* ```
|
|
* darwinBundleDocumentTypes({ 'C header file': 'h', 'C source code': 'c' },'c')
|
|
* darwinBundleDocumentTypes({ 'React source code': ['jsx', 'tsx'] }, 'react')
|
|
* ```
|
|
*/
|
|
function darwinBundleDocumentTypes(types: { [name: string]: string | string[] }, icon: string): DarwinDocumentType[] {
|
|
return Object.keys(types).map((name: string): DarwinDocumentType => {
|
|
const extensions = types[name];
|
|
return {
|
|
name,
|
|
role: 'Editor',
|
|
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
|
|
extensions: Array.isArray(extensions) ? extensions : [extensions],
|
|
iconFile: 'resources/darwin/' + icon + '.icns'
|
|
};
|
|
});
|
|
}
|
|
|
|
const { msBuildId } = util.getElectronVersion();
|
|
export const electronVersion = '42.2.0';
|
|
|
|
// In product builds, `@vscode/gulp-electron` is given an asset resolver (via the
|
|
// `repo` option) that fetches the prebuilt Electron archives on demand from the
|
|
// Azure Artifacts feed named by `product.electronArtifactFeed` using the `az`
|
|
// CLI, instead of downloading them from electron's official GitHub releases
|
|
// (which OSS builds use when no feed is configured). Each universal package
|
|
// contains exactly one file, which is streamed back as a `Response` and
|
|
// validated against the feed's `SHASUMS256.txt`.
|
|
const electronFeed: string | undefined = product.electronArtifactFeed;
|
|
|
|
// Maps the artifact file name `@vscode/gulp-electron` requests to the matching
|
|
// universal package name in the feed, or `undefined` when it is not mirrored.
|
|
function feedPackageName(fileName: string): string | undefined {
|
|
if (fileName === 'SHASUMS256.txt') {
|
|
return 'shasums256';
|
|
}
|
|
if (fileName.endsWith('-symbols.zip')) {
|
|
return undefined;
|
|
}
|
|
return fileName.replace(/\.zip$/, '');
|
|
}
|
|
|
|
const electronAssetResolver = electronFeed
|
|
? async ({ fileName }: { url: string; fileName: string }): Promise<Response> => {
|
|
const name = feedPackageName(fileName);
|
|
if (!name) {
|
|
return new Response(null, { status: 404 });
|
|
}
|
|
const version = `${electronVersion}-${msBuildId}`;
|
|
const filePath = await downloadFeedPackage(root, 'electron-feed', { feed: electronFeed, name, version });
|
|
const size = (await fs.promises.stat(filePath)).size;
|
|
const body = Readable.toWeb(fs.createReadStream(filePath)) as ReadableStream<Uint8Array>;
|
|
return new Response(body, { status: 200, headers: { 'Content-Length': String(size) } });
|
|
}
|
|
: undefined;
|
|
|
|
export const config = {
|
|
version: electronVersion,
|
|
productAppName: product.nameLong,
|
|
companyName: 'Microsoft Corporation',
|
|
copyright: 'Copyright (C) 2026 Microsoft. All rights reserved',
|
|
darwinExecutable: product.nameShort,
|
|
darwinIcon: 'resources/darwin/code.icns',
|
|
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
|
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
|
darwinHelpBookFolder: 'VS Code HelpBook',
|
|
darwinHelpBookName: 'VS Code HelpBook',
|
|
darwinBundleDocumentTypes: [
|
|
...darwinBundleDocumentTypes({ 'C header file': 'h', 'C source code': 'c' }, 'c'),
|
|
...darwinBundleDocumentTypes({ 'Git configuration file': ['gitattributes', 'gitconfig', 'gitignore'] }, 'config'),
|
|
...darwinBundleDocumentTypes({ 'HTML template document': ['asp', 'aspx', 'cshtml', 'jshtm', 'jsp', 'phtml', 'shtml'] }, 'html'),
|
|
darwinBundleDocumentType(['bat', 'cmd'], 'bat', 'Windows command script'),
|
|
darwinBundleDocumentType(['bowerrc'], 'Bower'),
|
|
darwinBundleDocumentType(['config', 'editorconfig', 'ini', 'cfg'], 'config', 'Configuration file'),
|
|
darwinBundleDocumentType(['hh', 'hpp', 'hxx', 'h++'], 'cpp', 'C++ header file'),
|
|
darwinBundleDocumentType(['cc', 'cpp', 'cxx', 'c++'], 'cpp', 'C++ source code'),
|
|
darwinBundleDocumentType(['m'], 'default', 'Objective-C source code'),
|
|
darwinBundleDocumentType(['mm'], 'cpp', 'Objective-C++ source code'),
|
|
darwinBundleDocumentType(['cs', 'csx'], 'csharp', 'C# source code'),
|
|
darwinBundleDocumentType(['css'], 'css', 'CSS'),
|
|
darwinBundleDocumentType(['go'], 'go', 'Go source code'),
|
|
darwinBundleDocumentType(['htm', 'html', 'xhtml'], 'HTML'),
|
|
darwinBundleDocumentType(['jade'], 'Jade'),
|
|
darwinBundleDocumentType(['jav', 'java'], 'Java'),
|
|
darwinBundleDocumentType(['js', 'jscsrc', 'jshintrc', 'mjs', 'cjs'], 'Javascript', 'file'),
|
|
darwinBundleDocumentType(['json'], 'JSON'),
|
|
darwinBundleDocumentType(['less'], 'Less'),
|
|
darwinBundleDocumentType(['markdown', 'md', 'mdoc', 'mdown', 'mdtext', 'mdtxt', 'mdwn', 'mkd', 'mkdn'], 'Markdown'),
|
|
darwinBundleDocumentType(['php'], 'PHP', 'source code'),
|
|
darwinBundleDocumentType(['ps1', 'psd1', 'psm1'], 'Powershell', 'script'),
|
|
darwinBundleDocumentType(['py', 'pyi'], 'Python', 'script'),
|
|
darwinBundleDocumentType(['gemspec', 'rb', 'erb'], 'Ruby', 'source code'),
|
|
darwinBundleDocumentType(['scss', 'sass'], 'SASS', 'file'),
|
|
darwinBundleDocumentType(['sql'], 'SQL', 'script'),
|
|
darwinBundleDocumentType(['ts'], 'TypeScript', 'file'),
|
|
darwinBundleDocumentType(['tsx', 'jsx'], 'React', 'source code'),
|
|
darwinBundleDocumentType(['vue'], 'Vue', 'source code'),
|
|
darwinBundleDocumentType(['ascx', 'csproj', 'dtd', 'plist', 'wxi', 'wxl', 'wxs', 'xml', 'xaml'], 'XML'),
|
|
darwinBundleDocumentType(['eyaml', 'eyml', 'yaml', 'yml'], 'YAML'),
|
|
darwinBundleDocumentType([
|
|
'bash', 'bash_login', 'bash_logout', 'bash_profile', 'bashrc',
|
|
'profile', 'rhistory', 'rprofile', 'sh', 'zlogin', 'zlogout',
|
|
'zprofile', 'zsh', 'zshenv', 'zshrc'
|
|
], 'Shell', 'script'),
|
|
// Default icon with specified names
|
|
...darwinBundleDocumentTypes({
|
|
'Clojure source code': ['clj', 'cljs', 'cljx', 'clojure'],
|
|
'VS Code workspace file': 'code-workspace',
|
|
'CoffeeScript source code': 'coffee',
|
|
'Comma Separated Values': 'csv',
|
|
'CMake script': 'cmake',
|
|
'Dart script': 'dart',
|
|
'Diff file': 'diff',
|
|
'Dockerfile': 'dockerfile',
|
|
'Gradle file': 'gradle',
|
|
'Groovy script': 'groovy',
|
|
'Makefile': ['makefile', 'mk'],
|
|
'Lua script': 'lua',
|
|
'Pug document': 'pug',
|
|
'Jupyter': 'ipynb',
|
|
'Lockfile': 'lock',
|
|
'Log file': 'log',
|
|
'Plain Text File': 'txt',
|
|
'Xcode project file': 'xcodeproj',
|
|
'Xcode workspace file': 'xcworkspace',
|
|
'Visual Basic script': 'vb',
|
|
'R source code': 'r',
|
|
'Rust source code': 'rs',
|
|
'Restructured Text document': 'rst',
|
|
'LaTeX document': ['tex', 'cls'],
|
|
'F# source code': 'fs',
|
|
'F# signature file': 'fsi',
|
|
'F# script': ['fsx', 'fsscript'],
|
|
'SVG document': ['svg'],
|
|
'TOML document': 'toml',
|
|
'Swift source code': 'swift',
|
|
}, 'default'),
|
|
// Default icon with default name
|
|
darwinBundleDocumentType([
|
|
'containerfile', 'ctp', 'dot', 'edn', 'handlebars', 'hbs', 'ml', 'mli',
|
|
'pl', 'pl6', 'pm', 'pm6', 'pod', 'pp', 'properties', 'psgi', 'rt', 't'
|
|
], 'default', product.nameLong + ' document'),
|
|
// Folder support ()
|
|
darwinBundleDocumentType([], 'default', 'Folder', ['public.folder'])
|
|
],
|
|
darwinBundleURLTypes: [{
|
|
role: 'Viewer',
|
|
name: product.nameLong,
|
|
urlSchemes: [product.urlProtocol]
|
|
}],
|
|
darwinForceDarkModeSupport: true,
|
|
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,
|
|
linuxExecutableName: product.applicationName,
|
|
winIcon: 'resources/win32/code.ico',
|
|
token: process.env['GITHUB_TOKEN'],
|
|
repo: electronAssetResolver,
|
|
validateChecksum: true,
|
|
checksumFile: path.join(root, 'build', 'checksums', 'electron.txt'),
|
|
createVersionedResources: useVersionedUpdate,
|
|
productVersionString: versionedResourcesFolder,
|
|
};
|
|
|
|
function getElectron(arch: string): () => NodeJS.ReadWriteStream {
|
|
return () => {
|
|
const electronOpts = {
|
|
...config,
|
|
platform: process.platform,
|
|
arch: arch === 'armhf' ? 'arm' : arch,
|
|
ffmpegChromium: false,
|
|
keepDefaultApp: true
|
|
};
|
|
|
|
return vfs.src('package.json')
|
|
.pipe(jsonEditor({ name: product.nameShort }))
|
|
.pipe(electron(electronOpts))
|
|
.pipe(filter(['**', '!**/app/package.json']))
|
|
.pipe(vfs.dest('.build/electron'));
|
|
};
|
|
}
|
|
|
|
async function main(arch: string = process.arch): Promise<void> {
|
|
const electronPath = path.join(root, '.build', 'electron');
|
|
await util.rimraf(electronPath)();
|
|
await util.streamToPromise(getElectron(arch)());
|
|
}
|
|
|
|
if (import.meta.main) {
|
|
main(process.argv[2]).catch(err => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|
|
}
|