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

Fix/remove hardcoded npm package #9410

Merged

Conversation

pDonatas
Copy link

@pDonatas pDonatas commented Nov 1, 2023

  • Changes have been thoroughly tested to not break existing functionality.
  • New functionality has been documented or existing documentation has been updated to reflect changes.
  • Visual changes are explained in the PR description using a screenshot/recording of before and after.

Current make:filament-theme command had hardcoded npm package giving no possibility to use other package managers such as yarn or bun. This PR adds a new --pm option to the command which will let user to enter what package manager command should use.

Example usage:
php artisan make:filament-theme admin --pm=bun
php artisan make:filament-theme admin --pm=yarn

Comment on lines 66 to 68
$cssFilePath,
$tailwindConfigFilePath,
])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the formatting change here

$this->info("Using NPM v{$npmVersion[0]}");
$this->info("Using {$pm} v{$pmVersion[0]}");

$installCommand = $pm === 'yarn' ? 'yarn add' : "{$pm} install";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor this to use a match() statement


if ($npmVersionExistCode !== 0) {
exec($pm . ' -v', $pmVersion, $pmVersionExistCode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert the concatenation to using "{$}" syntax

@@ -121,6 +121,12 @@ If you have multiple panels, you can specify the panel you want to create a them
php artisan make:filament-theme admin
```

By default, command will use node package manager with npm. If you want to use different package manager use `--pm` option:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, command will use node package manager with npm. If you want to use different package manager use `--pm` option:
By default, this command will use NPM to install dependencies. If you want to use a different package manager, you can use the `--pm` option:

@danharrin danharrin added the enhancement New feature or request label Nov 2, 2023
@danharrin danharrin added this to the v3 milestone Nov 2, 2023
@danharrin danharrin merged commit cd6b66e into filamentphp:3.x Nov 2, 2023
@danharrin
Copy link
Member

Thanks

@@ -108,7 +115,7 @@ public function handle(): int
$this->components->bulletList([
"First, add a new item to the `input` array of `vite.config.js`: `resources/css/filament/{$panelId}/theme.css`.",
"Next, register the theme in the {$panelId} panel provider using `->viteTheme('resources/css/filament/{$panelId}/theme.css')`",
'Finally, run `npm run build` to compile the theme.',
"Finally, run `{$pm} run build` to compile the theme.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never tried with bun but bun build is the command right, not bun run build? https://bun.sh/docs/bundler

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried both build and run build both works, same with yarn works yarn run build and yarn build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants