Skip to content

Commit

Permalink
chore: migrate to jsr repositories for migratable dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wax911 committed Nov 8, 2024
1 parent ef40d8d commit 7605712
Show file tree
Hide file tree
Showing 28 changed files with 225 additions and 316 deletions.
432 changes: 172 additions & 260 deletions deno.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/common/core/factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Application, Router } from 'x/oak';
import { Application, Router } from 'oak';
import { FactoryOptions } from '../types/options.ts';
import state from './setup.ts';
import timing from '../middleware/timing.ts';
Expand All @@ -7,7 +7,7 @@ import growth from '../middleware/growth.ts';
import header from '../middleware/header.ts';
import targeting from '../middleware/targeting.ts';
import { logger } from './logger.ts';
import { between } from 'x/optic';
import { between } from 'optic';

const app = new Application({
state,
Expand Down
7 changes: 3 additions & 4 deletions src/common/core/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SummaryMeasureFormatter } from 'x/optic/profiler';
import { ConsoleStream, Level, Logger } from 'x/optic';
import { TokenReplacer } from 'x/optic/formatters';
import { SummaryMeasureFormatter } from 'optic/profileMeasure';
import { ConsoleStream, Level, Logger } from 'optic';
import { TokenReplacer } from 'optic/formatters';
import { LogtailStream } from '../logger/logtail.ts';
import { env } from './env.ts';
import { MinLogLevel } from '../logger/types.ts';
Expand Down Expand Up @@ -41,7 +41,6 @@ const logger = new Logger()
logger.profilingConfig()
.enabled(env<boolean>('OPTIC_TRACING'))
.captureMemory(true)
.captureOps(true)
.withLogLevel(Level.Info)
.withFormatter(new SummaryMeasureFormatter());

Expand Down
2 changes: 1 addition & 1 deletion src/common/core/request.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { between } from 'x/optic';
import { between } from 'optic';
import { logger } from './logger.ts';

const sanitize = (uri: string): { safeUrl: string; host: string } => {
Expand Down
2 changes: 1 addition & 1 deletion src/common/core/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { State } from '../types/state.ts';
import { env } from './env.ts';
import { GrowthBook } from 'growthbook';
import { logger } from './logger.ts';
import { between } from 'x/optic';
import { between } from 'optic';
import _localSourceFactory from '../mongo/factory.ts';

logger.mark('setup-start');
Expand Down
2 changes: 1 addition & 1 deletion src/common/core/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'std/testing/asserts';
import { assertEquals } from 'std/assert';
import { describe, it } from 'std/testing/bdd';
import { isOlderThan, pagination } from './utils.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/common/experiment/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Features } from '../types/core.ts';
import { logger } from '../core/logger.ts';
import { between } from 'x/optic';
import { between } from 'optic';
import { PlatformSource } from './types.ts';

const invoke = <T>(action: () => T): T => {
Expand Down
2 changes: 1 addition & 1 deletion src/common/helpers/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ export const toInstant = (date?: string | Date): Instant => {
const d = new Date(date);
return d.getTime() / 1000;
}
};
};
6 changes: 3 additions & 3 deletions src/common/logger/logtail.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Logtail } from 'esm/logtail';
import { TokenReplacer } from 'x/optic/formatters';
import { BaseStream, Level, LogRecord } from 'x/optic';
import { Logtail } from 'npm/logtail';
import { TokenReplacer } from 'optic/formatters';
import { BaseStream, Level, LogRecord } from 'optic';

export class LogtailStream extends BaseStream {
private logtail: Logtail;
Expand Down
2 changes: 1 addition & 1 deletion src/common/middleware/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isHttpError, Status, STATUS_TEXT } from 'x/oak';
import { isHttpError, Status, STATUS_TEXT } from 'oak';
import { logger } from '../core/logger.ts';
import type { ErrorResponse } from '../types/core.ts';
import type { AppContext } from '../types/core.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/common/middleware/growth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { between } from 'x/optic';
import { between } from 'optic';
import { logger } from '../core/logger.ts';
import type { AppContext } from '../types/core.ts';
import { env } from '../core/env.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/common/middleware/header.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HTTPMethods, Status } from 'x/oak';
import { HTTPMethods, Status } from 'oak';
import { logger } from '../core/logger.ts';
import type { AppContext, ErrorResponse } from '../types/core.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/common/middleware/targeting.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { between } from 'x/optic';
import { between } from 'optic';
import { State } from '../types/state.ts';
import { UserAgent } from 'std/http';
import { logger } from '../core/logger.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/common/mongo/factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MongoClient } from 'npm/mongodb';
import { logger } from '../core/logger.ts';
import { between } from 'x/optic';
import { between } from 'optic';
import { env } from '../core/env.ts';
import { Local } from '../types/core.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/common/types/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context } from 'x/oak';
import { Context } from 'oak';
import { State } from './state.ts';
import { GrowthBook } from 'growthbook';
import { Db } from 'npm/mongodb';
Expand Down
2 changes: 1 addition & 1 deletion src/common/types/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context, Middleware, Router, State } from 'x/oak';
import { Context, Middleware, Router, State } from 'oak';

type AS = Record<string, unknown>;

