|
|
@@ -91,11 +91,12 @@ const unlink = async (dir, filter) => {
|
|
|
await Promise.all(promises);
|
|
|
};
|
|
|
|
|
|
-const exec = async (command, encoding) => {
|
|
|
+const exec = async (command, encoding, cwd) => {
|
|
|
+ cwd = cwd || dirname();
|
|
|
if (encoding) {
|
|
|
- return child_process.execSync(command, { cwd: dirname(), encoding: encoding });
|
|
|
+ return child_process.execSync(command, { cwd: cwd, encoding: encoding });
|
|
|
}
|
|
|
- child_process.execSync(command, { cwd: dirname(), stdio: [ 0,1,2 ] });
|
|
|
+ child_process.execSync(command, { cwd: cwd, stdio: [ 0,1,2 ] });
|
|
|
return '';
|
|
|
/*
|
|
|
return new Promise((resolve, reject) => {
|
|
|
@@ -579,6 +580,36 @@ const coverage = async () => {
|
|
|
await exec('nyc --instrument npx electron ./dist/nyc');
|
|
|
};
|
|
|
|
|
|
+const forge = async() => {
|
|
|
+ const command = read();
|
|
|
+ switch (command) {
|
|
|
+ case 'install': {
|
|
|
+ await exec('npm install @electron-forge/[email protected]');
|
|
|
+ await exec('npm install @electron-forge/[email protected]');
|
|
|
+ await exec('npm install @electron-forge/[email protected]');
|
|
|
+ await exec('npm install @electron-forge/[email protected]');
|
|
|
+ await exec('npm install @electron-forge/[email protected]');
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'build': {
|
|
|
+ const cwd = path.join(dirname(), '..', 'forge');
|
|
|
+ const node_modules = path.join(cwd, 'node_modules');
|
|
|
+ const links = path.join(cwd, '.links');
|
|
|
+ const exists = await access(node_modules);
|
|
|
+ if (!exists) {
|
|
|
+ await exec('yarn', null, cwd);
|
|
|
+ }
|
|
|
+ await exec('yarn build', null, cwd);
|
|
|
+ await exec('yarn link:prepare', null, cwd);
|
|
|
+ await exec(`yarn link @electron-forge/core --link-folder=${links}`);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default: {
|
|
|
+ throw new Error(`Unsupported forge command ${command}.`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const analyze = async () => {
|
|
|
const exists = await access('third_party/tools/codeql');
|
|
|
if (!exists) {
|
|
|
@@ -630,6 +661,7 @@ const next = async () => {
|
|
|
case 'pull': await pull(); break;
|
|
|
case 'analyze': await analyze(); break;
|
|
|
case 'coverage': await coverage(); break;
|
|
|
+ case 'forge': await forge(); break;
|
|
|
default: throw new Error(`Unsupported task '${task}'.`);
|
|
|
}
|
|
|
} catch (err) {
|