Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $packagerName = $detectedPackager->getName();
$detector = new Runtime(
$files,
new Strategy(Strategy::FILEMATCH), // similar for LANGUAGES and EXTENSIONS
'npm'
'pnpm'
);

$detector
Expand All @@ -62,7 +62,7 @@ $runtimeCommands = $detectedRuntime->getCommands();

// Initialise Framework Detection
$files = ['src', 'types', 'makefile', 'components.js', 'debug.js', 'package.json', 'svelte.config.js'];
$packager = 'npm';
$packager = 'pnpm';
$detector = new Framework($files, $packager);

$detector
Expand Down Expand Up @@ -173,4 +173,4 @@ composer test

## Copyright and license

The MIT License (MIT) [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)
The MIT License (MIT) [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)
6 changes: 3 additions & 3 deletions docs/add-new-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ class MyFramework extends Framework

public function getInstallCommand(): string
{
return 'npm install';
return 'pnpm install';
}

public function getBuildCommand(): string
{
return 'npm run build';
return 'pnpm run build';
}

public function getOutputDirectory(): string
Expand All @@ -212,4 +212,4 @@ Only include dependencies strictly necessary for the adapter, preferably officia

### Testing with Docker 🛠️

The existing test suite is helpful when developing a new Detector/ Detection adapter. Use official Docker images from trusted sources. Add new tests for your new Detector/ Detection adapter in `tests/unit/DetectorTest.php` test class. The specific `docker-compose` command for testing can be found in the [README](/README.md#tests).
The existing test suite is helpful when developing a new Detector/ Detection adapter. Use official Docker images from trusted sources. Add new tests for your new Detector/ Detection adapter in `tests/unit/DetectorTest.php` test class. The specific `docker-compose` command for testing can be found in the [README](/README.md#tests).
8 changes: 5 additions & 3 deletions src/Detection/Framework/Analog.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Angular.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Astro.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Lynx.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/NextJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Nuxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/React.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/ReactNative.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Remix.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Svelte.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/SvelteKit.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/TanStackStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/Detection/Framework/Vue.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public function getInstallCommand(): string
return match ($this->packager) {
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
default => 'npm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

public function getBuildCommand(): string
{
return match ($this->packager) {
'yarn' => 'yarn build',
'pnpm' => 'pnpm build',
default => 'npm run build',
'pnpm' => 'pnpm run build',
'npm' => 'npm run build',
default => 'pnpm run build',
};
}

Expand Down
4 changes: 3 additions & 1 deletion src/Detection/Packager/PNPM.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function getName(): string
*/
public function getFiles(): array
{
return ['pnpm-lock.yaml'];
return [
'pnpm-lock.yaml',
];
}
}
7 changes: 4 additions & 3 deletions src/Detection/Runtime/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public function getLanguages(): array
public function getCommands(): string
{
return match ($this->packager) {
'yarn' => 'yarn install && yarn build',
'pnpm' => 'pnpm install && pnpm run build',
default => 'npm install && npm run build',
'yarn' => 'yarn install',
'pnpm' => 'pnpm install',
'npm' => 'npm install',
default => 'pnpm install',
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/Detector/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class Framework extends Detector
*/
protected array $options = [];

protected string $packager = 'npm';
protected string $packager = 'pnpm';

public function __construct(string $packager = 'npm')
public function __construct(string $packager = 'pnpm')
{
parent::__construct();
$this->packager = $packager;
Expand Down
4 changes: 2 additions & 2 deletions src/Detector/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class Runtime extends Detector

protected Strategy $strategy;

protected string $packager = 'npm';
protected string $packager = 'pnpm';

public function __construct(Strategy $strategy, string $packager = 'npm')
public function __construct(Strategy $strategy, string $packager = 'pnpm')
{
parent::__construct();
$this->strategy = $strategy;
Expand Down
Loading