Skip to content

Commit 1c2d9f3

Browse files
DavertMikDavertMikclaude
authored
chore: migrate from runok to Bunosh, fix Lightpanda docs (#5754)
* chore: migrate task runner from runok to Bunosh Bunoshfile.js is now the only task file; runok.cjs and the runok dependency are removed. npm scripts docs, def and update-contributor-faces call bunosh. Fixes Lightpanda docs missing inherited CDPBrowser methods: CI ran runok.cjs, whose inheritedHelperDocs list lacked Lightpanda. Bunoshfile fixes: - restore MockRequest section in docs:external-helpers - drop extra blank line after generated front matter - sort helper/plugin file lists (Bun readdir is unordered) Removes legacy release tasks (release, publishSite, wiki, versioning, get:commit-log, publish:next-beta-version) and their npm scripts: releases go through GitHub Releases + publish workflow, and the website refreshes itself via its own `bunosh docs`. CI workflows that run def/docs now set up bun. bunosh pinned to ^0.6.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: set up bun for runner tests (definitions test runs npm run def) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: DavertMik <davert@testomat.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 99edd17 commit 1c2d9f3

8 files changed

Lines changed: 1863 additions & 930 deletions

File tree

‎.github/workflows/doc-generation.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828

29+
- uses: oven-sh/setup-bun@v2
30+
2931
- name: Install Dependencies
3032
run: npm i --force
3133

‎.github/workflows/dtslint.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
uses: actions/setup-node@v6
2525
with:
2626
node-version: ${{ matrix.node-version }}
27+
- uses: oven-sh/setup-bun@v2
2728
- run: npm i --force
2829
env:
2930
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true

‎.github/workflows/publish-beta.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
node-version: 24
2323
registry-url: 'https://registry.npmjs.org'
2424

25+
- uses: oven-sh/setup-bun@v2
2526
- run: npm install
2627
- run: npm install -g npm@latest
2728

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
uses: actions/setup-node@v6
9090
with:
9191
node-version: ${{ matrix.node-version }}
92+
- uses: oven-sh/setup-bun@v2
9293
- run: npm i
9394
env:
9495
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true

‎Bunoshfile.js‎

Lines changed: 14 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
3-
import { execSync } from 'node:child_process'
43
import axios from 'axios'
5-
import semver from 'semver'
64

75
const { shell, writeToFile, copyFile, task } = global.bunosh
86
const { say, yell } = global.bunosh
@@ -47,7 +45,7 @@ export async function docsPlugins() {
4745
task.stopOnFailures()
4846
ensureDir('docs/plugins')
4947

50-
const files = fs.readdirSync('lib/plugin').filter(f => path.extname(f) === '.js')
48+
const files = fs.readdirSync('lib/plugin').filter(f => path.extname(f) === '.js').sort()
5149

5250
const sharedPartials = fs.readdirSync('docs/shared').filter(f => path.extname(f) === '.mustache')
5351
const sharedPlaceholders = sharedPartials.map(file => `{{ ${path.basename(file, '.mustache')} }}`)
@@ -90,7 +88,6 @@ editLink: false
9088
sidebar: auto
9189
title: ${name}
9290
---
93-
9491
`
9592
line.fromFile(pluginMarkDownFile(name))
9693
})
@@ -140,6 +137,14 @@ export async function docsExternalHelpers() {
140137
cfg.replace(/string \| object/g, 'LocatorOrString')
141138
})
142139

140+
say('Building @codeceptjs/mock-request')
141+
helper = 'MockRequest'
142+
replaceInFile('node_modules/@codeceptjs/mock-request/index.js', cfg => {
143+
cfg.replace(/CodeceptJS.LocatorOrString/g, 'string | object')
144+
cfg.replace(/LocatorOrString/g, 'string | object')
145+
})
146+
await shell`npx documentation build node_modules/@codeceptjs/mock-request/index.js -o ${helperMarkDownFile(helper)} ${documentjsCliArgs}`
147+
143148
await writeToFile(helperMarkDownFile(helper), line => {
144149
line`---\npermalink: /helpers/${helper}\nsidebar: auto\ntitle: ${helper}\n---\n\n# ${helper}\n\n`
145150
line.fromFile(helperMarkDownFile(helper))
@@ -170,7 +175,7 @@ export async function docsExternalPlugins() {
170175
*/
171176
export async function buildLibWithDocs(forTypings = false) {
172177
task.stopOnFailures()
173-
const files = fs.readdirSync('lib/helper').filter(f => path.extname(f) === '.js')
178+
const files = fs.readdirSync('lib/helper').filter(f => path.extname(f) === '.js').sort()
174179
ensureDir('docs/build')
175180

176181
const partials = fs.readdirSync('docs/webapi').filter(f => path.extname(f) === '.mustache')
@@ -229,7 +234,7 @@ export async function buildLibWithDocs(forTypings = false) {
229234
*/
230235
export async function docsHelpers() {
231236
task.stopOnFailures()
232-
const files = fs.readdirSync('lib/helper').filter(f => path.extname(f) === '.js')
237+
const files = fs.readdirSync('lib/helper').filter(f => path.extname(f) === '.js').sort()
233238
ensureDir('docs/build')
234239

235240
const ignoreList = ['Polly', 'MockRequest']
@@ -321,78 +326,12 @@ editLink: false
321326
sidebar: auto
322327
title: ${name}
323328
---
324-
325329
`
326330
line.fromFile(helperMarkDownFile(name))
327331
})
328332
}
329333
}
330334

331-
/**
332-
* Sync wiki pages from the CodeceptJS.wiki repo into website docs.
333-
*/
334-
export async function wiki() {
335-
task.stopOnFailures()
336-
if (!fs.existsSync('docs/wiki/Home.md')) {
337-
await shell`git clone git@github.com:codeceptjs/CodeceptJS.wiki.git docs/wiki`
338-
}
339-
await shell`git pull origin master`.cwd('docs/wiki')
340-
341-
await writeToFile('docs/community-helpers.md', line => {
342-
line`---`
343-
line`permalink: /community-helpers`
344-
line`title: Community Helpers`
345-
line`editLink: false`
346-
line`---`
347-
line``
348-
line`# Community Helpers`
349-
line`> Share your helpers at our [Wiki Page](https://github.com/codeceptjs/CodeceptJS/wiki/Community-Helpers)`
350-
line``
351-
line.fromFile('docs/wiki/Community-Helpers-&-Plugins.md')
352-
})
353-
354-
await writeToFile('docs/examples.md', line => {
355-
line`---`
356-
line`permalink: /examples`
357-
line`layout: Section`
358-
line`sidebar: false`
359-
line`title: Examples`
360-
line`editLink: false`
361-
line`---`
362-
line``
363-
line`# Examples`
364-
line`> Add your own examples to our [Wiki Page](https://github.com/codeceptjs/CodeceptJS/wiki/Examples)`
365-
line.fromFile('docs/wiki/Examples.md')
366-
})
367-
368-
await writeToFile('docs/books.md', line => {
369-
line`---`
370-
line`permalink: /books`
371-
line`layout: Section`
372-
line`sidebar: false`
373-
line`title: Books & Posts`
374-
line`editLink: false`
375-
line`---`
376-
line``
377-
line`# Books & Posts`
378-
line`> Add your own books or posts to our [Wiki Page](https://github.com/codeceptjs/CodeceptJS/wiki/Books-&-Posts)`
379-
line.fromFile('docs/wiki/Books-&-Posts.md')
380-
})
381-
382-
await writeToFile('docs/videos.md', line => {
383-
line`---`
384-
line`permalink: /videos`
385-
line`layout: Section`
386-
line`sidebar: false`
387-
line`title: Videos`
388-
line`editLink: false`
389-
line`---`
390-
line``
391-
line`> Add your own videos to our [Wiki Page](https://github.com/codeceptjs/CodeceptJS/wiki/Videos)`
392-
line.fromFile('docs/wiki/Videos.md')
393-
})
394-
}
395-
396335
const inheritedHelperDocs = {
397336
Appium: {
398337
parent: 'WebDriver',
@@ -456,61 +395,13 @@ async function docsHelperMarkdown(name, { parent, exclude = [], excludeConfig =
456395
fs.writeFileSync(helperMarkDownFile(name), output)
457396
}
458397

459-
/**
460-
* Update the codecept.io website: regenerate changelog, sync wiki, push docs and publish.
461-
*/
462-
export async function publishSite() {
463-
await processChangelog()
464-
await wiki()
465-
466-
const dir = 'website'
467-
if (fs.existsSync(dir)) {
468-
await shell`rm -rf ${dir}`
469-
}
470-
471-
await shell`git clone git@github.com:codeceptjs/website.git ${dir}`
472-
copyFile('docs', 'website/docs')
473-
474-
await shell`git add -A`.cwd(dir)
475-
await shell`git commit -m "synchronized with docs"`.cwd(dir)
476-
await shell`git pull`.cwd(dir)
477-
await shell`git push`.cwd(dir)
478-
await shell`./runok.js publish`.cwd(dir)
479-
}
480-
481398
/**
482399
* Run the PHP test app and the REST test server together. Warning! PHP required!
483400
*/
484401
export async function server() {
485402
await Promise.all([shell`php -S 127.0.0.1:8000 -t test/data/app`, testServer()])
486403
}
487404

488-
/**
489-
* Release CodeceptJS to npm. Optionally bump package.json version first.
490-
* @param {string} [releaseType] - "patch", "minor" or "major" to bump before releasing.
491-
*/
492-
export async function release(releaseType = null) {
493-
task.stopOnFailures()
494-
const packageInfo = JSON.parse(fs.readFileSync('package.json'))
495-
if (releaseType) {
496-
packageInfo.version = semver.inc(packageInfo.version, releaseType)
497-
fs.writeFileSync('package.json', JSON.stringify(packageInfo))
498-
await shell`git add package.json`
499-
await shell`git commit -m "version bump"`
500-
}
501-
const version = packageInfo.version
502-
await docs()
503-
await def()
504-
await publishSite()
505-
await shell`git pull`
506-
await shell`git tag ${version}`
507-
await shell`git push origin 3.x --tags`
508-
await shell`rm -rf docs/wiki/.git`
509-
await shell`npm publish`
510-
say('-- RELEASED --')
511-
}
512-
513-
514405
/**
515406
* Update the contributors table in README.md from the GitHub API.
516407
*/
@@ -569,7 +460,6 @@ export async function contributorFaces() {
569460
}
570461
}
571462

572-
573463
/**
574464
* Scaffold a config, feature test and runner test for a new feature.
575465
* @param {string} featureName - Name of the feature to scaffold tests for.
@@ -633,28 +523,6 @@ describe('CodeceptJS ${featureName}', function () {
633523
say(`npx mocha test/runner --grep ${featureName}`)
634524
}
635525

636-
async function processChangelog() {
637-
const file = 'CHANGELOG.md'
638-
let changelog = fs.readFileSync(file).toString()
639-
640-
changelog = changelog.replace(/\s@([\w-]+)/gm, ' **[$1](https://github.com/$1)**')
641-
changelog = changelog.replace(/#(\d+)/gm, '[#$1](https://github.com/codeceptjs/CodeceptJS/issues/$1)')
642-
changelog = changelog.replace(/\s\[(\w+)\]\s/gm, ' **[$1]** ')
643-
644-
await writeToFile('docs/changelog.md', line => {
645-
line`---`
646-
line`permalink: /changelog`
647-
line`title: Releases`
648-
line`sidebar: false`
649-
line`layout: Section`
650-
line`---`
651-
line``
652-
line`# Releases`
653-
line``
654-
line`${changelog}`
655-
})
656-
}
657-
658526
/**
659527
* Run the read-only REST test server on port 8010.
660528
*/
@@ -694,21 +562,21 @@ export async function graphql() {
694562
* Lint the codebase with ESLint.
695563
*/
696564
export async function lint() {
697-
await shell`eslint bin/ examples/ lib/ test/ translations/ runok.cjs`
565+
await shell`eslint bin/ examples/ lib/ test/ translations/ Bunoshfile.js`
698566
}
699567

700568
/**
701569
* Lint and auto-fix the codebase with ESLint.
702570
*/
703571
export async function lintFix() {
704-
await shell`eslint bin/ examples/ lib/ test/ translations/ runok.cjs --fix`
572+
await shell`eslint bin/ examples/ lib/ test/ translations/ Bunoshfile.js --fix`
705573
}
706574

707575
/**
708576
* Format the codebase with Prettier.
709577
*/
710578
export async function prettier() {
711-
await shell`prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js runok.cjs`
579+
await shell`prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js Bunoshfile.js`
712580
}
713581

714582
/**
@@ -858,7 +726,6 @@ export async function prepare() {
858726
await shell`husky install`
859727
}
860728

861-
862729
function replaceInFile(file, fn) {
863730
let text = fs.readFileSync(file).toString()
864731
fn({

0 commit comments

Comments
 (0)