Skip to content

Commit f1e89ca

Browse files
committed
remove @sveltejs from names
1 parent 5956e89 commit f1e89ca

File tree

7 files changed

+60
-81
lines changed

7 files changed

+60
-81
lines changed

dist/main.js

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ function transform_files(
16711671
if (!readme || !pkg) return;
16721672

16731673
pkgs.push([
1674-
JSON.parse(pkg.content ).name,
1674+
JSON.parse(pkg.content ).name.replace("@sveltejs/", ""),
16751675
{
16761676
docs: [strip_meta("README.md", readme.content)],
16771677
},
@@ -26111,8 +26111,6 @@ async function run() {
2611126111
core$4.setFailed("Branch deploys are not yet supported.");
2611226112
}
2611326113

26114-
// get repo
26115-
2611626114
try {
2611726115
await get_repo(target_repo, target_branch, docs_path, pkg_path);
2611826116
} catch (e) {
@@ -26122,7 +26120,6 @@ async function run() {
2612226120
);
2612326121
}
2612426122

26125-
// read docs in
2612626123
let docs;
2612726124

2612826125
try {
@@ -26140,8 +26137,6 @@ async function run() {
2614026137
)
2614126138
);
2614226139

26143-
console.log(JSON.stringify(transformed_docs, null, 2));
26144-
2614526140
const ready_for_cf = transformed_docs
2614626141
.map((d) =>
2614726142
d.map(({ content, project, type }) =>
@@ -26153,48 +26148,18 @@ async function run() {
2615326148

2615426149
console.log(JSON.stringify(ready_for_cf, null, 2));
2615526150

26151+
// try {
2615626152
// const x = await put(`${API_ROOT}${KV_WRITE}`, {
26157-
// body: keys,
26153+
// body: ready_for_cf,
2615826154
// headers: {
26159-
// Authorization: `Bearer ${cf_token}`,
26155+
// Authorization: `Bearer ${CF_TOKEN}`,
2616026156
// },
2616126157
// });
2616226158
// console.log("put: ", x);
26163-
// console.log({
26164-
// type: `${release_keys.map((v) => `${v}: ${repo.repo}:api:${v}`)}`,
26165-
// repo: repo.repo,
26166-
// base,
26167-
// key: `${repo.repo}:api:${version}`,
26168-
// });
2616926159
// } catch (e) {
2617026160
// console.log("it didn't work", e.message);
2617126161
// throw e;
2617226162
// }
26173-
26174-
// if (docs.length) {
26175-
// docs.forEach(([project, docs]) => {
26176-
// for (const type in docs) {
26177-
// const _docs = format_docs[type](docs[type]);
26178-
// }
26179-
// });
26180-
// const formatted_base_docs = base_docs.docs.map(([name, content]) =>
26181-
// format_api(name, content, "docs", name)
26182-
// );
26183-
// console.log(JSON.stringify(formatted_base_docs, null, 2));
26184-
26185-
// transform to cf format (batch keys)
26186-
26187-
// const docs = transform_cloudflare(formatted_base_docs, {
26188-
// project: target_repo,
26189-
// type: "docs",
26190-
// keyby: "slug",
26191-
// });
26192-
26193-
// console.log("\n");
26194-
// console.log(docs);
26195-
// }
26196-
26197-
// write to cloudflare
2619826163
}
2619926164

2620026165
run();

src/fs/fixtures/recursive_output.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,6 +1638,22 @@ export default {
16381638
},
16391639
],
16401640
},
1641+
{
1642+
name: "with-scope",
1643+
is_dir: true,
1644+
content: [
1645+
{
1646+
name: "README.md",
1647+
is_dir: false,
1648+
content: "@sveltejs/with-scope\n",
1649+
},
1650+
{
1651+
name: "package.json",
1652+
is_dir: false,
1653+
content: '{\n\t"name": "@sveltejs/standard-package"\n}\n',
1654+
},
1655+
],
1656+
},
16411657
],
16421658
},
16431659
],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@sveltejs/with-scope
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "@sveltejs/standard-package"
3+
}

src/fs/get_content.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,22 @@ transform("transforms package readmes", () => {
488488
},
489489
],
490490
},
491+
{
492+
name: "with-scope",
493+
is_dir: true,
494+
content: [
495+
{
496+
name: "README.md",
497+
is_dir: false,
498+
content: "@sveltejs/standard-package\n",
499+
},
500+
{
501+
name: "package.json",
502+
is_dir: false,
503+
content: '{\n\t"name": "@sveltejs/standard-package"\n}\n',
504+
},
505+
],
506+
},
491507
],
492508
},
493509
],
@@ -516,6 +532,17 @@ transform("transforms package readmes", () => {
516532
],
517533
},
518534
],
535+
[
536+
"standard-package",
537+
{
538+
docs: [
539+
{
540+
name: "README.md",
541+
content: "@sveltejs/standard-package\n",
542+
},
543+
],
544+
},
545+
],
519546
]);
520547
});
521548

