-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
83 lines (65 loc) · 2.46 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const files = { "workbench.ts":`import { URI, UriComponents } from "vs/base/common/uri";
import { create } from "vs/workbench/workbench.web.main";
import { IWorkbenchConstructionOptions } from "vs/workbench/browser/web.api";
import { IWorkspace, IWorkspaceProvider } from "vs/workbench/services/host/browser/browserHostService";
declare const window: any;
(async function () {
// create workbench
let config: IWorkbenchConstructionOptions & {
folderUri?: UriComponents;
workspaceUri?: UriComponents;
domElementId?: string;
} = {};
if (window.product) {
config = window.product;
} else {
const result = await fetch("/product.json");
config = await result.json();
}
if (Array.isArray(config.additionalBuiltinExtensions)) {
const tempConfig = { ...config };
tempConfig.additionalBuiltinExtensions =
config.additionalBuiltinExtensions.map((ext) => URI.revive(ext));
config = tempConfig;
}
let workspace;
if (config.folderUri) {
workspace = { folderUri: URI.revive(config.folderUri) };
} else if (config.workspaceUri) {
workspace = { workspaceUri: URI.revive(config.workspaceUri) };
} else {
workspace = undefined;
}
if (workspace) {
const workspaceProvider: IWorkspaceProvider = {
workspace,
open: async (
workspace: IWorkspace,
options?: { reuse?: boolean; payload?: object }
) => true,
trusted: true,
};
config = { ...config, workspaceProvider };
}
const domElement = !!config.domElementId
&& document.getElementById(config.domElementId)
|| document.body;
create(domElement, config);
})();`;
const process = await import("node:process");
const child_process = await import("node:child_process");
const fs = await import("node:fs");
const fse = await import("fs-extra").then(({default:fs})=>fs);
const vscodeVersion = "1.76.0";
if (!fs.existsSync("vscode")) {
child_process.execSync(`git clone -s https://github.com/microsoft/vscode.git -b ${vscodeVersion}`, {
stdio: "inherit",
});
}
if (!fs.existsSync("node_modules")) { child_process.execSync("yarn", { stdio: "inherit" }); }
fs.copyFileSync("../workbench.ts", "src/vs/code/browser/workbench/workbench.ts");
child_process.execSync("yarn gulp vscode-web-min", { stdio: "inherit", cwd: "./vscode" });
// Create final bundels
if (fs.existsSync("../dist")) { fs.rmdirSync("../dist", { recursive: true }); }
fs.mkdirSync("../dist");
fs.copySync("../vscode-web", "../dist");