two-stroke 1.0.14 → 1.0.16

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 CHANGED
@@ -10,16 +10,4 @@ const release = process.argv[3];
10
10
  fs.writeFileSync("src/release.ts", `export default "${release}";`);
11
11
 
12
12
  cmd(`wrangler secret:bulk /dev/stdin --env ${env}`);
13
- cmd(
14
- `sentry-cli releases --org change-engine --project ${basename(process.cwd())} new ${release} --finalize`,
15
- );
16
-
17
- cmd(
18
- `sentry-cli releases --org change-engine --project ${basename(process.cwd())} set-commits ${release}`,
19
- );
20
-
21
13
  cmd(`wrangler deploy --env ${env} --outdir dist`);
22
-
23
- cmd(
24
- `sentry-cli sourcemaps --org change-engine --project ${basename(process.cwd())} upload --release="${release}" dist`,
25
- );
package/package.json CHANGED
@@ -51,7 +51,7 @@
51
51
  "name": "two-stroke",
52
52
  "packageManager": "yarn@4.1.0",
53
53
  "type": "module",
54
- "version": "1.0.14",
54
+ "version": "1.0.16",
55
55
  "devDependencies": {
56
56
  "@types/eslint": "^8.56.9",
57
57
  "@types/node": "^20.12.7",
package/src/test.ts CHANGED
@@ -25,32 +25,32 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
25
25
  ...bindings,
26
26
  },
27
27
  queueConsumers: (config.queues?.consumers ?? []).map(
28
- ({ queue }: { queue: string }) => queue
28
+ ({ queue }: { queue: string }) => queue,
29
29
  ),
30
30
  queueProducers: Object.fromEntries(
31
31
  (config.queues?.producers ?? []).map(
32
32
  ({ binding, queue }: { queue: string; binding: string }) => [
33
33
  binding,
34
34
  queue,
35
- ]
36
- )
35
+ ],
36
+ ),
37
37
  ),
38
38
  r2Buckets: (config.r2_buckets ?? []).map(
39
- ({ binding }: { binding: string }) => binding
39
+ ({ binding }: { binding: string }) => binding,
40
40
  ),
41
41
  kvNamespaces: (config.kv_namespaces ?? []).map(
42
- ({ binding }: { binding: string }) => binding
42
+ ({ binding }: { binding: string }) => binding,
43
43
  ),
44
44
  d1Databases: (config.d1_databases ?? []).map(
45
- ({ binding }: { binding: string }) => binding
45
+ ({ binding }: { binding: string }) => binding,
46
46
  ),
47
47
  serviceBindings: Object.fromEntries(
48
48
  (config.services ?? []).map(
49
49
  ({ binding, service }: { binding: string; service: string }) => [
50
50
  binding,
51
51
  service,
52
- ]
53
- )
52
+ ],
53
+ ),
54
54
  ),
55
55
  fetchMock,
56
56
  });
@@ -65,29 +65,37 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
65
65
  const d1 = await miniflare.getD1Database(binding);
66
66
 
67
67
  const migrationsDir = "./migrations";
68
- for (const migrationName of (await nodefs.readdir(migrationsDir)).sort(
69
- (a, b) => {
70
- const migrationNumberA = parseInt(a.split("_")[0]!);
71
- const migrationNumberB = parseInt(b.split("_")[0]!);
72
- if (migrationNumberA < migrationNumberB) {
73
- return -1;
74
- }
75
- if (migrationNumberA > migrationNumberB) {
76
- return 1;
77
- }
68
+ let fileNames: string[] = [];
69
+ try {
70
+ fileNames = await nodefs.readdir(migrationsDir);
71
+ } catch (error) {
72
+ console.log("Error loading migrations", error);
73
+ }
74
+
75
+ if (fileNames.length === 0)
76
+ console.log("No migrations found in ./migrations");
78
77
 
79
- // numbers must be equal
80
- return 0;
78
+ for (const migrationName of fileNames.sort((a, b) => {
79
+ const migrationNumberA = parseInt(a.split("_")[0]!);
80
+ const migrationNumberB = parseInt(b.split("_")[0]!);
81
+ if (migrationNumberA < migrationNumberB) {
82
+ return -1;
83
+ }
84
+ if (migrationNumberA > migrationNumberB) {
85
+ return 1;
81
86
  }
82
- )) {
87
+
88
+ // numbers must be equal
89
+ return 0;
90
+ })) {
83
91
  const migrationPath = path.join(migrationsDir, migrationName);
84
92
  let migration = await nodefs.readFile(migrationPath, "utf8");
85
93
  // Remove migration comment
86
94
  migration = migration.split("\n").slice(1).join(" ");
87
95
  await d1.exec(migration);
88
96
  }
89
- }
90
- )
97
+ },
98
+ ),
91
99
  );
92
100
 
93
101
  const client = createClient<Paths>({ baseUrl: url.toString() });
@@ -126,7 +134,7 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
126
134
  headers: {
127
135
  "Content-Type": "application/json",
128
136
  },
129
- }
137
+ },
130
138
  )
131
139
  .persist();
132
140
  fetchMock
@@ -141,7 +149,7 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
141
149
  headers: {
142
150
  "Content-Type": "application/json",
143
151
  },
144
- }
152
+ },
145
153
  )
146
154
  .persist();
147
155
  return await new SignJWT(claims)
@@ -173,7 +181,7 @@ export function recordRequest(
173
181
  data: string | object | Buffer | undefined,
174
182
  responseOptions?: {
175
183
  headers: Record<string, string | string[] | undefined>;
176
- }
184
+ },
177
185
  ) {
178
186
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
179
187
  return ({ body }: any) => {
@@ -189,7 +197,7 @@ export function recordFormRequest(
189
197
  data: string | object | Buffer | undefined,
190
198
  responseOptions?: {
191
199
  headers: Record<string, string | string[] | undefined>;
192
- }
200
+ },
193
201
  ) {
194
202
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
195
203
  return ({ body }: any) => {
@@ -197,7 +205,7 @@ export function recordFormRequest(
197
205
  .text(body)
198
206
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
207
  .then((data: any) =>
200
- cb(Object.fromEntries(new URLSearchParams(data).entries()))
208
+ cb(Object.fromEntries(new URLSearchParams(data).entries())),
201
209
  );
202
210
  return { statusCode, data, responseOptions };
203
211
  };
@@ -210,7 +218,7 @@ export function recordFirehoseRequest(
210
218
  data: string | object | Buffer | undefined,
211
219
  responseOptions?: {
212
220
  headers: Record<string, string | string[] | undefined>;
213
- }
221
+ },
214
222
  ) {
215
223
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
224
  return ({ body }: any) => {