Skip to content

Commit 4bb8c6a

Browse files
committed
flatten for cf to infinite depth
1 parent c707ccb commit 4bb8c6a

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

dist/main.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26061,6 +26061,8 @@ async function transform(files, project) {
2606126061

2606226062
// docs: Array<Record<string, unknown>>, { project, type, keyby, version }
2606326063

26064+
`accounts/${CF_ID}/storage/kv/namespaces/${KV_ID}/bulk`;
26065+
2606426066
async function get_repo(
2606526067
target_repo,
2606626068
target_branch,
@@ -26149,10 +26151,28 @@ async function run() {
2614926151
transform_cloudflare(content, { project, type, keyby: "slug" })
2615026152
)
2615126153
)
26152-
.flat();
26154+
.flat(Infinity);
2615326155

2615426156
console.log(JSON.stringify(ready_for_cf, null, 2));
2615526157

26158+
// const x = await put(`${API_ROOT}${KV_WRITE}`, {
26159+
// body: keys,
26160+
// headers: {
26161+
// Authorization: `Bearer ${cf_token}`,
26162+
// },
26163+
// });
26164+
// console.log("put: ", x);
26165+
// console.log({
26166+
// type: `${release_keys.map((v) => `${v}: ${repo.repo}:api:${v}`)}`,
26167+
// repo: repo.repo,
26168+
// base,
26169+
// key: `${repo.repo}:api:${version}`,
26170+
// });
26171+
// } catch (e) {
26172+
// console.log("it didn't work", e.message);
26173+
// throw e;
26174+
// }
26175+
2615626176
// if (docs.length) {
2615726177
// docs.forEach(([project, docs]) => {
2615826178
// for (const type in docs) {

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@
5353
"uvu": "^0.5.1",
5454
"vfile": "^4.2.1",
5555
"vfile-message": "^2.0.4"
56+
},
57+
"dependencies": {
58+
"httpie": "^1.1.2"
5659
}
5760
}

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import core from "@actions/core";
22
import exec from "@actions/exec";
33
import fs from "fs";
44
import path from "path";
5+
import { put } from "httpie";
56

67
import { get_docs, DocFiles } from "./fs";
78
import { transform_cloudflare, transform_docs } from "./transform";
89

10+
const API_ROOT = "https://api.cloudflare.com/client/v4/";
11+
const KV_WRITE = `accounts/${CF_ID}/storage/kv/namespaces/${KV_ID}/bulk`;
12+
913
async function get_repo(
1014
target_repo: string,
1115
target_branch: string,
@@ -94,10 +98,28 @@ async function run() {
9498
transform_cloudflare(content, { project, type, keyby: "slug" })
9599
)
96100
)
97-
.flat();
101+
.flat(Infinity);
98102

99103
console.log(JSON.stringify(ready_for_cf, null, 2));
100104

105+
// const x = await put(`${API_ROOT}${KV_WRITE}`, {
106+
// body: keys,
107+
// headers: {
108+
// Authorization: `Bearer ${cf_token}`,
109+
// },
110+
// });
111+
// console.log("put: ", x);
112+
// console.log({
113+
// type: `${release_keys.map((v) => `${v}: ${repo.repo}:api:${v}`)}`,
114+
// repo: repo.repo,
115+
// base,
116+
// key: `${repo.repo}:api:${version}`,
117+
// });
118+
// } catch (e) {
119+
// console.log("it didn't work", e.message);
120+
// throw e;
121+
// }
122+
101123
// if (docs.length) {
102124
// docs.forEach(([project, docs]) => {
103125
// for (const type in docs) {

0 commit comments

Comments
 (0)