Skip to content

Commit 13c0fb5

Browse files
committed
Merge remote-tracking branch 'origin/main' into wizard-container-queries
2 parents 44b137d + b54175a commit 13c0fb5

File tree

4,204 files changed

+191653
-107100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,204 files changed

+191653
-107100
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ charset = utf-8
88
[*.{css,html,java,js,json,less,txt,ts}]
99
trim_trailing_whitespace = true
1010
end_of_line = lf
11+
indent_style = tab
1112
tab_width = 4
1213

1314
[pom.xml]

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ body:
2828
id: example
2929
attributes:
3030
label: Isolated Example
31-
description: Please provide a link to an isolated example if possible by forking [this codesandbox](https://codesandbox.io/s/71r1x5o51q?fontsize=14&module=%2Findex.html).
31+
description: Please provide a link to an isolated example if possible by forking [this stackblitz](https://stackblitz.com/edit/js-vsrpnb?file=index.js,index.html).
3232
validations:
3333
required: false
3434
- type: textarea

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33

44
### PR checklist
5+
- [ ] Check the [Development Hints](https://sap.github.io/ui5-webcomponents/docs/contributing/DoD/)
6+
57
- [ ] Follow the [Commit message Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md#commit-message-style)
68

79
For example: `fix(ui5-*): correct/fix sth` or `feat(ui5-*): add/introduce sth`. If you don't want the change to be part of the release changelog - use `chore`, `refactor` or `docs`.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { promises as fs } from 'node:fs';
2+
import { success as issueCommenter } from '@semantic-release/github';
3+
4+
const getReleaseCommits = (releaseBody) => {
5+
const commits = new Set();
6+
7+
const shaRegex = /commit\/(?<sha>\w{40})/g;
8+
for (const match of releaseBody.matchAll(shaRegex)) {
9+
if (match.groups?.sha) {
10+
commits.add({ hash: match.groups.sha });
11+
}
12+
}
13+
14+
// Converting Set back to an array to get unique commits as array
15+
return Array.from(commits);
16+
};
17+
18+
const getOctokitShim = (github) => {
19+
return new Proxy(class {}, {
20+
construct(target, argArray, newTarget) {
21+
return github;
22+
}
23+
});
24+
}
25+
26+
/**
27+
* Publishes comments to issues that are fixed and released.
28+
* @param options {object}
29+
* @param options.github {import("@octokit/rest/dist-types/index.d.ts").Octokit}
30+
* @param options.context
31+
*/
32+
export default async function run({ github, context }) {
33+
const lerna = await fs.readFile(new URL('../../lerna.json', import.meta.url), 'utf8');
34+
const { version } = JSON.parse(lerna);
35+
36+
const { owner, repo } = context.repo;
37+
const releaseInfo = await github.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
38+
owner,
39+
repo,
40+
tag: `v${version}`
41+
});
42+
const release = releaseInfo.data;
43+
release.url = release.html_url;
44+
45+
46+
const commits = await getReleaseCommits(release.body);
47+
48+
49+
try {
50+
const semanticReleaseContext = {
51+
options: {
52+
repositoryUrl: `https://github.com/${owner}/${repo}`
53+
},
54+
commits,
55+
nextRelease: { version: `v${version}` },
56+
releases: [release],
57+
logger: console,
58+
env: process.env
59+
};
60+
const Octokit = getOctokitShim(github);
61+
62+
console.log('Commits:', commits.toString());
63+
console.log('semanticReleaseContext:', semanticReleaseContext);
64+
65+
await issueCommenter({}, semanticReleaseContext, { Octokit });
66+
67+
} catch (error) {
68+
console.error('Error in posting comment:', error);
69+
}
70+
}

.github/actions/createIssueComments.cjs

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import { promises as fs } from 'node:fs';
2+
3+
const extractChangelogSections = (releaseBody) => {
4+
const fixes = [];
5+
const features = [];
6+
const fixesMatch = releaseBody.match(/## Bug Fixes([\s\S]*?)(?=##|$)/);
7+
const featuresMatch = releaseBody.match(/## Features([\s\S]*?)(?=##|$)/);
8+
9+
if (fixesMatch) {
10+
// Split lines, trim whitespace, and remove any leading bullet point (like "*" or "-")
11+
const fixEntries = fixesMatch[1].trim().split('\n').map(line => line.replace(/^[*-]\s*/, '').trim());
12+
fixes.push(...fixEntries);
13+
}
14+
if (featuresMatch) {
15+
const featureEntries = featuresMatch[1].trim().split('\n').map(line => line.replace(/^[*-]\s*/, '').trim());
16+
features.push(...featureEntries);
17+
}
18+
19+
return { fixes, features };
20+
};
21+
22+
const mergeReleaseChangelogs = (minorRelease, rcReleases) => {
23+
// Extract the existing changes from the minor release body
24+
const { fixes: minorFixes, features: minorFeatures } = extractChangelogSections(minorRelease.body);
25+
const fixes = [...minorFixes];
26+
const features = [...minorFeatures];
27+
28+
// Add changes from each RC release
29+
rcReleases.forEach((release) => {
30+
const { fixes: rcFixes, features: rcFeatures } = extractChangelogSections(release.body);
31+
fixes.push(...rcFixes);
32+
features.push(...rcFeatures);
33+
})
34+
35+
// Sort fixes and features alphabetically
36+
const sortedFixes = fixes.sort((a, b) => {
37+
const contentA = a.match(/\*\*(.*?)\*\*/)?.[1] || '';
38+
const contentB = b.match(/\*\*(.*?)\*\*/)?.[1] || '';
39+
return contentA.localeCompare(contentB);
40+
});
41+
42+
const sortedFeatures = features.sort((a, b) => {
43+
const contentA = a.match(/\*\*(.*?)\*\*/)?.[1] || '';
44+
const contentB = b.match(/\*\*(.*?)\*\*/)?.[1] || '';
45+
return contentA.localeCompare(contentB);
46+
});
47+
48+
return { fixes: sortedFixes, features: sortedFeatures };
49+
}
50+
51+
const updateRelease = async (releaseContext) => {
52+
const releaseId = releaseContext.minorRelease.id;
53+
const releaseHeaderMatch = releaseContext.minorRelease.body.match(/^#\s\[.*?\]\(.*?\)\s\([\d-]+\)/);
54+
const releaseHeader = releaseHeaderMatch ? `${releaseHeaderMatch[0]}\n\n` : '';
55+
const formattedFixes = releaseContext.fixes.length ? `### Fixes\n- ${releaseContext.fixes.join('\n- ')}` : '';
56+
const formattedFeatures = releaseContext.features.length ? `### Features\n- ${releaseContext.features.join('\n- ')}` : '';
57+
const body = `${releaseHeader}${formattedFeatures}\n\n${formattedFixes}`.trim();
58+
59+
try {
60+
await releaseContext.github.request('PATCH /repos/{owner}/{repo}/releases/{releaseId}', {
61+
owner: releaseContext.owner,
62+
repo: releaseContext.repo,
63+
body,
64+
releaseId,
65+
});
66+
67+
console.log(`Release ${releaseContext.version} updated successfully:`, releaseContext);
68+
} catch (error) {
69+
console.error(`Error updating release ${releaseContext.version}:`, error );
70+
}
71+
};
72+
73+
/**
74+
* Publishes comments to issues that are fixed and released.
75+
* @param options {object}
76+
* @param options.github {import("@octokit/rest/dist-types/index.d.ts").Octokit}
77+
* @param options.context
78+
*/
79+
export default async function run({ github, context }) {
80+
const lerna = await fs.readFile(new URL('../../lerna.json', import.meta.url), 'utf8');
81+
const { version } = JSON.parse(lerna);
82+
83+
if (!version.startsWith("2")) {
84+
console.warn('Skip: the task is relevant for version 2');
85+
return;
86+
}
87+
88+
try {
89+
const { owner, repo } = context.repo;
90+
const allReleases = (await github.request('GET /repos/{owner}/{repo}/releases', { owner, repo })).data;
91+
const rcReleases = allReleases.filter((release) => release.tag_name.includes(`v${version}-rc`));
92+
const minorRelease = allReleases.find((release) => release.tag_name === `v${version}`);
93+
94+
// Merge RC changelogs
95+
const { fixes, features } = await mergeReleaseChangelogs(minorRelease, rcReleases);
96+
97+
const minorReleaseContext = {
98+
github,
99+
version,
100+
owner,
101+
repo,
102+
minorRelease,
103+
fixes,
104+
features
105+
}
106+
107+
// Update the minor release with aggregated changelog
108+
await updateRelease(minorReleaseContext);
109+
110+
} catch (error) {
111+
console.error('Error:', error);
112+
}
113+
}

.github/actions/release.cjs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const fs = require("fs").promises;
2+
const child_process = require("child_process");
3+
const commandLineArgs = require('command-line-args');
4+
const execSync = child_process.execSync;
5+
const gitRev = execSync("git rev-parse HEAD").toString();
6+
7+
const PACKAGES = {};
8+
const NPM_ORG = "@ui5/webcomponents";
9+
10+
const options = commandLineArgs([
11+
{ name: 'version', alias: 'v', type: String },
12+
{ name: 'tag', alias: 't', type: String },
13+
{ name: 'otp', alias: 'p', type: String },
14+
]);
15+
16+
const DEFAULT_TAG = "experimental";
17+
const TAG = options.tag || DEFAULT_TAG;
18+
const NEW_VERSION = options.version;
19+
const OTP = options.otp;
20+
21+
const run = async () => {
22+
const { globby } = await import("globby");
23+
let FILES = await globby(["packages/*/package.json", "!packages/playground/package.json", "!packages/website/package.json"]);
24+
25+
// Step 1: process package.json files
26+
const pkgs = await Promise.all(FILES.map(processPackageJSON));
27+
28+
// Step 2: update package.json files
29+
await Promise.all(pkgs.map(updatePackageJSON));
30+
31+
// Step 3: publish each package to npm
32+
pkgs.forEach(publishPackage);
33+
};
34+
35+
const processPackageJSON = async file => {
36+
const folder = file.split("package.json")[0];
37+
const fileRead = await fs.readFile(file);
38+
const fileContent = JSON.parse(fileRead.toString());
39+
const name = fileContent.name;
40+
41+
const version = NEW_VERSION || `0.0.0-${gitRev.slice(0,9,)}`;
42+
43+
PACKAGES[name] = { name, file, fileContent, version, folder };
44+
return PACKAGES[name];
45+
};
46+
47+
const updatePackageJSON = async pkg => {
48+
const file = pkg.file;
49+
const fileContent = pkg.fileContent;
50+
const dependencies = fileContent.dependencies;
51+
const devDependencies = fileContent.devDependencies;
52+
53+
fileContent.version = pkg.version;
54+
dependencies && getDependencies(dependencies).forEach(dep => {
55+
fileContent.dependencies[dep] = PACKAGES[dep].version;
56+
});
57+
devDependencies && getDependencies(devDependencies).forEach(dep => {
58+
fileContent.devDependencies[dep] = PACKAGES[dep].version;
59+
});
60+
61+
return fs.writeFile(file, JSON.stringify(fileContent, null, " "));
62+
};
63+
64+
const getDependencies = (dependencies) => {
65+
return Object.keys(dependencies).filter(dep => dep.startsWith(NPM_ORG));
66+
};
67+
68+
const publishPackage = pkg => {
69+
console.info(`Publish ${pkg.name}: ${pkg.version} ...`); // eslint-disable-line
70+
const OTP_PARAM = OTP ? `--otp=${OTP}` : ``;
71+
execSync(`yarn publish ${pkg.folder} --tag=${TAG} --new-version=${pkg.version} ${OTP_PARAM}`);
72+
};
73+
74+
run().catch(error => {
75+
console.error("Release of @experimental version failed", error); // eslint-disable-line
76+
});

.github/actions/release.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)