two-stroke 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bulk.mjs +4 -4
- package/package.json +1 -1
package/bin/bulk.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import fs from "fs";
|
|
5
5
|
import { cmd } from "../src/cmd.mjs";
|
|
6
6
|
import mime from "mime";
|
|
7
7
|
|
|
8
8
|
const entryOrRest = process.argv[2];
|
|
9
9
|
const entry = process.argv[3];
|
|
10
10
|
|
|
11
|
-
const ents = await fs.readdir("dist", { withFileTypes: true, recursive: true });
|
|
11
|
+
const ents = await fs.promises.readdir("dist", { withFileTypes: true, recursive: true });
|
|
12
12
|
const files = await Promise.all(
|
|
13
13
|
ents
|
|
14
14
|
.filter((ent) => ent.isFile())
|
|
@@ -20,7 +20,7 @@ const files = await Promise.all(
|
|
|
20
20
|
const key = `${ent.parentPath.substring(4)}/${ent.name}`;
|
|
21
21
|
return (async () => ({
|
|
22
22
|
key: ent.name === entry ? `${process.env.DOMAIN}${key}` : key,
|
|
23
|
-
value: (await fs.readFile(`${ent.parentPath}/${ent.name}`)).toString(
|
|
23
|
+
value: (await fs.promises.readFile(`${ent.parentPath}/${ent.name}`)).toString(
|
|
24
24
|
"base64",
|
|
25
25
|
),
|
|
26
26
|
base64: true,
|
|
@@ -38,7 +38,7 @@ const files = await Promise.all(
|
|
|
38
38
|
}),
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
-
fs.writeFileSync(`dist/bulk_${process.argv[2]}.json`, files);
|
|
41
|
+
fs.writeFileSync(`dist/bulk_${process.argv[2]}.json`, JSON.stringify(files));
|
|
42
42
|
|
|
43
43
|
cmd(
|
|
44
44
|
`wrangler kv bulk put dist/bulk_${process.argv[2]}.json --remote --namespace-id ${process.env.NAMESPACE}`,
|