* generate types from bidi protocol * better script docs * document interface * include generated source files * improve docs creation * start replacing webdriver with bidi commands * ignore bidi.json * cddl updates * make sure to generate bidi docs * update tests * add blog post * fix download script * set env to pull cddl file * skip generating bidi if env variable is not available * import only if generated * build fixes * check in bidi in @wdio/protocols * GITHUB_AUTH not GITHUB_TOKEN * minor fixes * make generate scripts pass eslint * release blog post today * document unstable interfaces
18 lines
506 B
TypeScript
18 lines
506 B
TypeScript
import fs from 'node:fs/promises'
|
|
|
|
import { GENERATED_FILE_COMMENT } from './constants.js'
|
|
|
|
/**
|
|
* write generated ts file so it
|
|
* - passes our eslint rules (no crlf)
|
|
* - and has a note at the top that the file is generated
|
|
*
|
|
* @param filePath path to file to write
|
|
* @param content content of file
|
|
*/
|
|
export async function writeFile (filePath: string, content: string) {
|
|
return fs.writeFile(
|
|
filePath,
|
|
GENERATED_FILE_COMMENT + '\n\n' + content.replace(/\r\n/g, '\n')
|
|
)
|
|
}
|