Skip to content

Commit

Permalink
chore: Bump Dependencies (#607)
Browse files Browse the repository at this point in the history
* Added script for updating deps

* Updated packages. Fixed ReactQuery issues. Added scripts for updating.

* Fixed useMutations. Fixed missing types.

* Updated README

* Updated readme

* Prettified Code!

* Fixed build issues

* Bumped package versions

* Updated pnpm lock

* Reverted some unnecerarry fixes

* Fixed comments

---------

Co-authored-by: kjellhaaland <[email protected]>
  • Loading branch information
kjellhaaland and kjellhaaland authored Apr 26, 2024
1 parent f29cb2a commit b16e935
Show file tree
Hide file tree
Showing 26 changed files with 7,665 additions and 7,805 deletions.
4 changes: 2 additions & 2 deletions .github/helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"commander": "^11.1.0",
"commander": "^12.0.0",
"markdown-table": "^3.0.3",
"tsx": "^4.6.2"
"tsx": "^4.7.1"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ testem.log
Thumbs.db

.turbo

*.tsbuildinfo
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ To run a test app go to apps/test-app and run `pnpm dev`. If you make changes to
## Publishing packages

The repository is configured with CI/CD and automatic deployment, to trigger a release update the version in `package.json` of the package you want to release and merge into main.

## Updating package dependencies

To update all package dependencies, use the command `pnpm run bump-deps` to open the interactive pnpm package update prompt in the terminal.
2 changes: 1 addition & 1 deletion apps/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@equinor/workspace-fusion": "workspace:^",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4"
"react-error-boundary": "^4.0.13"
},
"peerDependencies": {
"react-dom": ">= 16.8.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/test-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function getFilterMetaData(num_filters: number = 2): any[] {
}

