docs(java): fix pom.xml (and auto-generate) (#15192)
This commit is contained in:
Родитель
aa1e736f3f
Коммит
3805e942a1
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче