Skip to content

Commit

Permalink
⚒️ finish refactoring, types from grapher and core-table are now full…
Browse files Browse the repository at this point in the history
…y moved
  • Loading branch information
danyx23 committed Jan 4, 2024
1 parent 4d81007 commit 1d68047
Show file tree
Hide file tree
Showing 74 changed files with 161 additions and 152 deletions.
8 changes: 6 additions & 2 deletions adminSiteClient/ChartEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
*
*/

import { Grapher, Topic } from "@ourworldindata/grapher"
import { type DetailDictionary, type RawPageview } from "@ourworldindata/utils"
import { Grapher } from "@ourworldindata/grapher"
import {
type DetailDictionary,
type RawPageview,
Topic,
} from "@ourworldindata/utils"
import { computed, observable, runInAction, when } from "mobx"
import { BAKED_GRAPHER_URL } from "../settings/clientSettings.js"
import { Admin } from "./Admin.js"
Expand Down
3 changes: 2 additions & 1 deletion adminSiteClient/ChartEditorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
groupBy,
extractDetailsFromSyntax,
} from "@ourworldindata/utils"
import { Grapher, Topic, GrapherInterface } from "@ourworldindata/grapher"
import { Topic, GrapherInterface } from "@ourworldindata/types"
import { Grapher } from "@ourworldindata/grapher"
import { Admin } from "./Admin.js"
import {
ChartEditor,
Expand Down
2 changes: 1 addition & 1 deletion adminSiteClient/ChartList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { observer } from "mobx-react"
import { runInAction, observable } from "mobx"
import { bind } from "decko"
import { AdminAppContext, AdminAppContextType } from "./AdminAppContext.js"
import { ChartTypeName, GrapherInterface } from "@ourworldindata/grapher"
import { ChartTypeName, GrapherInterface } from "@ourworldindata/types"
import { startCase, ChartTagJoin } from "@ourworldindata/utils"
import { References, getFullReferencesCount } from "./ChartEditor.js"
import { ChartRow } from "./ChartRow.js"
Expand Down
4 changes: 2 additions & 2 deletions adminSiteClient/ColorSchemeDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react"
import { computed, action } from "mobx"
import Select from "react-select"
import { ChartTypeName } from "@ourworldindata/types"
import {
getColorSchemeForChartType,
ColorScheme,
ChartTypeName,
getColorSchemeForChartType,
} from "@ourworldindata/grapher"
import { observer } from "mobx-react"
import { bind } from "decko"
Expand Down
5 changes: 2 additions & 3 deletions adminSiteClient/EditorBasicTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import {
import { observer } from "mobx-react"
import {
ChartTypeName,
DimensionSlot,
EntitySelectionMode,
StackMode,
WorldEntityName,
} from "@ourworldindata/grapher"
} from "@ourworldindata/types"
import { DimensionSlot, WorldEntityName } from "@ourworldindata/grapher"
import {
DimensionProperty,
moveArrayItemToIndex,
Expand Down
10 changes: 6 additions & 4 deletions adminSiteClient/EditorColorScaleSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import { observer } from "mobx-react"
import Select from "react-select"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import { faPlus, faMinus } from "@fortawesome/free-solid-svg-icons"
import {
ColorSchemeName,
BinningStrategy,
ChartTypeName,
Color,
} from "@ourworldindata/types"
import {
ColorScale,
ColorScaleBin,
NumericBin,
CategoricalBin,
binningStrategyLabels,
ColorSchemeName,
BinningStrategy,
ChartTypeName,
} from "@ourworldindata/grapher"
import { clone, noop, last } from "@ourworldindata/utils"
import { Color } from "@ourworldindata/core-table"
import {
Section,
Toggle,
Expand Down
4 changes: 2 additions & 2 deletions adminSiteClient/EditorCustomizeTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { observable, computed, action } from "mobx"
import { observer } from "mobx-react"
import { ChartEditor } from "./ChartEditor.js"
import {
Grapher,
ComparisonLineConfig,
ColorSchemeName,
FacetAxisDomain,
FacetStrategy,
} from "@ourworldindata/grapher"
} from "@ourworldindata/types"
import { Grapher } from "@ourworldindata/grapher"
import {
NumberField,
Toggle,
Expand Down
6 changes: 3 additions & 3 deletions adminSiteClient/EditorDataTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { moveArrayItemToIndex, omit } from "@ourworldindata/utils"
import { computed, action, observable } from "mobx"
import { observer } from "mobx-react"
import {
Grapher,
EntitySelectionMode,
MissingDataStrategy,
} from "@ourworldindata/grapher"
EntityName,
} from "@ourworldindata/types"
import { Grapher } from "@ourworldindata/grapher"
import { ColorBox, SelectField, Section } from "./Forms.js"
import { ChartEditor } from "./ChartEditor.js"
import { faArrowsAltV, faTimes } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import { EntityName } from "@ourworldindata/core-table"
import {
DragDropContext,
Draggable,
Expand Down
3 changes: 1 addition & 2 deletions adminSiteClient/EditorMapTab.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ChartTypeName, MapProjectionName } from "@ourworldindata/types"
import {
ChartDimension,
ChartTypeName,
MapChart,
MapConfig,
MapProjectionLabels,
MapProjectionName,
} from "@ourworldindata/grapher"
import { ColumnSlug, isEmpty, ToleranceStrategy } from "@ourworldindata/utils"
import { action, computed } from "mobx"
Expand Down
2 changes: 1 addition & 1 deletion adminSiteClient/EditorMarimekkoTab.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { faMinus, faTrash } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import { EntityName } from "@ourworldindata/core-table"
import { EntityName } from "@ourworldindata/types"
import { Grapher } from "@ourworldindata/grapher"
import { excludeUndefined } from "@ourworldindata/utils"
import lodash from "lodash"
Expand Down
6 changes: 3 additions & 3 deletions adminSiteClient/EditorScatterTab.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { faMinus, faTrash } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import { EntityName } from "@ourworldindata/core-table"
import {
EntityName,
ComparisonLineConfig,
Grapher,
ScatterPointLabelStrategy,
} from "@ourworldindata/grapher"
} from "@ourworldindata/types"
import { Grapher } from "@ourworldindata/grapher"
import { debounce, excludeUndefined } from "@ourworldindata/utils"
import { action, computed, observable } from "mobx"
import { observer } from "mobx-react"
Expand Down
6 changes: 4 additions & 2 deletions adminSiteClient/EditorTextTab.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { faMinus, faPlus } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import {
getErrorMessageRelatedQuestionUrl,
Grapher,
LogoOption,
RelatedQuestionsConfig,
Topic,
} from "@ourworldindata/types"
import {
Grapher,
getErrorMessageRelatedQuestionUrl,
} from "@ourworldindata/grapher"
import { getIndexableKeys, slugify } from "@ourworldindata/utils"
import { action, computed, runInAction } from "mobx"
Expand Down
2 changes: 1 addition & 1 deletion adminSiteClient/GrapherConfigGridEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ import { BaseEditorComponent, HotColumn, HotTable } from "@handsontable/react"
import { AdminAppContext, AdminAppContextType } from "./AdminAppContext.js"

import Handsontable from "handsontable"
import { ChartTypeName } from "@ourworldindata/types"
import {
Grapher,
GrapherProgrammaticInterface,
MapChart,
ChartTypeName,
} from "@ourworldindata/grapher"
import { BindString, SelectField, Toggle } from "./Forms.js"
import { from } from "rxjs"
Expand Down
2 changes: 1 addition & 1 deletion adminSiteClient/GrapherConfigGridEditorTypesAndUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import React from "react"
import { IconDefinition } from "@fortawesome/fontawesome-common-types"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"

import { GrapherInterface } from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"
import {
AntdConfig,
BasicConfig,
Expand Down
2 changes: 1 addition & 1 deletion adminSiteClient/SuggestedChartRevision.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GrapherInterface } from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"
import { SuggestedChartRevisionStatus } from "@ourworldindata/utils"

export interface SuggestedChartRevisionSerialized {
Expand Down
2 changes: 1 addition & 1 deletion adminSiteClient/SuggestedChartRevisionImportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AdminLayout } from "./AdminLayout.js"
import { AdminAppContext, AdminAppContextType } from "./AdminAppContext.js"
import { TextField } from "./Forms.js"
import { capitalize } from "@ourworldindata/utils"
import { GrapherInterface } from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"

interface ResponseMessage {
type: string
Expand Down
7 changes: 2 additions & 5 deletions adminSiteClient/VariableEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ import { OriginList } from "./OriginList.js"
import { SourceList } from "./SourceList.js"
import { AdminAppContext, AdminAppContextType } from "./AdminAppContext.js"
import { Base64 } from "js-base64"
import {
Grapher,
GrapherTabOption,
GrapherInterface,
} from "@ourworldindata/grapher"
import { GrapherTabOption, GrapherInterface } from "@ourworldindata/types"
import { Grapher } from "@ourworldindata/grapher"
import { faCircleInfo } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"

Expand Down
3 changes: 1 addition & 2 deletions adminSiteServer/apiRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ import {
ChartTagJoin,
OwidGdoc,
} from "@ourworldindata/utils"
import { GrapherInterface, grapherKeysToSerialize } from "@ourworldindata/types"
import {
GrapherInterface,
grapherKeysToSerialize,
getVariableDataRoute,
getVariableMetadataRoute,
} from "@ourworldindata/grapher"
Expand Down
2 changes: 1 addition & 1 deletion adminSiteServer/testPageRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
EntitySelectionMode,
GrapherTabOption,
StackMode,
} from "@ourworldindata/grapher"
} from "@ourworldindata/types"