function getKPIData(num_kpis = 5) {
const kpiData = [];
const kpiData: { title: string; value: number }[] = [];

for (let i = 0; i < num_kpis; i++) {
const kpiNameLen = getRandomInt(1, 15);
Expand Down Expand Up @@ -135,7 +135,7 @@ export function App() {
excelExport: async (filterState) =>
new Promise((res, rej) =>
setTimeout(() => {
res();
res(undefined);
}, 2000)
),
}}
Expand Down
23 changes: 12 additions & 11 deletions documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@
"astro": "astro"
},
"dependencies": {
"@algolia/client-search": "^4.13.1",
"@astrojs/mdx": "^0.16.0",
"@astrojs/preact": "^2.0.2",
"@astrojs/react": "^2.0.2",
"@docsearch/css": "^3.3.3",
"@docsearch/react": "^3.3.3",
"@equinor/workspace-fusion": "0.15.0",
"@types/node": "^18.0.0",
"astro": "^2.0.8",
"preact": "^10.12.0",
"@algolia/client-search": "^4.23.2",
"@astrojs/mdx": "^2.2.3",
"@astrojs/preact": "^3.1.2",
"@astrojs/react": "^3.1.0",
"@docsearch/css": "^3.6.0",
"@docsearch/react": "^3.6.0",
"@equinor/workspace-fusion": "workspace:*",
"@types/node": "^20.12.2",
"astro": "^4.5.13",
"preact": "^10.20.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"react-mermaid3": "^1.0.1",
"styled-components": "^5.3.6"
"styled-components": "^6.1.8"
},
"devDependencies": {
"@types/html-escaper": "^3.0.2",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"html-escaper": "^3.0.3",
Expand Down
9 changes: 6 additions & 3 deletions documentation/src/components/RightSidebar/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import type { MarkdownHeading } from 'astro';
import type { FunctionalComponent } from 'preact';
import { unescape } from 'html-escaper';
import { useState, useEffect, useRef } from 'preact/hooks';
import type { MouseEventHandler } from 'react';

type ItemOffsets = {
id: string;
topOffset: number;
};

const TableOfContents: FunctionalComponent<{ headings: MarkdownHeading[] }> = ({ headings = [] }) => {
const toc = useRef<HTMLUListElement>();
const toc = useRef<HTMLUListElement>(null);
const onThisPageID = 'on-this-page-heading';
const itemOffsets = useRef<ItemOffsets[]>([]);
const [currentID, setCurrentID] = useState('overview');
Expand Down Expand Up @@ -60,8 +61,10 @@ const TableOfContents: FunctionalComponent<{ headings: MarkdownHeading[] }> = ({
return () => headingsObserver.disconnect();
}, [toc.current]);

const onLinkClick = (e) => {
setCurrentID(e.target.getAttribute('href').replace('#', ''));
const onLinkClick: MouseEventHandler<HTMLAnchorElement> = (e) => {
const element = e.target as HTMLAnchorElement;
const href = element.getAttribute('href')?.replace('#', '');
if (href) setCurrentID(href);
};

return (
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"documentation": "pnpx astro dev --root ./documentation",
"shipit": "turbo run build && pnpm -r publish",
"pr-shipit": "turbo run build && pnpm --filter ...[origin/main] pr-release",
"dev": "turbo run dev --filter ./apps/**"
"dev": "turbo run dev --filter ./apps/**",
"bump-deps": "pnpm up --latest --prod --recursive --interactive"
},
"private": true,
"packageManager": "[email protected]",
"dependencies": {
"tslib": "^2.3.0"
"tslib": "^2.6.2"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
Expand Down
38 changes: 19 additions & 19 deletions packages/ag-grid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-ag-grid",
"version": "2.0.5",
"version": "3.0.0",
"type": "module",
"private": false,
"sideEffects": false,
Expand Down Expand Up @@ -32,25 +32,25 @@
}
},
"dependencies": {
"@ag-grid-community/client-side-row-model": "30.2.1",
"@ag-grid-community/core": "30.2.1",
"@ag-grid-community/react": "30.2.1",
"@ag-grid-enterprise/column-tool-panel": "30.2.1",
"@ag-grid-enterprise/excel-export": "30.2.1",
"@ag-grid-enterprise/filter-tool-panel": "30.2.1",
"@ag-grid-enterprise/master-detail": "30.2.1",
"@ag-grid-enterprise/menu": "30.2.1",
"@ag-grid-enterprise/multi-filter": "30.2.1",
"@ag-grid-enterprise/range-selection": "30.2.1",
"@ag-grid-enterprise/rich-select": "30.2.1",
"@ag-grid-enterprise/row-grouping": "30.2.1",
"@ag-grid-enterprise/server-side-row-model": "30.2.1",
"@ag-grid-enterprise/set-filter": "30.2.1",
"@ag-grid-enterprise/side-bar": "30.2.1",
"@ag-grid-enterprise/status-bar": "30.2.1",
"@ag-grid-community/client-side-row-model": "31.2.0",
"@ag-grid-community/core": "31.2.0",
"@ag-grid-community/react": "31.2.0",
"@ag-grid-enterprise/column-tool-panel": "31.2.0",
"@ag-grid-enterprise/excel-export": "31.2.0",
"@ag-grid-enterprise/filter-tool-panel": "31.2.0",
"@ag-grid-enterprise/master-detail": "31.2.0",
"@ag-grid-enterprise/menu": "31.2.0",
"@ag-grid-enterprise/multi-filter": "31.2.0",
"@ag-grid-enterprise/range-selection": "31.2.0",
"@ag-grid-enterprise/rich-select": "31.2.0",
"@ag-grid-enterprise/row-grouping": "31.2.0",
"@ag-grid-enterprise/server-side-row-model": "31.2.0",
"@ag-grid-enterprise/set-filter": "31.2.0",
"@ag-grid-enterprise/side-bar": "31.2.0",
"@ag-grid-enterprise/status-bar": "31.2.0",
"@equinor/eds-tokens": "^0.9.0",
"@equinor/fusion-react-ag-grid-styles": "^30.2.0",
"@equinor/fusion-react-styles": "^0.6.0",
"@equinor/eds-tokens": "^0.9.0"
"@equinor/fusion-react-styles": "^0.6.2"
},
"peerDependencies": {
"@ag-grid-enterprise/core": "30.2.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/filter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-filter",
"version": "3.0.10",
"version": "4.0.0",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down Expand Up @@ -29,11 +29,11 @@
"@equinor/eds-core-react": "^0.28.0",
"@equinor/eds-icons": "^0.18.0",
"@equinor/eds-tokens": "^0.9.0",
"@tanstack/react-query": "^4.28.0",
"react-error-boundary": "^3.1.4",
"@tanstack/react-query": "^5.28.9",
"react-error-boundary": "^4.0.13",
"react-sortablejs": "^6.1.4",
"react-virtual": "^2.10.4",
"sortablejs": "^1.15.0"
"sortablejs": "^1.15.2"
},
"peerDependencies": {
"react": ">= 16.8.0",
Expand Down
14 changes: 5 additions & 9 deletions packages/filter/src/lib/context/filterContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,11 @@ export const FilterContextWrapper = ({
const [uncheckedValues, setUncheckedValues] = useState<FilterStateGroup[]>(initialState?.uncheckedValues ?? []);
const [filterState, setFilterState] = useState<FilterState>(initialState?.filterState ?? { groups: [], search: '' });

const query = useQuery(
['filter-meta', JSON.stringify(filterState)],
({ signal }): Promise<FilterGroup[]> => dataSource.getFilterMeta(filterState, signal),
{
suspense: false,
useErrorBoundary: false,
keepPreviousData: true,
}
);
const query = useQuery({
queryKey: ['filter-meta', JSON.stringify(filterState)],
queryFn: ({ signal }): Promise<FilterGroup[]> => dataSource.getFilterMeta(filterState, signal),
throwOnError: false,
});

const setFilterStateHandler = (groups: FilterStateGroup[]) =>
setFilterState((s) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/garden/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-garden",
"version": "7.0.2",
"version": "8.0.0",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down Expand Up @@ -29,9 +29,9 @@
"@equinor/eds-core-react": "0.28.0",
"@equinor/eds-icons": "^0.18.0",
"@equinor/eds-tokens": "0.9.0",
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query-devtools": "^4.28.0",
"react-error-boundary": "^3.1.4",
"@tanstack/react-query": "^5.28.9",
"@tanstack/react-query-devtools": "^5.28.10",
"react-error-boundary": "^4.0.13",
"react-virtual": "^2.10.4"
},
"peerDependencies": {
Expand Down
36 changes: 16 additions & 20 deletions packages/garden/src/lib/context/gardenContext.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { PropsWithChildren, createContext, useCallback, useEffect, useState } from 'react';
import { GardenMeta, GetIdentifier } from '../types';
import { UseQueryResult, useQuery } from '@tanstack/react-query';
import { UseSuspenseQueryResult, useSuspenseQuery } from '@tanstack/react-query';
import { GardenDataSource } from '../components';

type GardenState = {
export type GardenState = {
selectionService: SelectionService;
groupingService: GroupingService;
gardenMetaQuery: UseQueryResult<GardenMeta, unknown>;
gardenMetaQuery: ThisType<UseSuspenseQueryResult<GardenMeta, unknown>>;
};

type GroupingService = {
Expand Down Expand Up @@ -34,23 +34,19 @@ export const GardenContextProvider = <T, TContext = undefined>(
context: TContext | undefined;
}>
) => {
const gardenMetaQuery = useQuery(
['garden', ...props.initialGrouping, props.timeInterval, props.dateVariant, props.context],
{
refetchOnWindowFocus: false,
suspense: true,
useErrorBoundary: true,
keepPreviousData: false,
cacheTime: Infinity,
staleTime: Infinity,
queryFn: ({ signal }) =>
props.dataSource.getGardenMeta(
{ groupingKeys: props.initialGrouping, timeInterval: props.timeInterval, dateVariant: props.dateVariant },
props.context as TContext,
signal ?? new AbortSignal()
),
}
);
const gardenMetaQuery = useSuspenseQuery({
queryKey: ['garden', ...props.initialGrouping, props.timeInterval, props.dateVariant, props.context],
queryFn: ({ signal }) => {
return props.dataSource.getGardenMeta(
{ groupingKeys: props.initialGrouping, timeInterval: props.timeInterval, dateVariant: props.dateVariant },
props.context as TContext,
signal ?? new AbortSignal()
);
},
refetchOnWindowFocus: false,
gcTime: Infinity,
staleTime: Infinity,
});

const selectionService = useSelectionService(props.getIdentifier, props.selected);
const groupingService = useGroupingService(props.initialGrouping, props.timeInterval, props.dateVariant);
Expand Down
2 changes: 1 addition & 1 deletion packages/garden/src/lib/hooks/useBlockCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function useBlockCache<T, TContext = undefined>({
groupingService: { groupingKeys, timeInterval, dateVariant },
} = useGarden();

const blockCache = useQueries({
const blockCache: UseBlockCacheArgs<T, TContext> = useQueries({
queries: blocks.map((block) => ({
/** Unique identifier for blocks, add state here to invalidate query onChange */
queryKey: [...groupingKeys, timeInterval, dateVariant, `x${block.x}`, `y${block.y}`, context, ...hash],
Expand Down
4 changes: 2 additions & 2 deletions packages/garden/src/lib/hooks/useGarden.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext } from 'react';
import { GardenContext } from '../context/gardenContext';
import { GardenContext, GardenState } from '../context/gardenContext';

export function useGarden() {
export function useGarden(): GardenState {
const context = useContext(GardenContext);
if (!context) {
throw new Error('Garden context called outside the provider');
Expand Down
14 changes: 7 additions & 7 deletions packages/power-bi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-powerbi",
"version": "2.0.2",
"version": "3.0.0",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down Expand Up @@ -29,14 +29,14 @@
"@equinor/eds-core-react": "^0.28.0",
"@equinor/eds-icons": "^0.18.0",
"@equinor/eds-tokens": "^0.9.0",
"@tanstack/react-query": "^4.24.4",
"markdown-to-jsx": "^7.1.9",
"powerbi-client": "^2.22.2",
"powerbi-client-react": "^1.3.5",
"react-error-boundary": "^3.1.4",
"@tanstack/react-query": "^5.28.9",
"markdown-to-jsx": "^7.4.5",
"powerbi-client": "^2.23.1",
"powerbi-client-react": "^1.4.0",
"react-error-boundary": "^4.0.13",
"react-sortablejs": "^6.1.4",
"react-virtual": "^2.10.4",
"sortablejs": "^1.15.0"
"sortablejs": "^1.15.2"
},
"peerDependencies": {
"react": ">= 16.8.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/power-bi/src/lib/components/PowerBi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
import { FusionEmbedConfig, FusionPowerBiToken } from '../types';

import { PowerBiController } from '../classes';
import { IBasicFilter } from 'index';
import { Report } from './report/Report';

import React from 'react';
import { models } from 'powerbi-client';

Icon.add({ chevron_down, chevron_up });

Expand All @@ -22,7 +23,7 @@ export interface PowerBiProps {
getToken: (reportUri: string, signal?: AbortSignal) => Promise<FusionPowerBiToken>;
getEmbedInfo: (reportUri: string, token: string, signal?: AbortSignal) => Promise<FusionEmbedConfig>;
ErrorComponent: React.ComponentType<ErrorComponentProps>;
filters?: IBasicFilter;
filters?: models.IBasicFilter;
bookmark?: string;
controller: PowerBiController;
}
Expand Down
Loading

0 comments on commit b16e935

Please sign in to comment.