src/fs/get_content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function transform_files(
123123
if (!readme || !pkg) return;
124124

125125
pkgs.push([
126-
JSON.parse(pkg.content as string).name,
126+
JSON.parse(pkg.content as string).name.replace("@sveltejs/", ""),
127127
{
128128
docs: [strip_meta("README.md", readme.content)],
129129
},

src/main.ts

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { put } from "httpie";
77
import { get_docs, DocFiles } from "./fs";
88
import { transform_cloudflare, transform_docs } from "./transform";
99

10+
const CF_ACC_ID = "32a8245cd45a24083dd0acae1d482048";
11+
const CF_NS_ID = "20394261e26444aaa7ad8292db818037";
12+
1013
const API_ROOT = "https://api.cloudflare.com/client/v4/";
11-
const KV_WRITE = (acc_id: string, ns_id: string) =>
12-
`accounts/${acc_id}/storage/kv/namespaces/${ns_id}/bulk`;
14+
const KV_WRITE = `accounts/${CF_ACC_ID}/storage/kv/namespaces/${CF_NS_ID}/bulk`;
1315

1416
async function get_repo(
1517
target_repo: string,
@@ -53,16 +55,14 @@ async function get_repo(
5355
async function run() {
5456
const target_repo = core.getInput("repo");
5557
const target_branch = core.getInput("branch");
56-
const cf_token = core.getInput("token");
58+
const CF_TOKEN = core.getInput("token");
5759
const docs_path = core.getInput("docs_path");
5860
const pkg_path = core.getInput("pkg_path");
5961

6062
if (target_branch !== "main" && target_branch !== "master") {
6163
core.setFailed("Branch deploys are not yet supported.");
6264
}
6365

64-
// get repo
65-
6666
try {
6767
await get_repo(target_repo, target_branch, docs_path, pkg_path);
6868
} catch (e) {
@@ -72,7 +72,6 @@ async function run() {
7272
);
7373
}
7474

75-
// read docs in
7675
let docs: [string, DocFiles][] | false;
7776

7877
try {
@@ -90,8 +89,6 @@ async function run() {
9089
)
9190
);
9291

93-
console.log(JSON.stringify(transformed_docs, null, 2));
94-
9592
const ready_for_cf = transformed_docs
9693
.map((d) =>
9794
d.map(({ content, project, type }) =>
@@ -103,48 +100,18 @@ async function run() {
103100

104101
console.log(JSON.stringify(ready_for_cf, null, 2));
105102

103+
// try {
106104
// const x = await put(`${API_ROOT}${KV_WRITE}`, {
107-
// body: keys,
105+
// body: ready_for_cf,
108106
// headers: {
109-
// Authorization: `Bearer ${cf_token}`,
107+
// Authorization: `Bearer ${CF_TOKEN}`,
110108
// },
111109
// });
112110
// console.log("put: ", x);
113-
// console.log({
114-
// type: `${release_keys.map((v) => `${v}: ${repo.repo}:api:${v}`)}`,
115-
// repo: repo.repo,
116-
// base,
117-
// key: `${repo.repo}:api:${version}`,
118-
// });
119111
// } catch (e) {
120112
// console.log("it didn't work", e.message);
121113
// throw e;
122114
// }
123-
124-
// if (docs.length) {
125-
// docs.forEach(([project, docs]) => {
126-
// for (const type in docs) {
127-
// const _docs = format_docs[type](docs[type]);
128-
// }
129-
// });
130-
// const formatted_base_docs = base_docs.docs.map(([name, content]) =>
131-
// format_api(name, content, "docs", name)
132-
// );
133-
// console.log(JSON.stringify(formatted_base_docs, null, 2));
134-
135-
// transform to cf format (batch keys)
136-
137-
// const docs = transform_cloudflare(formatted_base_docs, {
138-
// project: target_repo,
139-
// type: "docs",
140-
// keyby: "slug",
141-
// });
142-
143-
// console.log("\n");
144-
// console.log(docs);
145-
// }
146-
147-
// write to cloudflare
148115
}
149116

150117
run();

0 commit comments

Comments
 (0)