Skip to content

Commit f2cf9db

Browse files
committed
chore(ci): update TeamCity build configuration
- remove unused vcs root configuration - eliminate redundant npm package installation script - enhance script to handle new directory and streamline file processing
1 parent 44e457a commit f2cf9db

File tree

2 files changed

+13
-28
lines changed

2 files changed

+13
-28
lines changed

.teamcity/builds/kotlinlang/buidTypes/BuildReferenceDocs.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ object BuildReferenceDocs : BuildType({
3030
param("WH_PROJECT_NAME", "kotlin-reference")
3131
}
3232

33-
vcs { root(vcsRoots.KotlinLangOrg, """
34-
docs/kr.tree
35-
""".trimIndent()) }
36-
3733
steps {
3834
script {
3935
name = "Fix paths"
@@ -46,16 +42,6 @@ object BuildReferenceDocs : BuildType({
4642
dockerImage = "alpine"
4743
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
4844
}
49-
script {
50-
name = "Install npm packages"
51-
scriptContent = """
52-
#!/usr/bin/env bash
53-
npm i cheerio
54-
""".trimIndent()
55-
dockerImage = "node:22-slim"
56-
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
57-
dockerPull = true
58-
}
5945
script {
6046
name = "Fix WRS-6159"
6147
scriptContent = """

.teamcity/scripts/fix-wrs/index.mjs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
import { load } from 'cheerio';
2-
import { readFile, writeFile } from 'node:fs/promises';
1+
import { readdir, readFile, writeFile } from 'node:fs/promises';
32
import { join, resolve } from 'node:path';
43

5-
64
const ROOT_DIR = resolve('.');
7-
const DATA_DIR = join(ROOT_DIR, '/docs/kr.tree');
5+
const DATA_DIR = join(ROOT_DIR, 'pages');
86

9-
const text = (await readFile(DATA_DIR));
10-
const $ = await load(text, { xml: true });
7+
const toc = Object.keys(JSON.parse(await readFile(DATA_DIR + '/HelpTOC.json', 'utf8')).entities.pages);
8+
const filelist = await readdir(DATA_DIR);
119

12-
const ids = (await $('toc-element[hidden="true"]'))
13-
.map((i, e) => $(e).attr('id')).get();
10+
console.log('total', filelist.length);
1411

15-
console.log('total', ids.length);
12+
const dels = filelist
13+
.map(async fileName => {
14+
if (!fileName.endsWith('.html')) return;
15+
const key = fileName.replace(/\.html$/, '');
16+
if (toc.includes(key)) return;
1617

17-
const dels = ids
18-
.map(async id => {
19-
console.log('process', id);
20-
const fileName = id.replace(/.md$/g, '').replace(/\./g, '-') + '.html';
21-
const file = `${ROOT_DIR}/pages/${fileName}`;
18+
const file = DATA_DIR + '/' + fileName;
2219
const text = await readFile(file);
20+
if (!text.includes('<meta name="built-on"')) return;
21+
2322
const patched = text.toString().replace(/(<head>)/g, '$1<meta name="robots" content="noindex">');
2423
console.log('exclude', file);
2524
await writeFile(file, patched);

0 commit comments

Comments
 (0)