Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/darwin/create-universal-app.js
3520 views
1
"use strict";
2
var __importDefault = (this && this.__importDefault) || function (mod) {
3
return (mod && mod.__esModule) ? mod : { "default": mod };
4
};
5
Object.defineProperty(exports, "__esModule", { value: true });
6
/*---------------------------------------------------------------------------------------------
7
* Copyright (c) Microsoft Corporation. All rights reserved.
8
* Licensed under the MIT License. See License.txt in the project root for license information.
9
*--------------------------------------------------------------------------------------------*/
10
const path_1 = __importDefault(require("path"));
11
const fs_1 = __importDefault(require("fs"));
12
const minimatch_1 = __importDefault(require("minimatch"));
13
const vscode_universal_bundler_1 = require("vscode-universal-bundler");
14
const root = path_1.default.dirname(path_1.default.dirname(__dirname));
15
async function main(buildDir) {
16
const arch = process.env['VSCODE_ARCH'];
17
if (!buildDir) {
18
throw new Error('Build dir not provided');
19
}
20
const product = JSON.parse(fs_1.default.readFileSync(path_1.default.join(root, 'product.json'), 'utf8'));
21
const appName = product.nameLong + '.app';
22
const x64AppPath = path_1.default.join(buildDir, 'VSCode-darwin-x64', appName);
23
const arm64AppPath = path_1.default.join(buildDir, 'VSCode-darwin-arm64', appName);
24
const asarRelativePath = path_1.default.join('Contents', 'Resources', 'app', 'node_modules.asar');
25
const outAppPath = path_1.default.join(buildDir, `VSCode-darwin-${arch}`, appName);
26
const productJsonPath = path_1.default.resolve(outAppPath, 'Contents', 'Resources', 'app', 'product.json');
27
const filesToSkip = [
28
'**/CodeResources',
29
'**/Credits.rtf',
30
'**/policies/{*.mobileconfig,**/*.plist}',
31
// TODO: Should we consider expanding this to other files in this area?
32
'**/node_modules/@parcel/node-addon-api/nothing.target.mk',
33
];
34
await (0, vscode_universal_bundler_1.makeUniversalApp)({
35
x64AppPath,
36
arm64AppPath,
37
asarPath: asarRelativePath,
38
outAppPath,
39
force: true,
40
mergeASARs: true,
41
x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node}',
42
filesToSkipComparison: (file) => {
43
for (const expected of filesToSkip) {
44
if ((0, minimatch_1.default)(file, expected)) {
45
return true;
46
}
47
}
48
return false;
49
}
50
});
51
const productJson = JSON.parse(fs_1.default.readFileSync(productJsonPath, 'utf8'));
52
Object.assign(productJson, {
53
darwinUniversalAssetId: 'darwin-universal'
54
});
55
fs_1.default.writeFileSync(productJsonPath, JSON.stringify(productJson, null, '\t'));
56
}
57
if (require.main === module) {
58
main(process.argv[2]).catch(err => {
59
console.error(err);
60
process.exit(1);
61
});
62
}
63
//# sourceMappingURL=create-universal-app.js.map
64