Expand Down
20 changes: 9 additions & 11 deletions src/import_map.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"imports": {
"std/http": "https://deno.land/[email protected]/http/mod.ts",
"std/dotenv": "https://deno.land/[email protected]/dotenv/mod.ts",
"std/collections": "https://deno.land/[email protected]/collections/mod.ts",
"std/testing/asserts": "https://deno.land/[email protected]/assert/mod.ts",
"std/testing/bdd": "https://deno.land/[email protected]/testing/bdd.ts",
"x/optic": "https://deno.land/x/[email protected]/mod.ts",
"x/optic/formatters": "https://deno.land/x/[email protected]/formatters/mod.ts",
"x/optic/profiler": "https://deno.land/x/[email protected]/logger/profileMeasure.ts",
"x/oak": "https://deno.land/x/[email protected]/mod.ts",
"x/xml": "https://deno.land/x/[email protected]/mod.ts",
"std/http": "jsr:@std/http",
"std/dotenv": "jsr:@std/dotenv",
"std/collections": "jsr:@std/collections",
"std/testing": "jsr:@std/testing",
"std/assert": "jsr:@std/assert",
"optic": "jsr:@onjara/optic",
"oak": "jsr:@oak/oak",
"deepmerge": "jsr:@rebeccastevens/deepmerge",
"growthbook": "jsr:@growthbook/growthbook",
"esm/logtail": "https://esm.sh/@logtail/[email protected]",
"xml": "jsr:@libs/xml",
"npm/logtail": "npm:@logtail/[email protected]",
"npm/mongodb": "npm:[email protected]"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Router } from 'x/oak';
import { Router } from 'oak';
import factory from './common/core/factory.ts';
import { port } from './common/core/utils.ts';
import { AppContext } from './common/types/core.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/news/local/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IResponse } from '../../common/types/response.ts';
import { toDocument, toEntity } from '../mapper.ts';
import { News } from '../types.ts';
import { NewsDocument, NewsId } from './types.ts';
import { between } from 'x/optic/profiler';
import { between } from 'optic';
import { projectionOf, sortOf } from '../../common/mongo/index.ts';

export default class LocalSource {
Expand Down
4 changes: 2 additions & 2 deletions src/news/repository/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { IPaging } from '../../common/types/paging.ts';
import { transform } from '../transformer.ts';
import { currentDate, isOlderThan } from '../../common/core/utils.ts';
import { IResponse } from '../../common/types/response.ts';
import { parse } from 'x/xml';
import { parse } from 'xml';
import { logger } from '../../common/core/logger.ts';
import { NewsId } from '../local/types.ts';
import { between } from 'x/optic/profiler';
import { between } from 'optic';

export default class NewsRepository {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion src/series/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Status } from 'x/oak';
import { Status } from 'oak';
import { AppContext, ErrorResponse } from '../common/types/core.ts';
import LocalSource from './local/source.ts';
import SeriesRepository from './repository/series.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/series/local/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { transform } from './transformer.ts';
import { MediaDocument } from './types.ts';
import { MediaParamId } from './types.ts';
import { FindOptions } from 'npm/mongodb';
import { between } from 'x/optic';
import { between } from 'optic';

export default class LocalSource {
constructor(
Expand Down
24 changes: 12 additions & 12 deletions src/series/service/arm/remote/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
interface ArmModel {
anidb: number | null;
anilist: number | null;
'anime-planet': string | null;
anisearch: number | null;
imdb: string | null;
kitsu: number | null;
livechart: number | null;
'notify-moe': string | null;
themoviedb: number | null;
thetvdb: number | null;
myanimelist: number | null;
export interface ArmModel {
anidb?: number;
anilist?: number;
'anime-planet'?: string;
anisearch?: number;
imdb: string;
kitsu?: number;
livechart?: number;
'notify-moe'?: string;
themoviedb?: number;
thetvdb?: number;
myanimelist?: number;
}
4 changes: 2 additions & 2 deletions src/series/service/arm/transformer/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Model } from '../remote/types.ts';
import { ArmModel } from '../remote/types.ts';
import { AnimeRelationId } from '../types.ts';
import { Transform } from '../../../../common/transformer/types.ts';

export const transform: Transform<Model, AnimeRelationId> = (
export const transform: Transform<ArmModel, AnimeRelationId> = (
sourceData,
): AnimeRelationId => ({
anidb: sourceData.anidb,
Expand Down
2 changes: 1 addition & 1 deletion src/series/service/skyhook/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Instant } from '../../../common/helpers/date.ts';

interface SkyhookEpisode {
export interface SkyhookEpisode {
tvdbShowId: number;
tvdbId: number;
seasonNumber: number;
Expand Down
2 changes: 1 addition & 1 deletion src/series/service/theme/transformer/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'std/testing/asserts';
import { assertEquals } from 'std/assert';
import { describe, it } from 'std/testing/bdd';
import { ThemeModel } from '../remote/types.ts';
import { transform } from './index.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/series/service/tmdb/remote/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface Image {
width: number;
}

interface Images {
export interface Images {
backdrops: Image[];
logos: Image[];
posters: Image[];
Expand Down
2 changes: 1 addition & 1 deletion src/series/service/tmdb/utils/image-provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'std/testing/asserts';
import { assertEquals } from 'std/assert';
import { describe, it } from 'std/testing/bdd';
import { ImageProvider, ImageProviderType } from './image-provider.ts';
import { Image } from '../remote/types.ts';
Expand Down

0 comments on commit 7605712

Please sign in to comment.