Skip to content

Commit d7119f2

Browse files
committed
feat(typesync pkg): rebase. lint fixes
1 parent b8596c2 commit d7119f2

File tree

3 files changed

+26
-34
lines changed

3 files changed

+26
-34
lines changed

apps/typesync/src/Database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const SqlLive = SqliteClient.layer({
1414

1515
const MigratorLive = Migrator.layer({
1616
loader: fromFileSystem(fileURLToPath(new URL('migrations', import.meta.url))),
17-
}).pipe(Layer.provide(SqlLive))
17+
}).pipe(Layer.provide(SqlLive));
1818

1919
const DatabaseLive = Layer.mergeAll(SqlLive, MigratorLive).pipe(Layer.provide(NodeContext.layer));
2020

apps/typesync/src/Utils.ts

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ export class InvalidInputError extends Data.TaggedError('/typesync/errors/Invali
130130
/* Windows-safe migration loader */
131131
/* ------------------------------------------------------------------ */
132132

133-
import { pathToFileURL } from "node:url"
134-
import { FileSystem } from "@effect/platform/FileSystem"
135-
import * as Effect from "effect/Effect"
136-
import type { Loader, ResolvedMigration } from "@effect/sql/Migrator"
137-
import { MigrationError } from "@effect/sql/Migrator"
133+
import { pathToFileURL } from 'node:url';
134+
import { FileSystem } from '@effect/platform/FileSystem';
135+
import type { Loader, ResolvedMigration } from '@effect/sql/Migrator';
136+
import { MigrationError } from '@effect/sql/Migrator';
137+
import * as Effect from 'effect/Effect';
138138

139139
/**
140140
* Patched version of
@@ -143,36 +143,29 @@ import { MigrationError } from "@effect/sql/Migrator"
143143
* The only difference is that the dynamic `import()` receives a proper
144144
* `file://` URL, so it works on Windows as well as on Linux / macOS.
145145
*/
146-
export const fromFileSystem = (
147-
dir: string,
148-
): Loader<FileSystem> =>
146+
export const fromFileSystem = (dir: string): Loader<FileSystem> =>
149147
FileSystem.pipe(
150148
/* read directory ----------------------------------------------------- */
151149
Effect.flatMap((FS) => FS.readDirectory(dir)),
152-
Effect.mapError(
153-
(e) => new MigrationError({ reason: "failed", message: e.message }),
154-
),
150+
Effect.mapError((e) => new MigrationError({ reason: 'failed', message: e.message })),
155151
/* build migration list ---------------------------------------------- */
156-
Effect.map((files): ReadonlyArray<ResolvedMigration> =>
157-
files
158-
.flatMap((file) => {
159-
const m =
160-
file.match(/^(?:.*[\\/])?(\d+)_([^.]+)\.(js|ts)$/) // win/posix
161-
if (!m) return []
162-
const [basename, id, name] = m
163-
return [
164-
[
165-
Number(id),
166-
name,
167-
Effect.promise(() =>
168-
import(
169-
/* @vite-ignore */ /* webpackIgnore: true */
170-
pathToFileURL(`${dir}/${basename}`).href,
152+
Effect.map(
153+
(files): ReadonlyArray<ResolvedMigration> =>
154+
files
155+
.flatMap((file) => {
156+
const m = file.match(/^(?:.*[\\/])?(\d+)_([^.]+)\.(js|ts)$/); // win/posix
157+
if (!m) return [];
158+
const [basename, id, name] = m;
159+
return [
160+
[
161+
Number(id),
162+
name,
163+
Effect.promise(
164+
() => import(/* @vite-ignore */ /* webpackIgnore: true */ pathToFileURL(`${dir}/${basename}`).href),
171165
),
172-
),
173-
],
174-
] as const
175-
})
176-
.sort(([a], [b]) => a - b),
166+
],
167+
] as const;
168+
})
169+
.sort(([a], [b]) => a - b),
177170
),
178-
)
171+
);

scripts/package.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const publishPkgJson = {
3535
main: pkgJson.main,
3636
module: pkgJson.module,
3737
types: pkgJson.types,
38-
exports: pkgJson.exports,
3938
sideEffects: pkgJson.sideEffects,
4039
exports: pkgJson.exports,
4140
peerDependencies: pkgJson.peerDependencies,

0 commit comments

Comments
 (0)