Skip to content

Commit 7c6b993

Browse files
committed
Adds initial JavaScript preset
1 parent 2fae8f5 commit 7c6b993

File tree

7 files changed

+44
-4
lines changed

7 files changed

+44
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
77

88
## [Unreleased]
99

10+
## [v4.6.0] - 2025-08-27
11+
12+
### Added
13+
- New initial [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) preset.
14+
1015
## [v4.5.0] - 2025-08-27
1116

1217
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ lean-package-validator init [<directory>]
201201
The `--overwrite|-o` option overwrites an existing `.lpv` file.
202202

203203
The `--preset` option allows to choose from a predefined set of glob pattern.
204-
Available presets are `PHP`, `Python`, `Rust`, and `Go`. With `PHP` being the default.
204+
Available presets are `PHP`, `Python`, `Rust`, `JavaScript`, and `Go`. With `PHP` being the default.
205205

206206
#### Tree command
207207

src/Presets/CommonPreset.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ protected function getCommonGlob(): array
1818
'*.yml',
1919
'*.dist.*',
2020
'llms.*',
21+
'.githooks',
2122
'*.dist',
2223
'{B,b}uild*',
2324
'{D,d}ist',

src/Presets/JavaScriptPreset.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stolt\LeanPackage\Presets;
6+
7+
use Stolt\LeanPackage\Preset;
8+
9+
final class JavaScriptPreset extends CommonPreset implements Preset
10+
{
11+
public function getPresetGlob(): array
12+
{
13+
return \array_unique(\array_merge($this->getCommonGlob(), [
14+
'package.json',
15+
'package-lock.json',
16+
'yarn.lock',
17+
'pnpm-lock.yaml',
18+
'bun.lockb',
19+
'__tests__/**',
20+
'*.{test,spec}.{js,ts,jsx,tsx}',
21+
'tsconfig.json',
22+
'tsconfig.*.json',
23+
'.eslintrc*',
24+
'.prettierrc*',
25+
'.babelrc*',
26+
'vite.config.*',
27+
'webpack.config.*',
28+
'rollup.config.*',
29+
'jest.config.*',
30+
]));
31+
}
32+
}

tests/AnalyserTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,7 @@ public function returnsExpectedDefaultGlobPatterns(): void
15471547
'ecs*',
15481548
'infection*',
15491549
'llms.*',
1550+
'.githooks',
15501551
'package*',
15511552
'peck.json',
15521553
'phpkg.con*',

tests/Commands/InitCommandTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function createsExpectedDefaultLpvFile(): void
7171
*.yml
7272
*.dist.*
7373
llms.*
74+
.githooks
7475
*.dist
7576
{B,b}uild*
7677
{D,d}ist
@@ -170,7 +171,7 @@ public function existingDefaultLpvFileIsNotOverwritten(): void
170171
public function usingANonAvailablePresetShowsWarning(): void
171172
{
172173
$expectedDisplay = <<<CONTENT
173-
Warning: Chosen preset javascript is not available. Maybe contribute it?.
174+
Warning: Chosen preset assembler is not available. Maybe contribute it?.
174175
175176
CONTENT;
176177

@@ -179,7 +180,7 @@ public function usingANonAvailablePresetShowsWarning(): void
179180
$commandTester->execute(
180181
['command' => $command->getName(),
181182
'directory' => WORKING_DIRECTORY,
182-
'--preset' => 'javascript'],
183+
'--preset' => 'assembler'],
183184
);
184185

185186
$this->assertSame($expectedDisplay, $commandTester->getDisplay());

tests/Presets/FinderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function findsExpectedPresets(): void
1919
$finder = new Finder(new PhpPreset());
2020

2121
$actualPresets = $finder->getAvailablePresets();
22-
$expectedPresets = ['Php', 'Go', 'Python', 'Rust'];
22+
$expectedPresets = ['Php', 'Go', 'Python', 'Rust', 'JavaScript'];
2323

2424
\sort($actualPresets);
2525
\sort($expectedPresets);

0 commit comments

Comments
 (0)