Skip to content

Commit cc7b218

Browse files
Add file lock yarn.lock for Bun and update README.md. (#52)
1 parent 82c3894 commit cc7b218

File tree

6 files changed

+163
-64
lines changed

6 files changed

+163
-64
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Change Log
22
==========
33

4-
## 0.1.1 Under development
4+
## 0.1.1 April 4, 2024
55

66
- Enh #50: Add `BunManager` class to manage the `Bun` instances (@terabytesoftw)
7+
- Enh #52: Add file lock `yarn.lock` for `Bun` and update `README.md` (@terabytesoftw)
78

89
## 0.1.0 January 21, 2024
910

README.md

Lines changed: 63 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center"><a href="https://github.com/php-forge/foxy" target="_blank">
2-
<img src="https://foxypkg.com/assets/img/logo.svg" width="260" alt="Foxy">
2+
<img src="https://github.com/php-forge/foxy/blob/main/resources/foxy.svg" width="260" alt="Foxy">
33
</a></p>
44

55
<p align="center">
@@ -20,6 +20,23 @@
2020
</a>
2121
</p>
2222

23+
Add to your `composer.json` file.
24+
25+
Manager can be `bun`, `npm`, `yarn` or `pnpm`. For default, `npm` is used.
26+
27+
```json
28+
{
29+
"require": {
30+
"php-forge/foxy": "^0.1"
31+
},
32+
"config": {
33+
"foxy": {
34+
"manager": "bun"
35+
}
36+
}
37+
}
38+
```
39+
2340
> **Important:**
2441
>
2542
> ⚠ This plugin is based on [Fxpio/Foxy](https://github.com/fxpio/foxy).
@@ -28,62 +45,74 @@
2845
> - PHP version to `8.1` or higher.
2946
> - Composer version to `2.0` or higher.
3047
> - Composer api version to `2.0` or higher.
48+
> - Add support for [Bun](https://bun.sh/).
3149
> - Remove deprecated methods.
3250
> - Add static analysis with [Psalm](https://psalm.dev).
51+
> - Add code quality with [StyleCI](https://github.styleci.io).
52+
3353

3454
Foxy is a Composer plugin to automate the validation, installation, updating and removing of PHP libraries
3555
asset dependencies (javaScript, stylesheets, etc.) defined in the NPM `package.json` file of the project and
3656
PHP libraries during the execution of Composer. It handles restoring the project state in case
37-
[Bun](https://github.com/oven-sh/bun) or [NPM](https://www.npmjs.com) or [Yarn](https://yarnpkg.com) or [PNpM](https://PNpM.io) terminates with an error.
38-
39-
All features and tools are available: [Npmrc](https://docs.npmjs.com/files/npmrc), [Yarnrc](https://yarnpkg.com/en/docs/yarnrc),
40-
[Webpack](https://webpack.js.org), [Gulp](https://gulpjs.com), [Grunt](https://gruntjs.com),
41-
[Babel](https://babeljs.io), [TypeScript](https://www.typescriptlang.org), [Scss/Sass](http://sass-lang.com),
42-
[Less](http://lesscss.org), etc.
43-
44-
It is certain that each language has its own dependency management system, and that it is highly recommended to use
45-
each package manager. NPM, Yarn or PNpM works very well when the asset dependencies are managed only in the PHP project,
46-
but when you create PHP libraries that using assets, there is no way to automatically add asset dependencies,
47-
and most importantly, no validation of versions can be done automatically. You must tell the developers
48-
the list of asset dependencies that using by your PHP library, and you must ask him to add manually the asset
49-
dependencies to its asset manager of his project.
50-
51-
However, another solution exist - what many projects propose - you must add the assets in the folder of the
52-
PHP library (like `/assets`, `/Resources/public`). Of course, with this method, the code is duplicated, it
53-
pollutes the source code of the PHP library, no version management/validation is possible, and it is even
54-
less possible, to use all tools such as Babel, Scss, Less, etc ...
55-
56-
Foxy focuses solely on automation of the validation, addition, updating and deleting of the dependencies in
57-
the definition file of the asset package, while restoring the project state, as well as PHP dependencies if
58-
NPM, Yarn or PNpM terminates with an error.
57+
[Bun](https://bun.sh/) or [NPM](https://www.npmjs.com) or [Yarn](https://yarnpkg.com) or [PNpM](https://PNpM.io) terminates with an error.
58+
59+
All features and tools are available:
60+
61+
- [Babel](https://babeljs.io)
62+
- [Bun](https://github.com/oven-sh/bun)
63+
- [Grunt](https://gruntjs.com)
64+
- [Gulp](https://gulpjs.com)
65+
- [Npmrc](https://docs.npmjs.com/files/npmrc)
66+
- [Less](http://lesscss.org)
67+
- [Scss/Sass](http://sass-lang.com)
68+
- [TypeScript](https://www.typescriptlang.org)
69+
- [Yarnrc](https://yarnpkg.com/en/docs/yarnrc)
70+
- [Webpack](https://webpack.js.org), ,
71+
72+
It is certain that each language has its own dependency management system, and that it is highly recommended to use each
73+
package manager. NPM, Yarn or PNpM works very well when the asset dependencies are managed only in the PHP project, but
74+
when you create PHP libraries that using assets, there is no way to automatically add asset dependencies, and most
75+
importantly, no validation of versions can be done automatically. You must tell the developers the list of asset
76+
dependencies that using by your PHP library, and you must ask him to add manually the asset dependencies to its asset
77+
manager of his project.
78+
79+
However, another solution exist - what many projects propose - you must add the assets in the folder of the PHP library
80+
(like `/assets`, `/Resources/public`). Of course, with this method, the code is duplicated, it pollutes the source code
81+
of the PHP library, no version management/validation is possible, and it is even less possible, to use all tools such as
82+
Babel, Scss, Less, etc ...
83+
84+
Foxy focuses solely on automation of the validation, addition, updating and deleting of the dependencies in the
85+
definition file of the asset package, while restoring the project state, as well as PHP dependencies if Bun, NPM, Yarn
86+
or PNpM terminates with an error.
5987

6088
#### It is Fast
6189

62-
Foxy retrieves the list of all Composer dependencies to inject the asset dependencies in the file `package.json`,
63-
and leaves the execution of the analysis, validation and downloading of the libraries to NPM, Yarn or PNpM. Therefore,
64-
no VCS Repository of Composer is used for analyzing the asset dependencies, and you keep the performance
90+
Foxy retrieves the list of all Composer dependencies to inject the asset dependencies in the file `package.json`, and
91+
leaves the execution of the analysis, validation and downloading of the libraries to Bun, NPM, Yarn or PNpM.
92+
93+
Therefore, no VCS Repository of Composer is used for analyzing the asset dependencies, and you keep the performance
6594
of native package manager used.
6695

6796
#### It is Reliable
6897

69-
Foxy creates mock packages of the PHP libraries containing only the asset dependencies definition file
70-
in a local directory, and associates these packages in the asset dependencies definition file of the
71-
project. Given that Foxy does not manipulate any asset dependencies, and let alone the version constraints,
72-
this allows NPM, Yarn or PNpM to solve the asset dependencies without any intermediary. Moreover, the entire
73-
validation with the lock file and installation process is left to NPM, Yarn or PNpM.
98+
Foxy creates mock packages of the PHP libraries containing only the asset dependencies definition file in a local
99+
directory, and associates these packages in the asset dependencies definition file of the project. Given that Foxy does
100+
not manipulate any asset dependencies, and let alone the version constraints, this allows Bun, NPM, Yarn or PNpM to
101+
solve the asset dependencies without any intermediary. Moreover, the entire validation with the lock file and
102+
installation process is left to Bun, NPM, Yarn or PNpM.
74103

75104
#### It is Secure
76105

77-
Foxy restores the Composer lock file with all its PHP dependencies, as well as the asset dependencies
78-
definition file, in the previous state if NPM, Yarn or PNpM ends with an error.
106+
Foxy restores the Composer lock file with all its PHP dependencies, as well as the asset dependencies definition file,
107+
in the previous state if Bun, NPM, Yarn or PNpM ends with an error.
79108

80109
Features
81110
--------
82111

83112
- Compatible with [Yii Assets](https://github.com/yiisoft/assets)
84113
- Compatible with [Symfony Webpack Encore](http://symfony.com/doc/current/frontend.html)
85114
and [Laravel Mix](https://laravel.com/docs/master/mix)
86-
- Works with Node.js and NPM, Yarn or PNpM
115+
- Works with Node.js and Bun, NPM, Yarn or PNpM
87116
- Works with the asset dependencies defined in the `package.json` file for projects and PHP libraries
88117
- Works with the installation in the dependencies of the project or libraries (not in global mode)
89118
- Works with public or private repositories

composer.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/foxy.svg

Lines changed: 69 additions & 0 deletions
Loading

src/Asset/BunManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ protected function getInstallCommand(): string
4848
{
4949
$command = Platform::isWindows() ? 'bun.exe' : 'bun';
5050

51-
return $this->buildCommand($command, 'install', 'install --yarn');
51+
return $this->buildCommand($command, 'install', 'install -y');
5252
}
5353

5454
protected function getUpdateCommand(): string
5555
{
5656
$command = Platform::isWindows() ? 'bun.exe' : 'bun';
5757

58-
return $this->buildCommand($command, 'update', 'update');
58+
return $this->buildCommand($command, 'update', 'update -y');
5959
}
6060
}

0 commit comments

Comments
 (0)