-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add --no-progress and --json options to mix:compile and mix:list #1087
Conversation
- Add --no-progress to mix:compile to suppress mix progress (not webpack progress) - Add --json to mix:list to output mix packages in json format
- Update mix:compile command to hide Mixing message on silent option instead - Update MixList.php to remove ternary for readability - Update MixList.php to use Laravel output methods for compatibility Co-authored-by: Ben Thomson <git@alfreido.com>
@bennothommo Those are all good suggestions and I've made a commit with them all together. I was a little worried about the silent option interfering with the output of webpack, because adding the silent option to mix:compile also adds /home/tom/projects/winter/node_modules/.bin/webpack build --stats=none --config=/home/tom/projects/winter/modules/backend/mix.webpack.js --stats=normal --json And it all works out. |
@Nimdoc thanks for making those changes. Conventionally, a silent flag means suppress all output. In general, this allows scripts and automated systems to use the command and simply check the exit code for success, so yes, we would want that flag to hide both the Mix and Webpack output. The As long as your PR does both of the above, I'll be happy to merge :) |
- Update MixCompile.php and mix.webpack.js.fixture to separate the silent and no-progress flags.
@bennothommo I can confirm, that running just /**
* Create the command array to create a Process object with
*/
protected function createCommand(string $mixJsPath): array
{
$basePath = base_path();
$command = $this->argument('webpackArgs') ?? [];
array_unshift(
$command,
$basePath . sprintf('%1$snode_modules%1$s.bin%1$swebpack', DIRECTORY_SEPARATOR),
'build',
$this->option('silent') ? '--stats=none' : '--progress',
'--config=' . $this->getWebpackJsPath($mixJsPath)
);
return $command;
} To something like /**
* Create the command array to create a Process object with
*/
protected function createCommand(string $mixJsPath): array
{
$basePath = base_path();
$command = [];
$command[] = $basePath . sprintf('%1$snode_modules%1$s.bin%1$swebpack', DIRECTORY_SEPARATOR);
$command[] = 'build';
$command = array_merge($command, $this->argument('webpackArgs') ?? []);
$command[] = $this->option('silent') ? '--stats=none' : '--progress';
$command[] = '--config=' . $this->getWebpackJsPath($mixJsPath);
return $command;
} Move the user supply arguments to the middle so that the What do you think? I prefer the current behavior with the current changes, letting users silence everything but then let some stuff through by adding webpack options on the end. Also, I just made a couple changes to |
@Nimdoc looks good to me! I doubt many people will use the silent flag alongside others that display things, but I don't mind that it would allow people to tailor their output as they see fit, so I have no problems with that at all. |
@LukeTowers @jaxwilko do you envisage any problems with the above? |
@bennothommo I don't think there's any issues with it, happy to do some testing in the morning tho if needed :) |
That'd be awesome @jaxwilko :) |
Any updates needed for the docs with this PR? Otherwise I'm happy to merge |
nvm, found the PR :) |
This will suppress the mix progress output while allowing the webpack progress to be output.
This outputs the mix package information in a json format. Also instead of "yes" and "no" for the "active" property, with the --json option the values are true and false.
These additions will be useful for scripts or automation tools that need to parse information about mix packages and information for when they're compiled.