const IS_LIVE = ADMIN_BASE_URL === "https://owid.cloud"
const DEFAULT_COMPARISON_URL = "https://ourworldindata.org"
Expand Down
2 changes: 1 addition & 1 deletion baker/GrapherBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import * as db from "../db/db.js"
import { glob } from "glob"
import { isPathRedirectedToExplorer } from "../explorerAdminServer/ExplorerRedirects.js"
import { getPostEnrichedBySlug } from "../db/model/Post.js"
import { ChartTypeName, GrapherInterface } from "@ourworldindata/grapher"
import { ChartTypeName, GrapherInterface } from "@ourworldindata/types"
import workerpool from "workerpool"
import ProgressBar from "progress"
import {
Expand Down
7 changes: 2 additions & 5 deletions baker/GrapherImageBaker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
Grapher,
GrapherInterface,
GrapherProgrammaticInterface,
} from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"
import { Grapher, GrapherProgrammaticInterface } from "@ourworldindata/grapher"
import { MultipleOwidVariableDataDimensionsMap } from "@ourworldindata/utils"
import fs from "fs-extra"
import path from "path"
Expand Down
2 changes: 1 addition & 1 deletion baker/countryProfiles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import * as db from "../db/db.js"
import { CountriesIndexPage } from "../site/CountriesIndexPage.js"
import { GrapherInterface } from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"
import * as lodash from "lodash"
import {
CountryProfileIndicator,
Expand Down
7 changes: 2 additions & 5 deletions baker/siteRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
extractFormattingOptions,
PostRowRaw,
} from "@ourworldindata/utils"
import { FormattingOptions } from "@ourworldindata/types"
import { FormattingOptions, GrapherInterface } from "@ourworldindata/types"
import { CountryProfileSpec } from "../site/countryProfileProjects.js"
import { formatPost } from "./formatWordpressPost.js"
import {
Expand All @@ -78,10 +78,7 @@ import {
} from "../site/blocks/KeyInsights.js"
import { formatUrls, KEY_INSIGHTS_H2_CLASSNAME } from "../site/formatting.js"

import {
GrapherInterface,
GrapherProgrammaticInterface,
} from "@ourworldindata/grapher"
import { GrapherProgrammaticInterface } from "@ourworldindata/grapher"
import { ExplorerProgram } from "../explorer/ExplorerProgram.js"
import { ExplorerPageUrlMigrationSpec } from "../explorer/urlMigrations/ExplorerPageUrlMigrationSpec.js"
import { ExplorerPage } from "../site/ExplorerPage.js"
Expand Down
2 changes: 1 addition & 1 deletion datapage/Datapage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ExplorerProgram } from "../explorer/ExplorerProgram.js"
import { GdocPost } from "../db/model/Gdoc/GdocPost.js"
import { GdocFactory } from "../db/model/Gdoc/GdocFactory.js"
import { OwidGoogleAuth } from "../db/OwidGoogleAuth.js"
import { GrapherInterface } from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"

