Skip to content

Commit

Permalink
feat(cli): dont check system if the marker file is created
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Jun 27, 2018
1 parent 20ff514 commit ce5a4a2
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions packages/api/cli/src/util/check-system.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { exec } from 'child_process';
import debug from 'debug';
import fs from 'fs-extra';
import os from 'os';
import path from 'path';
import semver from 'semver';

import { hasYarn, yarnOrNpmSpawn } from '@electron-forge/core/dist/util/yarn-or-npm';
Expand Down Expand Up @@ -67,7 +70,23 @@ async function checkPackageManagerVersion(ora: OraImpl) {
});
}

export default async function (ora: OraImpl) {
return (await Promise.all([checkGitExists(), checkNodeVersion(), checkPackageManagerVersion(ora)]))
.every(check => check);
/**
* Some people know there is system is OK and don't appreciate the 800ms lag in
* start up that these checks (in particular the package manager check) costs.
*
* Simply creating this flag file in your home directory will skip these checks
* and shave ~800ms off your forge start time.
*
* This is specifically not documented or everyone would make it.
*/
const SKIP_SYSTEM_CHECK = path.resolve(os.homedir(), '.skip-forge-system-check');

export default async function (ora: OraImpl): Promise<boolean> {
if (!await fs.pathExists(SKIP_SYSTEM_CHECK)) {
d('checking system, create ~/.skip-forge-system-check to stop doing this');
return (await Promise.all([checkGitExists(), checkNodeVersion(), checkPackageManagerVersion(ora)]))
.every(check => check);
}
d('skipping system check');
return true;
}

0 comments on commit ce5a4a2

Please sign in to comment.