lib/utilities/windows-admin.js:8

WindowsSymlinkChecker

On windows users will have a much better experience if symlinks are enabled an usable. This object when queried informs windows users, if they can improve there build performance, and how.

Windows vista: nothing we can really do, so we fall back to junctions for folders + copying of files <= Windows vista: symlinks are available but using them is somewhat tricky * if the users is an admin, the process needed to have been started with elevated privs * if the user is not an admin, a specific setting needs to be enabled <= Windows 10 Insiders build 14972 * if developer mode is enabled, symlinks "just work" * https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10

 let checker = WindowsSymlinkChecker;
 let {
   windows,
   elevated
 } = await = checker.checkIfSymlinksNeedToBeEnabled(); // aslso emits helpful warnings

Method Summary

Public Methods
public
checkIfSymlinksNeedToBeEnabled( ): Promise

if not windows, will fulfill with: { windows: false, elevated: null) if windows, and elevated will fulfill with: { windows: false, elevated: true) if windows, and is NOT elevated will fulfill with: { windows: false, elevated: false) will include heplful warning, so that users know (if possible) how to achieve better windows build performance

public
public
insertIntoFile(pathRelativeToProjectRoot, contentsToInsert, providedOptions): Promise

Inserts the given content into a file. If the contentsToInsert string is already present in the current contents, the file will not be changed unless force option is passed.

public
npm(args)

Runs the npm command with the supplied args.

Private Methods
private

Uses the eon-old command NET SESSION to determine whether or not the current user has elevated rights (think sudo, but Windows).

private

sets up a WindowsSymlinkChecker

Public Methods

lib/utilities/windows-admin.js:40

public checkIfSymlinksNeedToBeEnabled( ): Promise

if not windows, will fulfill with: { windows: false, elevated: null) if windows, and elevated will fulfill with: { windows: false, elevated: true) if windows, and is NOT elevated will fulfill with: { windows: false, elevated: false) will include heplful warning, so that users know (if possible) how to achieve better windows build performance

Return:

Promise

Object describing whether we're on windows and if admin rights exist

lib/utilities/windows-admin.js:83

public checkIfSymlinksNeedToBeEnabled( ): Promise

Return:

Promise

Object describing whether we're on windows and if admin rights exist

lib/utilities/insert-into-file.js:10

public insertIntoFile(pathRelativeToProjectRoot, contentsToInsert, providedOptions): Promise

Inserts the given content into a file. If the contentsToInsert string is already present in the current contents, the file will not be changed unless force option is passed.

If options.before is specified, contentsToInsert will be inserted before the first instance of that string. If options.after is specified, the contents will be inserted after the first instance of that string. If the string specified by options.before or options.after is not in the file, no change will be made.

If neither options.before nor options.after are present, contentsToInsert will be inserted at the end of the file.

Example:

// app/router.js
Router.map(function() {
});
insertIntoFile('app/router.js', '  this.route("admin");', {
  after: 'Router.map(function() {' + EOL
});
// app/router.js
Router.map(function() {
  this.route("admin");
});

Parameters:

Name Type Attribute Description
pathRelativeToProjectRoot String
contentsToInsert String
providedOptions Object

Return:

lib/utilities/npm.js:7

public npm(args)

Runs the npm command with the supplied args.

Parameters:

Name Type Attribute Description
args Array

The arguments passed to the npm command.

Private Methods

lib/utilities/windows-admin.js:106

private _checkForElevatedRights(ui): Object

Uses the eon-old command NET SESSION to determine whether or not the current user has elevated rights (think sudo, but Windows).

Parameters:

Name Type Attribute Description
ui Object
  • ui object used to call writeLine();

Return:

Object

Object describing whether we're on windows and if admin rights exist

sets up a WindowsSymlinkChecker

providing it with defaults for:

  • if we are on windows
  • if we can symlink
  • a reference to exec

Parameters:

Name Type Attribute Description
UI UI