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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Static JSON information about Shopware
- Contains all Security Advisories
- Contains an mapping of Shopware Version to Advistory
- [php-version.json](https://github.com/FriendsOfShopware/shopware-static-data/blob/main/data/php-version.json)
- Contains each Shopware Version with it min PHP version
- Contains each Shopware Version with a list of corresponding supported PHP versions
212 changes: 212 additions & 0 deletions data/all-supported-php-versions-by-shopware-version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
{
"6.5.0.0": [
"8.1",
"8.2"
],
"6.5.0.0-rc1": [
"8.1",
"8.2"
],
"6.4.20.2": [
"8.0",
"8.1",
"8.2"
],
"6.4.20.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.19.0": [
"8.0",
"8.1",
"8.2"
],
"6.4.17.2": [
"8.0",
"8.1",
"8.2"
],
"6.4.15.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.14.0": [
"8.0",
"8.1",
"8.2"
],
"6.4.13.0": [
"8.0",
"8.1",
"8.2"
],
"6.4.12.0": [
"8.0",
"8.1",
"8.2"
],
"6.4.11.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.10.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.10.0": [
"8.0",
"8.1",
"8.2"
],
"6.4.8.2": [
"8.0",
"8.1",
"8.2"
],
"6.4.7.0": [
"8.0",
"8.1",
"8.2"
],
"6.4.6.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.5.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.4.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.3.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.2.1": [
"8.0",
"8.1",
"8.2"
],
"6.4.1.2": [
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.4.1.1": [
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.4.1.0": [
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.4.0.0": [
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.5.4": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.5.0": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.4.1": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.3.1": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.2.1": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.1.0": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"6.3.0.2": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"v6.2.3": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"v6.1.6": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"v6.1.5": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
],
"v6.0.0+ea2": [
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2"
]
}
46 changes: 46 additions & 0 deletions generate.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import { satisfies } from "https://github.com/omichelsen/compare-versions/raw/main/src/index.ts";

/**
* @todo: is there an API / simple way to dynamically load PHP minor versions?
*/
const PHP_VERSIONS = [
"7.0",
"7.1",
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2",
];

async function generate() {
const allVersionsResp = await fetch('https://api.github.com/repos/shopware/platform/tags?per_page=100');
const allVersions = await allVersionsResp.json();

await generateSecurity(allVersions);
await generatePHPVersionMap(allVersions);
await generateAllSupportedPhpVersions();
}

async function generateSecurity(allVersions: any) {
Expand Down Expand Up @@ -70,4 +85,35 @@ async function generatePHPVersionMap(allVersions: any) {
await Deno.writeTextFile("data/php-version.json", JSON.stringify(data, null, 4));
}


async function generateAllSupportedPhpVersions() {
// TODO: typing for the API endpoint
const packagistDataResp = await fetch("https://repo.packagist.org/p2/shopware/platform.json");
const packagistData = await packagistDataResp.json();
const packageVersions = packagistData.packages["shopware/platform"];
const data: Record<string, Array<string>> = {};

for (let index in packageVersions) {
const packageVersion = packageVersions[index];
const semverVersion = packageVersion?.version;
const phpDependency = packageVersion?.require?.php;

if (!semverVersion || !phpDependency) {
continue;
}

PHP_VERSIONS.forEach((phpVersion) => {
if (satisfies(phpVersion, phpDependency)) {
if (!data[semverVersion]) {
data[semverVersion] = [];
}

data[semverVersion].push(phpVersion);
}
});
}

await Deno.writeTextFile("data/all-supported-php-versions-by-shopware-version.json", JSON.stringify(data, null, 4));
}

generate().then();