add --dev flag to the packager's dependencies command

Summary:
The packager dependencies CLI command always operates on --dev=true today. This means any tooling that needs to get the production dependencies (--dev=false) will always get the dev-mode list instead. For instance:

```
if (__DEV__) {
  require('Foobar');
}
```

Previously, `Foobar.js` will always be listed in the CLI output. With this change, setting `--dev false` option will correctly skip `Foobar.js` in the output.

Reviewed By: cpojer

Differential Revision: D5163184

fbshipit-source-id: 203221ee5d6ecb7df575442f12f6c4c489bfbd46
This commit is contained in:
Kevin Gozali 2017-06-01 13:51:58 -07:00 committed by Facebook Github Bot
parent 7974a5b745
commit de70d376ca
3 changed files with 8 additions and 2 deletions

View File

@ -596,12 +596,14 @@ class Bundler {
return response;
}
getOrderedDependencyPaths({entryFile, dev, platform}: {
getOrderedDependencyPaths({entryFile, dev, platform, minify, generateSourceMaps}: {
+entryFile: string,
+dev: boolean,
+platform: string,
+minify: boolean,
+generateSourceMaps: boolean,
}) {
return this.getDependencies({entryFile, dev, platform}).then(
return this.getDependencies({entryFile, dev, platform, minify, generateSourceMaps}).then(
({dependencies}) => {
const ret = [];
const promises = [];

View File

@ -319,6 +319,8 @@ class Server {
+entryFile: string,
+dev: boolean,
+platform: string,
+minify: boolean,
+generateSourceMaps: boolean,
}): Promise<mixed> {
return Promise.resolve().then(() => {
return this._bundler.getOrderedDependencyPaths(options);

View File

@ -92,6 +92,8 @@ exports.getOrderedDependencyPaths = function(options: Options, depOptions: {
+entryFile: string,
+dev: boolean,
+platform: string,
+minify: boolean,
+generateSourceMaps: boolean,
}) {
var server = createNonPersistentServer(options);
return server.getOrderedDependencyPaths(depOptions)