Skip to content

Commit e5e6433

Browse files
committed
Attempt to fix build config
1 parent 7d888b4 commit e5e6433

File tree

12 files changed

+52
-48
lines changed

12 files changed

+52
-48
lines changed

.github/workflows/main.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Install Node.js
1414
uses: actions/setup-node@v4
1515
with:
16-
node-version: 18
16+
node-version: 20
1717

1818
- uses: pnpm/action-setup@v2
1919
name: Install pnpm

.vscode/settings.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,11 @@
1111
"cSpell.words": ["rjsf"],
1212
"[typescriptreact]": {
1313
"editor.defaultFormatter": "biomejs.biome"
14-
}
14+
},
15+
"[typescript]": {
16+
"editor.defaultFormatter": "biomejs.biome"
17+
},
18+
"[jsonc]": {
19+
"editor.defaultFormatter": "biomejs.biome"
20+
}
1521
}

biome.jsonc

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
"linter": {
1212
"enabled": true,
1313
"rules": {
14-
"recommended": true
14+
"recommended": true,
15+
"style": {
16+
"noUselessElse": "off"
17+
},
18+
"suspicious": {
19+
"noExplicitAny": "off",
20+
"noImplicitAnyLet": "off"
21+
}
1522
}
1623
}
1724
}

scripts/generate-wrangler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import TOML from '@ltd/j-toml';
2-
import fs from 'fs';
3-
import child_process from 'child_process';
2+
import fs from 'node:fs';
3+
import child_process from 'node:child_process';
44

55
/** @type {import('../secrets.json') | undefined} */
66
let secrets = undefined;

src/adapter-cloudflare-pages/adapter-cloudflare-pages.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export const adapterCloudflarePages: RakkasAdapter = {
2323
// await fs.promises.writeFile(entry, CLOUDFLARE_WORKERS_ENTRY);
2424
// }
2525

26+
console.log('Start bundling cloudflare pages');
27+
2628
await cloudflareWorkers(
2729
{
2830
output: path.resolve(root, 'dist/client/_worker.js'),
@@ -32,8 +34,12 @@ export const adapterCloudflarePages: RakkasAdapter = {
3234
// options.minify = false;
3335
options.define = options.define || {};
3436
options.define['process.env.RAKKAS_PRERENDER'] = 'undefined';
35-
options.define['global'] = 'globalThis';
37+
options.define.global = 'globalThis';
38+
options.external = options.external || [];
39+
options.external.push('node:async_hooks');
3640
},
3741
);
42+
43+
console.log('Done bundling cloudflare pages');
3844
},
3945
};

src/db/migrator/system-tables.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Static, Type } from '@sinclair/typebox';
1+
import { type Static, Type } from '@sinclair/typebox';
22
import type { JSONSchema6 } from 'json-schema';
33

