From b6872f48e0cf7fe0275bc8678ecf77d7d1c5c89b Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sat, 7 Sep 2024 13:11:54 +0000 Subject: [PATCH 1/7] use JSON_JSONLINT rather than JSON_PRETTIER --- .mega-linter.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.mega-linter.yml b/.mega-linter.yml index ffa91da..b76d258 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -12,7 +12,7 @@ ENABLE: - PHP - YAML DISABLE_LINTERS: - - JSON_JSONLINT + - JSON_PRETTIER - JSON_V8R - MARKDOWN_MARKDOWN_TABLE_FORMATTER - MARKDOWN_MARKDOWN_LINK_CHECK @@ -23,7 +23,6 @@ DISABLE_LINTERS: ACTION_ACTIONLINT_ARGUMENTS: "-shellcheck" DOCKERFILE_HADOLINT_ARGUMENTS: "-t error" EDITORCONFIG_EDITORCONFIG_CHECKER_CLI_LINT_MODE: project -JSON_PRETTIER_FILTER_REGEX_EXCLUDE: "(composer\\.json||box\\.json||sbom\\.json)" MARKDOWN_MARKDOWNLINT_CONFIG_FILE: ".markdown-lint.json" MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE: "(\\.github)" PHP_PHPSTAN_CLI_LINT_MODE: project # to avoid https://github.com/nvuillam/mega-linter/issues/725 From 9588a5debdda7160dcb4f0770a6ff2be84cb5c59 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sat, 7 Sep 2024 13:14:45 +0000 Subject: [PATCH 2/7] prettify directories setting --- box.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/box.json b/box.json index 2e496c1..dc3c425 100644 --- a/box.json +++ b/box.json @@ -10,7 +10,11 @@ "dist", "vendor-bin" ], - "directories": ["bin", "src", "vendor"], + "directories": [ + "bin", + "src", + "vendor" + ], "directories-bin": [ "vendor/humbug/box/res/requirement-checker", "resources" From a7cacadc76355550fa913aa482bad2f25914dc97 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 3 Oct 2024 04:45:55 +0000 Subject: [PATCH 3/7] bump ramsey/composer-install action from v2 to v3 (because Node16 js support was dropped on GH) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f77a90d..5653c9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: - # https://github.com/ramsey/composer-install name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 with: composer-options: "--prefer-dist" From f5f8972d119f08a9396944fb6fd7288476d94596 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 3 Oct 2024 04:52:59 +0000 Subject: [PATCH 4/7] dump-autoload box setting should be applied only if not previously defined --- .changes/unreleased/Fixed-20241003-072041.yaml | 3 +++ box.json | 3 ++- box.json.dist | 2 +- src/Pipeline/ConfigureStage.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Fixed-20241003-072041.yaml diff --git a/.changes/unreleased/Fixed-20241003-072041.yaml b/.changes/unreleased/Fixed-20241003-072041.yaml new file mode 100644 index 0000000..24baf85 --- /dev/null +++ b/.changes/unreleased/Fixed-20241003-072041.yaml @@ -0,0 +1,3 @@ +kind: Fixed +body: '[GH-13](https://github.com/llaville/box-manifest/issues/13) : v4.0.0-rc.1 does not support correctly the BOX dump-autoload setting' +time: 2024-10-03T07:20:41.299069779Z diff --git a/box.json b/box.json index dc3c425..bccbd32 100644 --- a/box.json +++ b/box.json @@ -26,5 +26,6 @@ "files-bin": [ "vendor/humbug/php-scoper/vendor-hotfix/.gitkeep" ], - "stub": "stub.php" + "stub": "stub.php", + "dump-autoload": true } diff --git a/box.json.dist b/box.json.dist index aeabfe0..863ae14 100644 --- a/box.json.dist +++ b/box.json.dist @@ -31,7 +31,7 @@ ".box.manifests.bin" ], "stub": "stub.php", - "dump-autoload": false, + "dump-autoload": true, "map": [ { "console-table.txt": ".box.manifests/console-table.txt" diff --git a/src/Pipeline/ConfigureStage.php b/src/Pipeline/ConfigureStage.php index 606ce55..69c9c36 100644 --- a/src/Pipeline/ConfigureStage.php +++ b/src/Pipeline/ConfigureStage.php @@ -48,7 +48,7 @@ public function __invoke(array $payload): array // @link Due to issue https://github.com/box-project/box/issues/580 // @see https://github.com/box-project/box/issues/580#issuecomment-2326577684 - $configs['dump-autoload'] = false; + $configs['dump-autoload'] ??= false; // should be applied only if not previously defined if (!isset($configs['files-bin'])) { $configs['files-bin'] = []; From 19e4aeef6b2b4891570dd62e759b197e54623533 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 3 Oct 2024 07:28:34 +0000 Subject: [PATCH 5/7] remove ROADMAP now final version 4.0.0 (stable) is on way --- README.md | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/README.md b/README.md index b86f011..a5fb461 100644 --- a/README.md +++ b/README.md @@ -34,33 +34,6 @@ All the documentation is available on [website][docs-website], generated from th - Laurent Laville (Lead Developer) -## Roadmap - -```mermaid -%%{init: { 'gitGraph': {'mainBranchName': 'master', 'rotateCommitLabel': false, 'mainBranchOrder': 1}} }%% -gitGraph TB: - commit id: "5a1721a" type: HIGHLIGHT tag: "3.5.1" - commit id: "(fixed issue #11) 8f2bd10" - branch 4.x - commit id: "(only keep manifest:* commands and removed legacy box:* commands) cb90b40" - commit id: "(replaced deprecated import about fidry/console) 2794e2d" - commit id: "(add shorcut for bootstrap option) dd5766f" - commit id: "(rename format option to output-format) 4d3d306" - commit id: "(add shortcut for resource option) c2aba93" - commit id: "(upgrade cyclonedx/cyclonedx-library constraint to use major version 3) 8a1e05d" - commit id: "(use SBOM spec 1.6 as default for sbom-json and sbom-xml output format) 29e0b2c" - commit id: "(consider serialNumber as optional and do not stop SBOM generation by Exception) f33bc49" - commit id: "(add alias on legacy command and renamed it to shortnames) 670500f" - commit id: "(build ansi format first rather than console with new render) 42e8c93" - commit id: "(add link to Packagist homepage of each dependency into console table format) 26b3262" - commit id: "(version of BOX Manifest used to generate stub (from template) is now identified) 39eb52e" - commit id: "(introduces auto detection by filename ansi.txt) 5a174e2" - commit id: "(introduces new make command to replace legacy commands) 734ecb6" - commit id: "(introduces new inspect command) 36e0540" - checkout master - commit id: "upcoming major version" type: HIGHLIGHT tag: "4.0.0" -``` - [php-phar]: https://www.php.net/phar [box-project]: https://github.com/box-project/box [cyclonedx]: https://github.com/CycloneDX From 8ef6bd3335e3e32cb52977b56f513eecdc560adb Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 3 Oct 2024 13:13:53 +0000 Subject: [PATCH 6/7] prepare major feature release 4.0 --- .changes/4.0.0.md | 11 + .../unreleased/Fixed-20241003-072041.yaml | 3 - CHANGELOG.md | 219 ++++++++++++++++++ 3 files changed, 230 insertions(+), 3 deletions(-) create mode 100644 .changes/4.0.0.md delete mode 100644 .changes/unreleased/Fixed-20241003-072041.yaml diff --git a/.changes/4.0.0.md b/.changes/4.0.0.md new file mode 100644 index 0000000..e0cfc07 --- /dev/null +++ b/.changes/4.0.0.md @@ -0,0 +1,11 @@ + +## 4.0.0 - 2024-10-03 + +Read the [first release candidate](https://github.com/llaville/box-manifest/releases/tag/4.0.0-rc.1) notes of this major version +to learn more about changes since 3.5.1 + +### Fixed + +- [GH-13](https://github.com/llaville/box-manifest/issues/13) : v4.0.0-rc.1 does not support correctly the BOX `dump-autoload` setting + +**Full Changelog**: [4.0.0-rc.1...4.0.0](https://github.com/llaville/box-manifest/compare/4.0.0-rc.1...4.0.0) diff --git a/.changes/unreleased/Fixed-20241003-072041.yaml b/.changes/unreleased/Fixed-20241003-072041.yaml deleted file mode 100644 index 24baf85..0000000 --- a/.changes/unreleased/Fixed-20241003-072041.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: '[GH-13](https://github.com/llaville/box-manifest/issues/13) : v4.0.0-rc.1 does not support correctly the BOX dump-autoload setting' -time: 2024-10-03T07:20:41.299069779Z diff --git a/CHANGELOG.md b/CHANGELOG.md index 44938ce..cf30a6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## 4.0.0 - 2024-10-03 + +Read the [first release candidate](https://github.com/llaville/box-manifest/releases/tag/4.0.0-rc.1) notes of this major version +to learn more about changes since 3.5.1 + +### Fixed + +- [GH-13](https://github.com/llaville/box-manifest/issues/13) : v4.0.0-rc.1 does not support correctly the BOX `dump-autoload` setting + +**Full Changelog**: [4.0.0-rc.1...4.0.0](https://github.com/llaville/box-manifest/compare/4.0.0-rc.1...4.0.0) + ## 4.0.0-rc.1 - 2024-09-04 **Road to stable version 4.0** @@ -48,3 +59,211 @@ So, if you want to improve this package before final stable version 4.0, please - [#11](https://github.com/llaville/box-manifest/issues/11) : No longer require `phar.readonly` to be off for using PHPUnit **Full Changelog**: [3.5.1...4.0.0-rc.1](https://github.com/llaville/box-manifest/compare/3.5.1...4.0.0-rc.1) + +## 3.5.1 - 2023-10-13 + +IMPORTANT: This bugfix release mark the latest version that will support BOX v4 and development is stopped ! + +### Changed + +- update `humbug/box` constraint to restrict BOX v4 support to 4.3.x +- use latest SBOM spec version (1.5) on `manifest:build` command + +### Fixed + +- #10: `box:validate` command support now the recommendation color style formatter + +**Full Changelog**: [3.5.0...3.5.1](https://github.com/llaville/box-manifest/compare/3.5.0...3.5.1) + +## 3.5.0 - 2023-04-16 + +**CAUTION** : if you want to use the new `PostInstallStrategy`, please read first. + +### Added + +- `PostInstallStrategy` to keep your manifests synchronized with dependencies installed. + +### Changed + +- Refactor code to add strategy pattern on manifest build process + +**Full Changelog**: [3.4.0...3.5.0](https://github.com/llaville/box-manifest/compare/3.4.0...3.5.0) + +## 3.4.0 - 2023-04-10 + +### Added + +- `box:info` command display information about stub used + +**Full Changelog**: [3.3.2...3.4.0](https://github.com/llaville/box-manifest/compare/3.3.2...3.4.0) + +## 3.3.2 - 2023-04-04 + +### Fixed + +- Cannot run application when command is launched from `vendor/bin/box-manifest` (composer `bin-dir` config) + +**WARNING** Unless Composer added support to Symfony/Runtime, do not use `vendor/bin/box-manifest` +that will lead to a fatal error : see for details + +**Full Changelog**: [3.3.1...3.3.2](https://github.com/llaville/box-manifest/compare/3.3.1...3.3.2) + +## 3.3.1 - 2023-04-01 + +Same contents of release 3.3.0 + +### Fixed + +- PHAR distribution was not built during Release GitHub Workflow. + +**Full Changelog**: [3.3.0...3.3.1](https://github.com/llaville/box-manifest/compare/3.3.0...3.3.1) + +## 3.3.0 - 2023-04-01 + +### Added + +- `box:compile` and `box:info` are now able to add and display manifest files +- API: introduces `ManifestFormat` enumeration to replace hard-coded values + +### Changed + +- Ascii Logo and text look like BOX logo +- Displays long version without logo +- SBOM manifests format identify now the BOX Manifest application as tool +- The `manifest:stub` command is now able to use resources list defined by the BOX map settings +- API: `Manifest` enum renamed to `ManifestFile` +- BC breaks: `ManifestFactory` did not used anymore the Box instance (affect class constructor and static create method) + +**Full Changelog**: [3.2.1...3.3.0](https://github.com/llaville/box-manifest/compare/3.2.1...3.3.0) + +## 3.2.1 - 2023-03-28 + +### Fixed + +- `resources` directory was missing on Docker and PHAR distributions. + +**Full Changelog**: [3.2.0...3.2.1](https://github.com/llaville/box-manifest/compare/3.2.0...3.2.1) + +## 3.2.0 - 2023-03-28 + +### Added + +- Add new console format to print manifest in a Symfony Console Table format +- Random Serial Number on BOM format (raise Composer constraint to support library version 2.1+) +- created DateTime metadata on BOM format + +### Changed + +- Application was recombined to form a native 3 Symfony Commands (two native from BOX Manifest itself and three others from BOX Application) +- ManifestFactory may be able to enable or disable the ANSI color code decoration +- ManifestFactory build console output results on auto format detection (by default) + +### Fixed + +- Respect now the switches off debug mode (`--no-debug`) + +**Full Changelog**: [3.1.1...3.2.0](https://github.com/llaville/box-manifest/compare/3.1.1...3.2.0) + +## 3.1.1 - 2023-03-23 + +### Changed + +- Replace simple key-value pairs TEXT manifest by highlighted version in PHAR `box-*` commands + +### Fixed + +- [#6](https://github.com/llaville/box-manifest/issues/6) : Symfony BOX styles are not applied on `box-compile` command +- [#7](https://github.com/llaville/box-manifest/issues/7) : Display manifest at runtime do not respect `--no-ansi` console option rule + +**Full Changelog**: [3.1.0...3.1.1](https://github.com/llaville/box-manifest/compare/3.1.0...3.1.1) + +## 3.1.0 - 2023-03-22 + +### Changed + +- box-stub command: stub code is no more hard coded and may be changed at runtime with `--template` option +- box-stub command: manifest files is no more hard coded and may be changed at runtime with `--resource` option +- Optimize size of PHAR distributions for box-* commands + +### Fixed + +- Release workflow was fixed to avoid wrong resource files list to use + +**Full Changelog**: [3.0.0...3.1.0](https://github.com/llaville/box-manifest/compare/3.0.0...3.1.0) + +## 3.0.0 - 2023-03-21 + +**BC breaks with this major version** + +- Do not use anymore the `cweagans/composer-patches` composer-plugin to patch `humbug/box` at install time. +- This is a real standalone application with three distinct binary commands: `box-manifest`, `box-stub` and `box-compile` + +Don't forget to read the documentation and its tutorial that will guide you to create your first manifest with its stub and compile in a PHAR. + +### Added + +- new Docker workflow to publish docker images to GitHub repository + +### Changed + +- Entrypoint in Dockerfile refer now to multiple commands +- org.opencontainers.image.version label is generated by docker workflow now (avoid hard-coding and outdated version number) + +**Full Changelog**: [2.3.1...3.0.0](https://github.com/llaville/box-manifest/compare/2.3.1...3.0.0) + +## 2.3.1 - 2023-03-08 + +### Changed + +- update humbug/box composer constraint to avoid installation of Box 4.3.x not yet supported + +**Full Changelog**: [2.3.0...2.3.1](https://github.com/llaville/box-manifest/compare/2.3.0...2.3.1) + +## 2.3.0 - 2023-02-17 + +### Added + +- PHPUnit 10 support : phpunit.xml.dist configuration migration + +### Fixed + +- [#4](https://github.com/llaville/box-manifest/issues/4) : Prevent error when Composer installation does not exists +- [#5](https://github.com/llaville/box-manifest/issues/5) : Prevent Fatal error when root package installed as none version published + +**Full Changelog**: [2.2.1...2.3.0](https://github.com/llaville/box-manifest/compare/2.2.1...2.3.0) + +## 2.2.1 - 2023-01-14 + +### Fixed + +- regression with previous version 2.2.0 when dependency version have an alias + +**Full Changelog**: [2.2.0...2.2.1](https://github.com/llaville/box-manifest/compare/2.2.0...2.2.1) + +## 2.2.0 - 2023-01-14 + +### Changed + +- When package version is a branch alias, print branch name with commit reference for SimpleText in same way as DecorateText manifest builder + +### Fixed + +- update in the Getting Started guide the docker run syntax + +**Full Changelog**: [2.1.0...2.2.0](https://github.com/llaville/box-manifest/compare/2.1.0...2.2.0) + +## 2.1.0 - 2022-11-28 + +### Added + +- [#3](https://github.com/llaville/box-manifest/issues/3) : New Composer manifest builder to highlight dependencies constraints and versions + +**Full Changelog**: [2.0.0...2.1.0](https://github.com/llaville/box-manifest/compare/2.0.0...2.1.0) + +## 2.0.0 - 2022-11-24 + +### Added + +- [#2](https://github.com/llaville/box-manifest/issues/2) : Add support to BOX v4 + +**Full Changelog**: [1.2.0...2.0.0](https://github.com/llaville/box-manifest/compare/1.2.0...2.0.0) From fdc88519db469f113e259617917ecc56f8c04eee Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 3 Oct 2024 13:17:40 +0000 Subject: [PATCH 7/7] default stub for BOX Manifest v4 --- .gitignore | 1 - stub.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 stub.php diff --git a/.gitignore b/.gitignore index 896c602..f4c18a5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ sbom.xml sbom.cdx.json sbom.cdx.xml custom.bin -stub.php ###### PHPLint ###### .phplint-cache diff --git a/stub.php b/stub.php new file mode 100644 index 0000000..7a85791 --- /dev/null +++ b/stub.php @@ -0,0 +1,36 @@ + $withManifest) && !str_starts_with($argv[$withManifest + 1], '-')) ? [$argv[$withManifest + 1]] : ['console-table.txt', 'plain.txt', 'sbom.json']; + + foreach ($resources as $resource) { + $res = str_replace($manifestDir, '', $resource); + $filename = "phar://" . __FILE__ . "/$manifestDir$res"; + if (file_exists($filename)) { + $manifest = file_get_contents($filename); + if ($withoutAnsi !== false) { + $manifest = preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $manifest); + } + echo $manifest, PHP_EOL; + exit(0); + } elseif (count($resources) === 1) { + echo sprintf('Manifest "%s" is not available in this PHP Archive.', $resource), PHP_EOL; + exit(2); + } + } + echo 'No manifest found in this PHP Archive', PHP_EOL; + exit(1); +} + + + +// No PHAR config + +__HALT_COMPILER(); ?> +