()
| 72 | } |
| 73 | |
| 74 | async function main() { |
| 75 | try { |
| 76 | await exec('bash ./etc/check-remote.sh'); |
| 77 | } catch (error) { |
| 78 | console.error(error.stdout); |
| 79 | process.exit(1); |
| 80 | } |
| 81 | |
| 82 | const { stdout } = await exec('hugo version', { encoding: 'utf8' }); |
| 83 | if (!stdout.includes('0.150.0')) throw new Error('`hugo` version must be 0.150.0.'); |
| 84 | |
| 85 | chdir(__dirname); |
| 86 | |
| 87 | const { tag, status, skipPrompts } = getCommandLineArguments(); |
| 88 | |
| 89 | const newVersion: VersionSchema = { |
| 90 | version: `${tag} Driver`, |
| 91 | status, |
| 92 | api: `./${tag}`, |
| 93 | usesMongoDBManual: true, |
| 94 | tag |
| 95 | }; |
| 96 | |
| 97 | if (!skipPrompts) { |
| 98 | await confirm(` |
| 99 | Generating docs for the following configuration.\n${JSON.stringify(newVersion, null, 2)} |
| 100 | Does this look right? [y/n] `); |
| 101 | } |
| 102 | |
| 103 | log('Installing dependencies...'); |
| 104 | await installDependencies(); |
| 105 | |
| 106 | log('Building docs for current branch'); |
| 107 | await buildDocs(newVersion); |
| 108 | |
| 109 | log('Generating new static site...'); |
| 110 | |
| 111 | const tomlVersions = parse( |
| 112 | await readFile(RELEASES_TOML_FILE, { encoding: 'utf8' }) |
| 113 | ) as unknown as TomlVersionSchema; |
| 114 | const jsonVersions = JSON.parse( |
| 115 | await readFile(RELEASES_JSON_FILE, { encoding: 'utf8' }) |
| 116 | ) as unknown as JsonVersionSchema[]; |
| 117 | |
| 118 | const versionAlreadyExists = jsonVersions.some(({ version }) => version === tag); |
| 119 | |
| 120 | if (versionAlreadyExists && !skipPrompts) { |
| 121 | await confirm( |
| 122 | `Version ${tag} already exists. Do you want to override the existing docs? [y/n] ` |
| 123 | ); |
| 124 | } |
| 125 | |
| 126 | await updateSiteTemplateForNewVersion(newVersion, tomlVersions, jsonVersions); |
| 127 | await copyNewDocsToGeneratedSite(newVersion); |
| 128 | await copyGeneratedDocsToDocsFolder(); |
| 129 | await removeTempDirectory(); |
| 130 | |
| 131 | log('Successfully generated api documentation and updated the doc site.'); |
no test coverage detected