Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove optional dependency and have rush install skip optional #175

Merged
merged 3 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions common/changes/nickpape-no-optional_2017-05-05-04-06.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"changes": [
{
"packageName": "@microsoft/web-library-build",
"comment": "Remove unnecessary fsevents optional dependency",
"type": "patch"
},
{
"packageName": "@microsoft/gulp-core-build-webpack",
"comment": "Remove unnecessary fsevents optional dependency",
"type": "patch"
}
],
"email": "nickpape@microsoft.com"
}
3 changes: 0 additions & 3 deletions gulp-core-build-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,5 @@
"@types/source-map": "0.5.0",
"@types/uglify-js": "2.6.28",
"@types/webpack": "1.12.36"
},
"optionalDependencies": {
"fsevents": "*"
}
}
21 changes: 16 additions & 5 deletions rush/rush/src/utilities/InstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ export default class InstallManager {
project.cyclicDependencyProjects, project.packageJson.dependencies);
InstallManager._addDependenciesToMap(rushConfiguration, directDependencies,
project.cyclicDependencyProjects, project.packageJson.devDependencies);

// TODO: VSO 346348 - implement this correctly:
// InstallManager._addDependenciesToMap(rushConfiguration, directDependencies,
// project.cyclicDependencyProjects, project.packageJson.optionalDependencies);
});

const implicitlyPinned: Map<string, string> = new Map<string, string>();
Expand Down Expand Up @@ -180,7 +176,22 @@ export default class InstallManager {
console.log(os.EOL + 'Running "npm install" in ' + npmToolFolder);

// NOTE: Here we use whatever version of NPM we happen to find in the PATH
Utilities.executeCommandWithRetry('npm', ['install'], MAX_INSTALL_ATTEMPTS, npmToolFolder);

// NOTE: we do NOT install optional dependencies for Rush, as it seems that optional dependencies do not
// work properly with shrinkwrap. Consider the "fsevents" package. This is a Mac specific package
// which is an optional second-order dependency. Optional dependencies work by attempting to install
// the package, but removes the package if the install failed.
// This means that someone running generate on a Mac WILL have fsevents included in their shrinkwrap.
// When someone using Windows attempts to install from the shrinkwrap, the install will fail.
//
// If someone generates the shrinkwrap using Windows, then fsevents will NOT be listed in the shrinkwrap.
// When someone using Mac attempts to install from the shrinkwrap, (as of NPM 4), they will NOT have the
// optional dependency installed.
//
// One possible solution would be to have the shrinkwrap include information about whether the dependency
// is optional or not, but it does not appear to do so. Also, this would result in strange behavior where
// people would have different node_modules based on their system.
Utilities.executeCommandWithRetry('npm', ['install', '--no-optional'], MAX_INSTALL_ATTEMPTS, npmToolFolder);

// Create the marker file to indicate a successful install
fsx.writeFileSync(npmToolFlagFile, '');
Expand Down
5 changes: 1 addition & 4 deletions web-library-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@
"gulp": "~3.9.1",
"gulp-replace": "^0.5.4"
},
"devDependencies": {},
"optionalDependencies": {
"fsevents": "*"
}
"devDependencies": {}
}