export const getDatapageDataV2 = async (
variableMetadata: OwidVariableWithSource,
Expand Down
2 changes: 1 addition & 1 deletion db/migration/1661264304751-MigrateSelectedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MigrationInterface, QueryRunner } from "typeorm"

import { entityNameById } from "./data/entityNameById.js"

import { ChartTypeName, GrapherInterface } from "@ourworldindata/grapher"
import { ChartTypeName, GrapherInterface } from "@ourworldindata/types"

/**
* Migrate the legacy `selectedData` and get rid of it.
Expand Down
2 changes: 1 addition & 1 deletion db/model/Chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Tag,
ChartTagJoin,
} from "@ourworldindata/utils"
import type { GrapherInterface } from "@ourworldindata/grapher"
import type { GrapherInterface } from "@ourworldindata/types"
import { OpenAI } from "openai"
import { OPENAI_API_KEY } from "../../settings/serverSettings.js"

Expand Down
2 changes: 1 addition & 1 deletion db/model/Variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
OwidVariableId,
retryPromise,
OwidLicense,
GrapherInterface,
OwidProcessingLevel,
} from "@ourworldindata/utils"
import {
GrapherInterface,
getVariableDataRoute,
getVariableMetadataRoute,
} from "@ourworldindata/grapher"
Expand Down
2 changes: 1 addition & 1 deletion db/wpdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
Tag,
OwidGdocPostInterface,
} from "@ourworldindata/utils"
import { Topic } from "@ourworldindata/grapher"
import { Topic } from "@ourworldindata/types"
import {
getContentGraph,
WPPostTypeToGraphDocumentType,
Expand Down
4 changes: 2 additions & 2 deletions devTools/svgTester/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChartTypeName, GrapherTabOption } from "@ourworldindata/grapher"
import { ChartTypeName, GrapherTabOption } from "@ourworldindata/types"
import {
MultipleOwidVariableDataDimensionsMap,
OwidVariableMixedData,
Expand All @@ -15,7 +15,7 @@ import {
} from "../../baker/GrapherImageBaker.js"
import { getVariableData } from "../../db/model/Variable.js"

import { GrapherInterface } from "@ourworldindata/grapher"
import { GrapherInterface } from "@ourworldindata/types"
import _ from "lodash"
import util from "util"
import {
Expand Down
7 changes: 4 additions & 3 deletions explorer/ColumnGrammar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { AvailableTransforms } from "@ourworldindata/core-table"
import {
AvailableTransforms,
BinningStrategy,
ColorSchemeName,
ColumnTypeNames,
} from "@ourworldindata/core-table"
import { BinningStrategy, ColorSchemeName } from "@ourworldindata/grapher"
} from "@ourworldindata/types"
import { ToleranceStrategy } from "@ourworldindata/utils"
import {
BooleanCellDef,
Expand Down
2 changes: 1 addition & 1 deletion explorer/Explorer.jsdom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import Enzyme from "enzyme"
import Adapter from "@wojtekmaj/enzyme-adapter-react-17"
import { GrapherTabOption } from "@ourworldindata/grapher"
import { GrapherTabOption } from "@ourworldindata/types"

Enzyme.configure({ adapter: new Adapter() })

Expand Down
6 changes: 2 additions & 4 deletions explorer/Explorer.sample.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from "react"
import { DimensionProperty } from "@ourworldindata/utils"
import {
GrapherProgrammaticInterface,
GrapherTabOption,
} from "@ourworldindata/grapher"
import { GrapherTabOption } from "@ourworldindata/types"
import { GrapherProgrammaticInterface } from "@ourworldindata/grapher"
import { Explorer, ExplorerProps } from "./Explorer.js"

const SampleExplorerOfGraphersProgram = `explorerTitle CO₂ Data Explorer
Expand Down
Loading

0 comments on commit 1d68047

Please sign in to comment.