two-stroke 1.0.34 → 1.1.0
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/deploy.mjs +2 -2
- package/bin/format.mjs +2 -1
- package/bin/lint.mjs +2 -2
- package/bin/test.mjs +18 -1
- package/eslint.config.js +3 -0
- package/package.json +17 -17
- package/src/index.ts +2 -3
- package/src/test.ts +1 -2
- package/tsconfig.json +1 -0
package/bin/deploy.mjs
CHANGED
|
@@ -9,14 +9,14 @@ const release = process.argv[3];
|
|
|
9
9
|
|
|
10
10
|
fs.writeFileSync("src/release.ts", `export default "${release}";`);
|
|
11
11
|
|
|
12
|
-
cmd(`wrangler secret
|
|
12
|
+
cmd(`wrangler secret bulk /dev/stdin --env ${env}`);
|
|
13
13
|
|
|
14
14
|
cmd(
|
|
15
15
|
`sentry-cli releases --org change-engine --project ${basename(process.cwd())} new ${release} --finalize`,
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
cmd(
|
|
19
|
-
`sentry-cli releases --org change-engine --project ${basename(process.cwd())} set-commits ${release}`,
|
|
19
|
+
`sentry-cli releases --org change-engine --project ${basename(process.cwd())} set-commits ${release} --ignore-missing`,
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
cmd(`wrangler deploy --env ${env} --outdir dist`);
|
package/bin/format.mjs
CHANGED
package/bin/lint.mjs
CHANGED
package/bin/test.mjs
CHANGED
|
@@ -4,6 +4,8 @@ import fs from "fs";
|
|
|
4
4
|
import { cmd } from "../src/cmd.mjs";
|
|
5
5
|
import consumers from "stream/consumers";
|
|
6
6
|
import openapiTS from "openapi-typescript";
|
|
7
|
+
import prettier from "prettier";
|
|
8
|
+
import ts from "typescript";
|
|
7
9
|
import { Miniflare } from "miniflare";
|
|
8
10
|
|
|
9
11
|
if (fs.existsSync("wrangler.toml")) {
|
|
@@ -13,13 +15,28 @@ if (fs.existsSync("wrangler.toml")) {
|
|
|
13
15
|
scriptPath: "dist/index.js",
|
|
14
16
|
});
|
|
15
17
|
const request = await fetch(
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
16
19
|
`${await miniflare.ready}doc`,
|
|
17
20
|
{ SENTRY_DSN: null, SENTRY_ENVIRONMENT: null },
|
|
18
21
|
null,
|
|
19
22
|
);
|
|
20
23
|
const types = await openapiTS(await consumers.json(request.body));
|
|
21
24
|
await miniflare.dispose();
|
|
22
|
-
|
|
25
|
+
const printer = ts.createPrinter({});
|
|
26
|
+
const resultFile = ts.createSourceFile(
|
|
27
|
+
"test/api.d.ts",
|
|
28
|
+
"",
|
|
29
|
+
ts.ScriptTarget.Latest,
|
|
30
|
+
);
|
|
31
|
+
const result = printer.printNode(
|
|
32
|
+
ts.EmitHint.Unspecified,
|
|
33
|
+
types[0],
|
|
34
|
+
resultFile,
|
|
35
|
+
);
|
|
36
|
+
fs.writeFileSync(
|
|
37
|
+
"test/api.d.ts",
|
|
38
|
+
await prettier.format(result, { parser: "typescript" }),
|
|
39
|
+
);
|
|
23
40
|
}
|
|
24
41
|
cmd("vitest --globals --no-file-parallelism --pool threads", [
|
|
25
42
|
...(!process.argv.slice(2).includes("-w") &&
|
package/eslint.config.js
ADDED
package/package.json
CHANGED
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
"type-check": "./bin/type-check.mjs"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@anatine/zod-openapi": "^2.2.
|
|
11
|
+
"@anatine/zod-openapi": "^2.2.6",
|
|
12
12
|
"@asteasolutions/zod-to-openapi": "^7.1.1",
|
|
13
|
-
"@cloudflare/workers-types": "^4.
|
|
14
|
-
"@sentry/cli": "^2.
|
|
15
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
16
|
-
"@typescript-eslint/parser": "^
|
|
17
|
-
"@vitest/coverage-v8": "^2.0.
|
|
13
|
+
"@cloudflare/workers-types": "^4.20240806.0",
|
|
14
|
+
"@sentry/cli": "^2.33.1",
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^8.0.1",
|
|
16
|
+
"@typescript-eslint/parser": "^8.0.1",
|
|
17
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
18
18
|
"eslint-config-prettier": "^9.1.0",
|
|
19
|
-
"eslint-config-two-stroke": "^1.
|
|
19
|
+
"eslint-config-two-stroke": "^1.1.1",
|
|
20
20
|
"eslint-config-typescript": "^3.0.0",
|
|
21
21
|
"jose": "^5.6.3",
|
|
22
22
|
"jwk-subtle": "^1.0.7",
|
|
23
23
|
"miniflare": "3.20240419.0",
|
|
24
|
-
"openapi-fetch": "^0.10.
|
|
25
|
-
"openapi-typescript": "^
|
|
24
|
+
"openapi-fetch": "^0.10.6",
|
|
25
|
+
"openapi-typescript": "^7.3.0",
|
|
26
26
|
"openapi3-ts": "^4.3.3",
|
|
27
27
|
"pbkdf-subtle": "^1.0.0",
|
|
28
28
|
"toml": "^3.0.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@sentry/cli": ">=2",
|
|
34
|
-
"eslint": ">=
|
|
34
|
+
"eslint": ">=9",
|
|
35
35
|
"prettier": ">=3",
|
|
36
36
|
"typescript": ">=5",
|
|
37
37
|
"vitest": ">=1",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"name": "two-stroke",
|
|
52
52
|
"packageManager": "yarn@4.3.0",
|
|
53
53
|
"type": "module",
|
|
54
|
-
"version": "1.0
|
|
54
|
+
"version": "1.1.0",
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/eslint": "^
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"eslint": "^8.
|
|
59
|
-
"prettier": "^3.3.
|
|
60
|
-
"typescript": "^5.5.
|
|
61
|
-
"vitest": "^2.0.
|
|
56
|
+
"@types/eslint": "^9.6.0",
|
|
57
|
+
"@types/node": "^22.1.0",
|
|
58
|
+
"eslint": "^9.8.0",
|
|
59
|
+
"prettier": "^3.3.3",
|
|
60
|
+
"typescript": "^5.5.4",
|
|
61
|
+
"vitest": "^2.0.5"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -180,7 +180,6 @@ export function twoStroke<T extends Env>(title: string, release: string) {
|
|
|
180
180
|
});
|
|
181
181
|
} catch (err) {
|
|
182
182
|
console.warn(err);
|
|
183
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
184
183
|
sentry.captureException(err);
|
|
185
184
|
return new Response("", {
|
|
186
185
|
status: 500,
|
|
@@ -327,7 +326,7 @@ export function twoStroke<T extends Env>(title: string, release: string) {
|
|
|
327
326
|
handler,
|
|
328
327
|
});
|
|
329
328
|
},
|
|
330
|
-
|
|
329
|
+
|
|
331
330
|
post<
|
|
332
331
|
I extends ZodSchema,
|
|
333
332
|
O extends ZodSchema,
|
|
@@ -356,7 +355,7 @@ export function twoStroke<T extends Env>(title: string, release: string) {
|
|
|
356
355
|
params,
|
|
357
356
|
});
|
|
358
357
|
},
|
|
359
|
-
|
|
358
|
+
|
|
360
359
|
get<
|
|
361
360
|
O extends ZodSchema,
|
|
362
361
|
A,
|
package/src/test.ts
CHANGED
|
@@ -9,7 +9,7 @@ import toml from "toml";
|
|
|
9
9
|
import { URLSearchParams } from "url";
|
|
10
10
|
import { Env } from "./types";
|
|
11
11
|
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
13
13
|
export const setupTests = async <Paths extends {}>(bindings: Env) => {
|
|
14
14
|
const fetchMock = createFetchMock();
|
|
15
15
|
fetchMock.disableNetConnect();
|
|
@@ -54,7 +54,6 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
|
|
|
54
54
|
// Hack until miniflare supports auto running D1 migrations.
|
|
55
55
|
// Note: Each migration file can contain only a single statement.
|
|
56
56
|
await Promise.all(
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
58
57
|
(config.d1_databases ?? []).map(
|
|
59
58
|
async ({ binding }: { binding: string }) => {
|
|
60
59
|
const d1 = await miniflare.getD1Database(binding);
|