44
export const systemTables = {

src/db/sql-string.ts

+8-22
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const format = function format(sql, values, stringifyObjects, timeZone) {
7979
return sql;
8080
}
8181

82-
if (!(values instanceof Array || Array.isArray(values))) {
82+
if (!Array.isArray(values)) {
8383
values = [values];
8484
}
8585

@@ -158,26 +158,13 @@ export const dateToString = function dateToString(date, timeZone) {
158158
}
159159

160160
// YYYY-MM-DD HH:mm:ss.mmm
161-
const str =
162-
zeroPad(year, 4) +
163-
'-' +
164-
zeroPad(month, 2) +
165-
'-' +
166-
zeroPad(day, 2) +
167-
' ' +
168-
zeroPad(hour, 2) +
169-
':' +
170-
zeroPad(minute, 2) +
171-
':' +
172-
zeroPad(second, 2) +
173-
'.' +
174-
zeroPad(millisecond, 3);
161+
const str = `${zeroPad(year, 4)}-${zeroPad(month, 2)}-${zeroPad(day, 2)} ${zeroPad(hour, 2)}:${zeroPad(minute, 2)}:${zeroPad(second, 2)}.${zeroPad(millisecond, 3)}`;
175162

176163
return escapeString(str);
177164
};
178165

179166
export const bufferToString = function bufferToString(buffer) {
180-
return 'X' + escapeString(buffer.toString('hex'));
167+
return `X${escapeString(buffer.toString('hex'))}`;
181168
};
182169

183170
export const objectToValues = function objectToValues(object, timeZone) {
@@ -190,11 +177,9 @@ export const objectToValues = function objectToValues(object, timeZone) {
190177
continue;
191178
}
192179

193-
sql +=
194-
(sql.length === 0 ? '' : ', ') +
195-
escapeId(key) +
196-
' = ' +
197-
escape(val, true, timeZone);
180+
sql += `${
181+
(sql.length === 0 ? '' : ', ') + escapeId(key)
182+
} = ${escape(val, true, timeZone)}`;
198183
}
199184

200185
return sql;
@@ -253,7 +238,8 @@ function convertTimezone(tz) {
253238
if (m) {
254239
return (
255240
(m[1] === '-' ? -1 : 1) *
256-
(parseInt(m[2], 10) + (m[3] ? parseInt(m[3], 10) : 0) / 60) *
241+
(Number.parseInt(m[2], 10) +
242+
(m[3] ? Number.parseInt(m[3], 10) : 0) / 60) *
257243
60
258244
);
259245
}

src/entry-hattip.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { createRequestHandler } from 'rakkasjs';
1+
import { createRequestHandler } from 'rakkasjs/server';
22

33
export default createRequestHandler();

src/entry-node.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createMiddleware } from 'rakkasjs/node-adapter';
22
import hattipHandler from './entry-hattip';
33
import { D1Database, D1DatabaseAPI } from '@miniflare/d1';
44
import { createSQLiteDB } from '@miniflare/shared';
5-
import fs from 'fs';
5+
import fs from 'node:fs';
66

77
fs.mkdirSync('./data', { recursive: true });
88

@@ -13,7 +13,7 @@ const dbPromise = Promise.resolve()
1313
.then(async (db) => {
1414
// simulate the extra system tables of the real cloudflare d1 database
1515
await db.exec(
16-
`CREATE TABLE IF NOT EXISTS d1_kv (key TEXT PRIMARY KEY, value TEXT)`,
16+
'CREATE TABLE IF NOT EXISTS d1_kv (key TEXT PRIMARY KEY, value TEXT)',
1717
);
1818

1919
return db;

src/json-schema-form.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import type { FormProps } from '@rjsf/core';
22
import {
3-
FieldTemplateProps,
4-
FormContextType,
3+
type FieldTemplateProps,
4+
type FormContextType,
55
getInputProps,
66
getSubmitButtonOptions,
77
getTemplate,
88
getUiOptions,
9-
RegistryWidgetsType,
10-
RJSFSchema,
11-
StrictRJSFSchema,
12-
SubmitButtonProps,
13-
WidgetProps,
9+
type RegistryWidgetsType,
10+
type RJSFSchema,
11+
type StrictRJSFSchema,
12+
type SubmitButtonProps,
13+
type WidgetProps,
1414
} from '@rjsf/utils';
1515
import validator from '@rjsf/validator-ajv8';
1616
import dirtyJSON from 'dirty-json';
1717
import type { JSONSchema6 } from 'json-schema';
18-
import { useRef, useCallback, forwardRef, useState, FocusEvent } from 'react';
18+
import { useRef, useCallback, forwardRef, useState, type FocusEvent } from 'react';
1919
import { ErrorBoundary } from 'react-error-boundary';
2020
import { Details } from './components/details';
21-
import { ThemeProps, withTheme } from '@rjsf/core';
21+
import { type ThemeProps, withTheme } from '@rjsf/core';
2222
import clsx from 'clsx';
2323
import MonacoEditor from '@monaco-editor/react';
2424
import jsonSchemaDraft7 from './json-schema-draft-7.json'; // https://github.com/json-schema-org/json-schema-spec/issues/1007
@@ -53,8 +53,8 @@ const tryCompactJson = (maybeJson?: string): string => {
5353
}
5454
};
5555

56-
const JsonTextEdit = function (props: WidgetProps) {
57-
let defaultValue = tryFormatJson(props.value);
56+
const JsonTextEdit = (props: WidgetProps) => {
57+
const defaultValue = tryFormatJson(props.value);
5858

5959
// const lines = Math.max(value.split("\n").length, 5);
6060

src/routes/[entity]/[id].page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import clsx from 'clsx';
2-
import { Link, Page, PageProps, useServerSideQuery } from 'rakkasjs';
2+
import { Link, type Page, type PageProps, useServerSideQuery } from 'rakkasjs';
33
import { ViewEntity } from 'src/components/view-entity';
44
import { loadEntityData } from 'src/db/load-entity-data';
55
import { useDeleteMutation } from 'src/db/use-delete-mutation';

src/utils/format-sqlite.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ export const formatSql = (
1414
} catch (err) {
1515
if (options?.throwOnError) {
1616
throw err;
17-
} else {
18-
console.log('Error while formatting:');
19-
console.warn(err);
20-
return query;
2117
}
18+
console.log('Error while formatting:');
19+
console.warn(err);
20+
return query;
2221
}
2322
};

0 commit comments

Comments
 (0)