Skip to content
Permalink
Browse files

feat(cli): dont check system if the marker file is created

  • Loading branch information
MarshallOfSound committed Jun 20, 2018
1 parent 20ff514 commit ce5a4a2e627199d50fc123af0718dca76a12ac36
Showing with 22 additions and 3 deletions.
  1. +22 −3 packages/api/cli/src/util/check-system.ts
@@ -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';
@@ -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.
You can’t perform that action at this time.