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

1.7.1 #197

Merged
merged 6 commits into from
Aug 30, 2024
Merged

1.7.1 #197

Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [1.7.1] - 2024-08-20
* Fixed - Run the `playwright install` command as root
* Change - The `playwright install` command will now install only the Chromium browser and its dependencies.

# [1.7.0] - 2024-06-06
* Fixed - Properly read changes and restart stack after using the `slic php-version set` command.
* Added - PHP 8.3 docker images.
Expand Down
2 changes: 1 addition & 1 deletion slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
] );

$cli_name = 'slic';
const CLI_VERSION = '1.7.0';
const CLI_VERSION = '1.7.1';

// If the run-time option `-q`, for "quiet", is specified, then do not print the header.
if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) {
Expand Down
48 changes: 34 additions & 14 deletions src/commands/playwright.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,40 @@

setup_id();
$playwright_args = $args( '...' );
$status = slic_realtime()(
array_merge(
[
'exec',
'--user',
sprintf( '"%s:%s"', getenv( 'SLIC_UID' ), getenv( 'SLIC_GID' ) ),
'--workdir',
escapeshellarg( get_project_container_path() ),
'slic',
'node_modules/.bin/playwright',
],
$playwright_args
)
);
$is_install_command = $playwright_args[0] === 'install';

if ( $is_install_command ) {
// Install commands will need to run as root.
$user = '0:0';
} else {
// Other commands will run as the current user.
$user = sprintf( '"%s:%s"', getenv( 'SLIC_UID' ), getenv( 'SLIC_GID' ) );
}

if ( $playwright_args === ['install'] ) {
// It's exactly the `playwright install` command and nothing more.
$command = [
'exec',
'--user',
'0:0',
'--workdir',
escapeshellarg( get_project_container_path() ),
'slic',
'node_modules/.bin/playwright install chromium --with-deps',
];
} else {
$command = array_merge( [
'exec',
'--user',
$user,
'--workdir',
escapeshellarg( get_project_container_path() ),
'slic',
'node_modules/.bin/playwright',
], $playwright_args );
}

$status = slic_realtime()( $command );

// If there is a status other than 0, we have an error. Bail.
if ( $status ) {
Expand Down
Loading