-
Couldn't load subscription status.
- Fork 179
Dynamic NPM Package Runner #145
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
Merged
+35
−3
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a719163
Add a helper to decide whether to use npm, pnpm, yarn or bun when run…
imliam cf7cfbe
Calculate the node package manager upfront and memoise it
imliam 021b9e2
Merge branch 'main' into npm-script-runner
imliam 44be0b7
Fix tests
imliam 39811e0
Update to use Roster's nodePackageManager function
imliam 2dea04d
Run linter
imliam baa8057
Fix test
imliam 51d15a8
test: remove redundant GuidelineAssistTest and add lockfile-based pac…
pushpak1300 27de8dc
Merge branch 'main' into npm-script-runner
pushpak1300 1223121
use nullsafe operator
pushpak1300 5bb73a5
Fix phpstan error
pushpak1300 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?php | ||
pushpak1300 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Laravel\Boost\Install\GuidelineAssist; | ||
|
|
||
| beforeEach(function () { | ||
| $lockFiles = [ | ||
| base_path('package-lock.json'), | ||
| base_path('pnpm-lock.yaml'), | ||
| base_path('yarn.lock'), | ||
| base_path('bun.lockb'), | ||
| ]; | ||
|
|
||
| foreach ($lockFiles as $file) { | ||
imliam marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (file_exists($file)) { | ||
| unlink($file); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| afterEach(function () { | ||
| $lockFiles = [ | ||
| base_path('package-lock.json'), | ||
| base_path('pnpm-lock.yaml'), | ||
| base_path('yarn.lock'), | ||
| base_path('bun.lockb'), | ||
| ]; | ||
|
|
||
| foreach ($lockFiles as $file) { | ||
| if (file_exists($file)) { | ||
| unlink($file); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| test('it detects npm when package-lock.json exists', function () { | ||
| file_put_contents(base_path('package-lock.json'), '{}'); | ||
|
|
||
| $assist = new GuidelineAssist(); | ||
| expect($assist->nodePackageManager())->toBe('npm'); | ||
| }); | ||
|
|
||
| test('it detects pnpm when pnpm-lock.yaml exists', function () { | ||
| file_put_contents(base_path('pnpm-lock.yaml'), 'lockfileVersion: 6.0'); | ||
|
|
||
| $assist = new GuidelineAssist(); | ||
| expect($assist->nodePackageManager())->toBe('pnpm'); | ||
| }); | ||
|
|
||
| test('it detects yarn when yarn.lock exists', function () { | ||
| file_put_contents(base_path('yarn.lock'), '# This is yarn lock file'); | ||
|
|
||
| $assist = new GuidelineAssist(); | ||
| expect($assist->nodePackageManager())->toBe('yarn'); | ||
| }); | ||
|
|
||
| test('it detects bun when bun.lockb exists', function () { | ||
| file_put_contents(base_path('bun.lockb'), 'bun binary lock file'); | ||
|
|
||
| $assist = new GuidelineAssist(); | ||
| expect($assist->nodePackageManager())->toBe('bun'); | ||
| }); | ||
|
|
||
| test('it defaults to npm when no lock files exist', function () { | ||
| $assist = new GuidelineAssist(); | ||
| expect($assist->nodePackageManager())->toBe('npm'); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.