docs(java): fix pom.xml (and auto-generate) (#15192)

This commit is contained in:
Ross Wollman 2022-06-28 11:37:53 -07:00 коммит произвёл GitHub
Родитель aa1e736f3f
Коммит 3805e942a1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -59,7 +59,7 @@ public class Example {
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.17.1</version>
<version>1.24.0</version>
</dependency>
</dependencies>
<build>

Просмотреть файл

@ -70,11 +70,12 @@ async function run() {
writeAssumeNoop(path.join(PROJECT_DIR, 'README.md'), content, dirtyFiles);
}
let playwrightVersion = require(path.join(PROJECT_DIR, 'package.json')).version;
if (playwrightVersion.endsWith('-next'))
playwrightVersion = playwrightVersion.substring(0, playwrightVersion.indexOf('-next'));
// Patch docker version in docs
{
let playwrightVersion = require(path.join(PROJECT_DIR, 'package.json')).version;
if (playwrightVersion.endsWith('-next'))
playwrightVersion = playwrightVersion.substring(0, playwrightVersion.indexOf('-next'));
const regex = new RegExp("(mcr.microsoft.com/playwright[^: ]*):?([^ ]*)");
for (const filePath of getAllMarkdownFiles(path.join(PROJECT_DIR, 'docs'))) {
let content = fs.readFileSync(filePath).toString();
@ -84,6 +85,16 @@ async function run() {
});
writeAssumeNoop(filePath, content, dirtyFiles);
}
// Patch pom.xml
{
const introPath = path.join(PROJECT_DIR, 'docs', 'src', 'intro-java.md');
const pomVersionRe = new RegExp('^(\\s*<artifactId>playwright<\\/artifactId>\\n\\s*<version>)(.*)(<\\/version>)$', 'gm');
let content = fs.readFileSync(introPath).toString();
const majorVersion = playwrightVersion.replace(new RegExp('((\\d+\\.){2})(\\d+)'), '$10')
content = content.replace(pomVersionRe, '$1' + majorVersion + '$3');
writeAssumeNoop(introPath, content, dirtyFiles);
}
}
// Update device descriptors