Skip to content

Commit ed6ad01

Browse files
committed
feat: also push JSON snippets for algolia docs
1 parent 1ec78ad commit ed6ad01

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

scripts/buildSpecs.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ async function transformBundle({
149149
toAbsolutePath(`website/src/generated/${clientName}-snippets.js`),
150150
`export const snippets = ${transformCodeSamplesToGuideMethods(JSON.parse(JSON.stringify(snippetSamples)))}`,
151151
);
152+
await fsp.writeFile(
153+
toAbsolutePath(`website/src/generated/${clientName}-snippets.json`),
154+
transformCodeSamplesToGuideMethods(JSON.parse(JSON.stringify(snippetSamples))),
155+
);
152156
}
153157

154158
for (const [pathKey, pathMethods] of Object.entries(bundledSpec.paths)) {

scripts/ci/codegen/pushToAlgoliaDoc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function pushToAlgoliaDoc(): Promise<void> {
2828
.map((coAuthor) => coAuthor.trim())
2929
.filter(Boolean);
3030

31-
if (!lastCommitMessage.startsWith(commitStartRelease)) {
31+
if (!process.env.DRY_RUN && !lastCommitMessage.startsWith(commitStartRelease)) {
3232
return;
3333
}
3434

@@ -48,7 +48,7 @@ async function pushToAlgoliaDoc(): Promise<void> {
4848
await emptyDirExceptForDotGit(dest);
4949
await run(`cp ${toAbsolutePath('specs/bundled/*.doc.yml')} ${dest}`);
5050
await run(`cp ${toAbsolutePath('config/release.config.json')} ${dest}`);
51-
await run(`cp ${toAbsolutePath('website/src/generated/*.js')} ${dest}`);
51+
await run(`cp ${toAbsolutePath('website/src/generated/*.json')} ${dest}`);
5252
await run(`cp ${toAbsolutePath('website/static/img/*-sla.png')} ${dest}`);
5353

5454
if ((await getNbGitDiff({ head: null, cwd: tempGitDir })) === 0) {

website/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ yarn-error.log*
2626
specs
2727

2828
src/generated/*.js
29+
src/generated/*.json

0 commit comments

Comments
 (0)