Skip to content

Commit

Permalink
updo
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Aug 29, 2024
1 parent c739b99 commit 1028fff
Show file tree
Hide file tree
Showing 41 changed files with 623 additions and 744 deletions.
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v3"

yarnPath: .yarn/releases/yarn-4.4.0.cjs
yarnPath: .yarn/releases/yarn-4.4.1.cjs
4 changes: 1 addition & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import { config as xylabsConfig, rulesConfig } from '@xylabs/eslint-config-flat'

export default [
{
ignores: ['.yarn/**', 'jest.config.cjs', '**/dist/**', 'dist', 'build/**', 'node_modules/**'],
},
{ ignores: ['.yarn/**', 'jest.config.cjs', '**/dist/**', 'dist', 'build/**', 'node_modules/**'] },
...xylabsConfig,
{
rules: {
Expand Down
4 changes: 1 addition & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const generateJestConfig = ({ esModules }: { esModules: string[] }) => {
extensionsToTreatAsEsm: ['.ts'],
globalSetup: './jestSetup/globalSetup.ts',
globalTeardown: './jestSetup/globalTeardown.ts',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
moduleNameMapper: { '^(\\.{1,2}/.*)\\.js$': '$1' },
preset: 'ts-jest',
setupFiles: ['dotenv/config'],
setupFilesAfterEnv: ['jest-sorted', 'jest-extended/all', './jestSetup/setupFiles.ts'],
Expand Down
4 changes: 2 additions & 2 deletions jestSetup/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config } from 'dotenv'
config()
import { Config } from 'jest'
import { SuperTest, Test } from 'supertest'
import type { Config } from 'jest'
import type { SuperTest, Test } from 'supertest'

// Augment global scope with shared variables (must be var)
declare global {
Expand Down
2 changes: 1 addition & 1 deletion jestSetup/globalTeardown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { config } from 'dotenv'
config()
import { Config } from 'jest'
import type { Config } from 'jest'

/**
* Jest global teardown method runs after all tests are run
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"module": "dist/neutral/index.mjs",
"types": "dist/neutral/index.d.ts",
"license": "LGPL-3.0-only",
"packageManager": "yarn@4.4.0",
"packageManager": "yarn@4.4.1",
"workspaces": [
"packages/*"
],
Expand All @@ -45,20 +45,20 @@
"@xyo-network/sdk-geo": "workspace:^"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^2.6.2",
"@stylistic/eslint-plugin": "^2.7.1",
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.7",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@xylabs/eslint-config-flat": "^4.0.0-rc.15",
"@xylabs/forget": "^4.0.0",
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
"@xylabs/tsconfig": "^4.0.0-rc.15",
"@xylabs/tsconfig-jest": "^4.0.0-rc.15",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@xylabs/eslint-config-flat": "^4.0.7",
"@xylabs/forget": "^4.0.9",
"@xylabs/ts-scripts-yarn3": "^4.0.7",
"@xylabs/tsconfig": "^4.0.7",
"@xylabs/tsconfig-jest": "^4.0.7",
"dotenv": "^16.4.5",
"eslint": "^9.9.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint": "^9.9.1",
"eslint-import-resolver-typescript": "^3.6.3",
"jest": "^29.7.0",
"supertest": "^7.0.0",
"typescript": "^5.5.4",
Expand All @@ -70,4 +70,4 @@
},
"sideEffects": false,
"type": "module"
}
}
10 changes: 5 additions & 5 deletions packages/ethers-wrappers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
"types": "dist/neutral/index.d.ts",
"license": "LGPL-3.0-only",
"dependencies": {
"@xylabs/assert": "^4.0.0",
"@xylabs/eth-address": "^4.0.0",
"@xylabs/assert": "^4.0.9",
"@xylabs/eth-address": "^4.0.9",
"@xyo-network/typechain": "^3.1.0",
"ethers": "^6.13.2"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
"@xylabs/tsconfig": "^4.0.0-rc.15",
"@xylabs/ts-scripts-yarn3": "^4.0.7",
"@xylabs/tsconfig": "^4.0.7",
"ethers": "^6.13.2",
"typescript": "^5.5.4"
},
"sideEffects": false,
"packageManager": "yarn@3.2.0",
"type": "module"
}
}
5 changes: 3 additions & 2 deletions packages/ethers-wrappers/src/Erc20.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { assertEx } from '@xylabs/assert'
import { EthAddress } from '@xylabs/eth-address'
import { BurnableErc20, BurnableErc20__factory as BurnableErc20Factory } from '@xyo-network/typechain'
import { Provider, Signer } from 'ethers'
import type { BurnableErc20 } from '@xyo-network/typechain'
import { BurnableErc20__factory as BurnableErc20Factory } from '@xyo-network/typechain'
import type { Provider, Signer } from 'ethers'

import { XyoEthersWrapperBase } from './EthersBase.ts'

Expand Down
2 changes: 1 addition & 1 deletion packages/ethers-wrappers/src/EthersBase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, Signer } from 'ethers'
import type { Provider, Signer } from 'ethers'

export class XyoEthersWrapperBase {
protected provider: Provider
Expand Down
4 changes: 1 addition & 3 deletions packages/ethers-wrappers/xy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
const config: XyTsupConfig = {
compile: {
browser: {},
neutral: {
src: true,
},
neutral: { src: true },
node: {},
},
}
Expand Down
8 changes: 4 additions & 4 deletions packages/geo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
"license": "LGPL-3.0-only",
"dependencies": {
"geojson": "^0.5.0",
"mapbox-gl": "^3.5.2"
"mapbox-gl": "^3.6.0"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
"@xylabs/tsconfig": "^4.0.0-rc.15",
"@xylabs/ts-scripts-yarn3": "^4.0.7",
"@xylabs/tsconfig": "^4.0.7",
"typescript": "^5.5.4"
},
"sideEffects": false,
"packageManager": "yarn@3.2.0",
"type": "module"
}
}
8 changes: 6 additions & 2 deletions packages/geo/src/GeoJson.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Feature, FeatureCollection, Geometry, Point, Polygon } from 'geojson'
import type {
Feature, FeatureCollection, Geometry, Point, Polygon,
} from 'geojson'
import MapBox from 'mapbox-gl'

import { boundingBoxToCenter, boundingBoxToPolygon, tileFromQuadkey, tileToBoundingBox } from './mercator/index.ts'
import {
boundingBoxToCenter, boundingBoxToPolygon, tileFromQuadkey, tileToBoundingBox,
} from './mercator/index.ts'

class GeoJson {
private _lngLat?: MapBox.LngLat
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/LayerBase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MapBox from 'mapbox-gl'
import type MapBox from 'mapbox-gl'

export abstract class LayerBase<T extends MapBox.Layer> {
id: string
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/boundingbox/to/boundary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorBoundary, MercatorBoundingBox } from '../../types.ts'
import type { MercatorBoundary, MercatorBoundingBox } from '../../types.ts'

export const boundingBoxToBoundary = (box: MercatorBoundingBox): MercatorBoundary => {
return [box.getNorthWest(), box.getNorthEast(), box.getSouthEast(), box.getSouthWest(), box.getNorthWest()]
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/boundingbox/to/center.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorBoundingBox } from '../../types.ts'
import type { MercatorBoundingBox } from '../../types.ts'

export const boundingBoxToCenter = (boundingBox: MercatorBoundingBox, decimal = 6) => {
const west = boundingBox.getWest()
Expand Down
4 changes: 2 additions & 2 deletions packages/geo/src/mercator/boundingbox/to/polygon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Polygon } from 'geojson'
import type { Polygon } from 'geojson'

import { MercatorBoundingBox, MercatorLngLat } from '../../types.ts'
import type { MercatorBoundingBox, MercatorLngLat } from '../../types.ts'
import { boundingBoxToBoundary } from './boundary.ts'

export const boundingBoxToPolygon = (box: MercatorBoundingBox): Polygon => {
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tile/from/point.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { d2r } from '../../constants.ts'
import { MercatorLngLat } from '../../types.ts'
import type { MercatorLngLat } from '../../types.ts'

const pointToTileFraction = (point: MercatorLngLat, z: number) => {
const sin = Math.sin(point.lat * d2r)
Expand Down
3 changes: 2 additions & 1 deletion packages/geo/src/mercator/tile/to/boundingbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import MapBox from 'mapbox-gl'

import { r2d } from '../../constants.ts'
import { MercatorBoundingBox, MercatorTile } from '../../types.ts'
import type { MercatorTile } from '../../types.ts'
import { MercatorBoundingBox } from '../../types.ts'

const toLongitude = (x: number, z: number): number => {
return (x / Math.pow(2, z)) * 360 - 180
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tile/to/children.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorTile } from '../../types.ts'
import type { MercatorTile } from '../../types.ts'

const tileToChildren = (tile: MercatorTile) => {
return [
Expand Down
4 changes: 2 additions & 2 deletions packages/geo/src/mercator/tile/to/geoJson.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Polygon, Position } from 'geojson'
import type { Polygon, Position } from 'geojson'

import { MercatorTile } from '../../types.ts'
import type { MercatorTile } from '../../types.ts'
import { tileToBoundingBox } from './boundingbox.ts'

const tileToGeoJson = (tile: MercatorTile): Polygon => {
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tile/to/parent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorTile } from '../../types.ts'
import type { MercatorTile } from '../../types.ts'

const tileToParent = (tile: MercatorTile): MercatorTile => {
return [tile[0] >> 1, tile[1] >> 1, tile[2] - 1]
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tile/to/point.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorLngLat, MercatorTile } from '../../types.ts'
import type { MercatorLngLat, MercatorTile } from '../../types.ts'
import { tileToBoundingBox } from './boundingbox.ts'

const tileToPoint = (tile: MercatorTile): MercatorLngLat => {
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tile/to/quadkey.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorTile } from '../../types.ts'
import type { MercatorTile } from '../../types.ts'

const tileToQuadkey = (tile: MercatorTile): string => {
let index = ''
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tile/to/siblings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorTile } from '../../types.ts'
import type { MercatorTile } from '../../types.ts'
import { tileToChildren } from './children.ts'
import { tileToParent } from './parent.ts'

Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tiles/equal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorTile } from '../types.ts'
import type { MercatorTile } from '../types.ts'

const tilesEqual = (tile1: MercatorTile, tile2: MercatorTile) => {
return tile1[0] === tile2[0] && tile1[1] === tile2[1] && tile1[2] === tile2[2]
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tiles/from/boundingbox.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tileFromPoint } from '../../tile/index.ts'
import { MercatorBoundingBox, MercatorTile } from '../../types.ts'
import type { MercatorBoundingBox, MercatorTile } from '../../types.ts'

const tilesFromBoundingBox = (box: MercatorBoundingBox, zoom: number): MercatorTile[] => {
const nw = tileFromPoint(box.getNorthWest(), zoom)
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tiles/hasSiblings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tileToSiblings } from '../tile/index.ts'
import { MercatorTile } from '../types.ts'
import type { MercatorTile } from '../types.ts'
import { tilesHasTile } from './hasTile.ts'

const hasSiblings = (tiles: MercatorTile[], tile: MercatorTile) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/mercator/tiles/hasTile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MercatorTile } from '../types.ts'
import type { MercatorTile } from '../types.ts'
import { tilesEqual } from './equal.ts'

const tilesHasTile = (tiles: MercatorTile[], tile: MercatorTile) => {
Expand Down
4 changes: 1 addition & 3 deletions packages/geo/xy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
const config: XyTsupConfig = {
compile: {
browser: {},
neutral: {
src: true,
},
neutral: { src: true },
node: {},
},
}
Expand Down
6 changes: 3 additions & 3 deletions packages/meta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"cheerio": "^1.0.0"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
"@xylabs/tsconfig": "^4.0.0-rc.15",
"@xylabs/ts-scripts-yarn3": "^4.0.7",
"@xylabs/tsconfig": "^4.0.7",
"jest-serializer-html": "^7.1.0",
"typescript": "^5.5.4"
},
"sideEffects": false,
"packageManager": "yarn@3.2.0",
"type": "module"
}
}
3 changes: 2 additions & 1 deletion packages/meta/src/html/spec/mergeDocumentHead.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { mergeDocumentHead } from '../mergeDocumentHead'
/* eslint-disable @stylistic/max-len */
import { mergeDocumentHead } from '../mergeDocumentHead.ts'

describe('mergeDocumentHead', () => {
const cases: [string, string, string, string][] = [
Expand Down
14 changes: 3 additions & 11 deletions packages/meta/src/lib/spec/getMetaAsDict.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { Meta } from '../../models'
import type { Meta } from '../../models'
import { getMetaAsDict } from '../getMetaAsDict'

describe('getMetaAsDict', () => {
const cases: Meta[] = [
{
description: 'description',
},
{
twitter: {
image: {
'': 'twitter:image',
},
},
},
{ description: 'description' },
{ twitter: { image: { '': 'twitter:image' } } },
]
it.each(cases)('Generates head meta', (meta: Meta) => {
const output = getMetaAsDict(meta)
Expand Down
5 changes: 3 additions & 2 deletions packages/meta/src/meta/builder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { CheerioAPI, load } from 'cheerio'
import type { CheerioAPI } from 'cheerio'
import { load } from 'cheerio'

import { getMetaAsDict } from '../lib/index.ts'
import { Meta } from '../models/index.ts'
import type { Meta } from '../models/index.ts'

/* test change */

Expand Down
4 changes: 2 additions & 2 deletions packages/meta/src/models/Meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OpenGraphMeta } from './OpenGraph/index.ts'
import { TwitterMeta } from './Twitter/index.ts'
import type { OpenGraphMeta } from './OpenGraph/index.ts'
import type { TwitterMeta } from './Twitter/index.ts'

export interface Meta {
description?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/meta/src/models/OpenGraph/OpenGraphMeta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OpenGraphStructuredProperty } from './OpenGraphStructuredProperty.ts'
import type { OpenGraphStructuredProperty } from './OpenGraphStructuredProperty.ts'

// TODO: There is slightly different fields for video/image/audio and we should create
// separate interfaces for each
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { OpenGraphStructured } from './OpenGraphStructured.ts'
import type { OpenGraphStructured } from './OpenGraphStructured.ts'

export type OpenGraphStructuredProperty = string | OpenGraphStructured | (string | OpenGraphStructured)[]
4 changes: 2 additions & 2 deletions packages/meta/src/models/Twitter/Twitter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TwitterApp } from './TwitterApp.ts'
import { TwitterPlayer } from './TwitterPlayer.ts'
import type { TwitterApp } from './TwitterApp.ts'
import type { TwitterPlayer } from './TwitterPlayer.ts'

/**
* https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
Expand Down
Loading

0 comments on commit 1028fff

Please sign in to comment.