Skip to content

Commit

Permalink
chore(@suspensive/utils): remove package (#1290)
Browse files Browse the repository at this point in the history
# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

## PR Checklist

- [ ] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
  • Loading branch information
manudeli authored Oct 3, 2024
1 parent 8bd5226 commit d84ee5c
Show file tree
Hide file tree
Showing 85 changed files with 283 additions and 348 deletions.
1 change: 0 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"commit": false,
"fixed": [
[
"@suspensive/utils",
"@suspensive/react",
"@suspensive/react-query",
"@suspensive/react-query-4",
Expand Down
10 changes: 10 additions & 0 deletions .changeset/wise-boxes-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@suspensive/react": patch
"@suspensive/jotai": patch
"@suspensive/react-dom": patch
"@suspensive/react-native": patch
"@suspensive/react-query-4": patch
"@suspensive/react-query-5": patch
---

chore(@suspensive/utils): remove package
2 changes: 0 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"@suspensive/utils":
- "packages/utils/**/*"
"@suspensive/react":
- "packages/react/**/*"
"@suspensive/react-dom":
Expand Down
4 changes: 0 additions & 4 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ ignore:

component_management:
individual_components:
- component_id: utils
name: '@suspensive/utils'
paths:
- packages/utils/**
- component_id: react
name: '@suspensive/react'
paths:
Expand Down
1 change: 0 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignoreWorkspaces": ["examples/**"],
"ignoreDependencies": ["@suspensive/utils"],
"workspaces": {
".": {
"ignore": ["packlint.config.mjs"]
Expand Down
3 changes: 0 additions & 3 deletions packages/jotai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"prepack": "pnpm build",
"test:ui": "vitest --ui --coverage --typecheck"
},
"dependencies": {
"@suspensive/utils": "workspace:*"
},
"devDependencies": {
"@suspensive/eslint-config": "workspace:*",
"@suspensive/tsconfig": "workspace:*",
Expand Down
3 changes: 0 additions & 3 deletions packages/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"prepack": "pnpm build",
"test:ui": "vitest --ui --coverage --typecheck"
},
"dependencies": {
"@suspensive/utils": "workspace:*"
},
"devDependencies": {
"@suspensive/eslint-config": "workspace:*",
"@suspensive/tsconfig": "workspace:*",
Expand Down
3 changes: 0 additions & 3 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"prepack": "pnpm build",
"test:ui": "jest --watchAll --coverage"
},
"dependencies": {
"@suspensive/utils": "workspace:*"
},
"devDependencies": {
"@suspensive/eslint-config": "workspace:*",
"@suspensive/tsconfig": "workspace:*",
Expand Down
3 changes: 0 additions & 3 deletions packages/react-query-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"prepack": "pnpm build",
"test:ui": "vitest --ui --coverage --typecheck"
},
"dependencies": {
"@suspensive/utils": "workspace:*"
},
"devDependencies": {
"@suspensive/eslint-config": "workspace:*",
"@suspensive/react": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { infiniteQueryOptions } from './infiniteQueryOptions'
import { PrefetchInfiniteQuery } from './PrefetchInfiniteQuery'
import { queryFn, queryKey } from './test-utils'

describe('<PrefetchInfiniteQuery/>', () => {
it('type check', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/PrefetchQuery.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { PrefetchQuery } from './PrefetchQuery'
import { queryOptions } from './queryOptions'
import { queryFn, queryKey } from './test-utils'

describe('<PrefetchQuery/>', () => {
it('type check', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { InfiniteData } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { infiniteQueryOptions } from './infiniteQueryOptions'
import { SuspenseInfiniteQuery } from './SuspenseInfiniteQuery'
import { queryFn, queryKey } from './test-utils'
import type { UseSuspenseInfiniteQueryResult } from './useSuspenseInfiniteQuery'

describe('<SuspenseInfiniteQuery/>', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/SuspenseQueries.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { queryOptions } from './queryOptions'
import { SuspenseQueries } from './SuspenseQueries'
import { queryFn, queryKey } from './test-utils'
import type { UseSuspenseQueryResult } from './useSuspenseQuery'

describe('<SuspenseQueries/>', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/SuspenseQuery.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { queryOptions } from './queryOptions'
import { SuspenseQuery } from './SuspenseQuery'
import { queryFn, queryKey } from './test-utils'
import type { UseSuspenseQueryResult } from './useSuspenseQuery'

describe('<SuspenseQuery/>', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/infiniteQueryOptions.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryKey } from '@suspensive/utils'
import { type InfiniteData, type UseInfiniteQueryResult, useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
import { describe, expectTypeOf, it } from 'vitest'
import { infiniteQueryOptions } from './infiniteQueryOptions'
import { SuspenseInfiniteQuery } from './SuspenseInfiniteQuery'
import { queryKey } from './test-utils'
import { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'
import { type UseSuspenseInfiniteQueryResult, useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery'

Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/infiniteQueryOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { OmitKeyof, RequiredKeyof } from '@suspensive/utils'
import type { InfiniteData, QueryKey, UseInfiniteQueryOptions } from '@tanstack/react-query'
import type { OmitKeyof, RequiredKeyof } from './utility-types'

export type SelectedInfiniteOptions<
TQueryFnData,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/queryOptions.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryKey } from '@suspensive/utils'
import { type UseQueryResult, useQueries, useQuery, useQueryClient } from '@tanstack/react-query'
import { describe, expectTypeOf, it } from 'vitest'
import { queryOptions } from './queryOptions'
import { SuspenseQuery } from './SuspenseQuery'
import { queryKey } from './test-utils'
import { usePrefetchQuery } from './usePrefetchQuery'
import { useSuspenseQueries } from './useSuspenseQueries'
import { type UseSuspenseQueryResult, useSuspenseQuery } from './useSuspenseQuery'
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/queryOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { OmitKeyof, RequiredKeyof } from '@suspensive/utils'
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query'
import type { OmitKeyof, RequiredKeyof } from './utility-types'

export type SelectedQueryOptions<
TQueryFnData = unknown,
Expand Down
4 changes: 4 additions & 0 deletions packages/react-query-4/src/test-utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const queryKey = ['key'] as const
const sleep = (ms: number) => new Promise<undefined>((resolve) => setTimeout(() => resolve(undefined), ms))
export const queryFn = () => sleep(10).then(() => ({ text: 'response' }))
export const select = (data: Awaited<ReturnType<typeof queryFn>>) => data.text
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { InfiniteData } from '@tanstack/react-query'
import { infiniteQueryOptions } from './infiniteQueryOptions'
import { queryFn, queryKey } from './test-utils'
import { type UseSuspenseInfiniteQueryResult, useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery'

describe('useSuspenseInfiniteQuery', () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/react-query-4/src/useSuspenseInfiniteQuery.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { OmitKeyof } from '@suspensive/utils'
import {
type InfiniteData,
type QueryKey,
type UseInfiniteQueryOptions,
type UseInfiniteQueryResult,
useInfiniteQuery,
} from '@tanstack/react-query'
import type { OmitKeyof } from './utility-types'

export interface UseSuspenseInfiniteQueryResult<TData = unknown, TError = unknown>
extends OmitKeyof<
Expand All @@ -16,15 +16,15 @@ export interface UseSuspenseInfiniteQueryResult<TData = unknown, TError = unknow
status: 'success'
}

export interface UseSuspenseInfiniteQueryOptions<
export type UseSuspenseInfiniteQueryOptions<
TQueryFnData = unknown,
TError = unknown,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
> extends OmitKeyof<
UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,
'suspense' | 'useErrorBoundary' | 'enabled' | 'placeholderData'
> {}
> = OmitKeyof<
UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,
'suspense' | 'useErrorBoundary' | 'enabled' | 'placeholderData'
>

/**
* This hook is wrapping useInfiniteQuery of `@tanstack/react-query` v4 with default suspense option.
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/useSuspenseQueries.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queryFn, queryKey, select } from '@suspensive/utils'
import { describe, expectTypeOf, it } from 'vitest'
import { queryOptions } from './queryOptions'
import { queryFn, queryKey, select } from './test-utils'
import { useSuspenseQueries } from './useSuspenseQueries'
import type { UseSuspenseQueryResult } from './useSuspenseQuery'

Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-4/src/useSuspenseQuery.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queryFn, queryKey } from '@suspensive/utils'
import { describe, expectTypeOf, it } from 'vitest'
import { queryOptions } from './queryOptions'
import { queryFn, queryKey } from './test-utils'
import { type UseSuspenseQueryResult, useSuspenseQuery } from './useSuspenseQuery'

describe('useSuspenseQuery', () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/react-query-4/src/useSuspenseQuery.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import type { OmitKeyof } from '@suspensive/utils'
import { type QueryKey, type UseQueryOptions, type UseQueryResult, useQuery } from '@tanstack/react-query'
import type { OmitKeyof } from './utility-types'

export interface UseSuspenseQueryResult<TData = unknown, TError = unknown>
extends OmitKeyof<UseQueryResult<TData, TError>, keyof Pick<UseQueryResult, 'isPlaceholderData'>> {
data: TData
status: 'success'
}

export interface UseSuspenseQueryOptions<
export type UseSuspenseQueryOptions<
TQueryFnData = unknown,
TError = unknown,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
> extends OmitKeyof<
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
'suspense' | 'useErrorBoundary' | 'enabled' | 'placeholderData'
> {}
> = OmitKeyof<
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
'suspense' | 'useErrorBoundary' | 'enabled' | 'placeholderData'
>

/**
* This hook is wrapping useQuery of `@tanstack/react-query` v4 with default suspense option.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions packages/react-query-4/src/utility-types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type { OmitKeyof } from './OmitKeyof'
export type { RequiredKeyof } from './RequiredKeyof'
3 changes: 0 additions & 3 deletions packages/react-query-5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"prepack": "pnpm build",
"test:ui": "vitest --ui --coverage --typecheck"
},
"dependencies": {
"@suspensive/utils": "workspace:*"
},
"devDependencies": {
"@suspensive/eslint-config": "workspace:*",
"@suspensive/react": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import { infiniteQueryOptions } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { PrefetchInfiniteQuery } from './PrefetchInfiniteQuery'
import { queryFn, queryKey } from './test-utils'

describe('<PrefetchInfiniteQuery/>', () => {
it('type check', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-5/src/PrefetchQuery.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { PrefetchQuery } from './PrefetchQuery'
import { queryOptions } from './queryOptions'
import { queryFn, queryKey } from './test-utils'

describe('<PrefetchQuery/>', () => {
it('type check', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { InfiniteData, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { SuspenseInfiniteQuery } from './SuspenseInfiniteQuery'
import { queryFn, queryKey } from './test-utils'

describe('<SuspenseInfiniteQuery/>', () => {
it('type check', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-5/src/SuspenseQueries.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { UseSuspenseQueryResult } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { SuspenseQueries } from './SuspenseQueries'
import { queryFn, queryKey } from './test-utils'

describe('<SuspenseQueries/>', () => {
it('type check', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-5/src/SuspenseQuery.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { queryFn, queryKey } from '@suspensive/utils'
import type { UseSuspenseQueryResult } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { SuspenseQuery } from './SuspenseQuery'
import { queryFn, queryKey } from './test-utils'

describe('<SuspenseQuery/>', () => {
it('type check', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/react-query-5/src/test-utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const queryKey = ['key'] as const
const sleep = (ms: number) => new Promise<undefined>((resolve) => setTimeout(() => resolve(undefined), ms))
export const queryFn = () => sleep(10).then(() => ({ text: 'response' }))
1 change: 0 additions & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"@commander-js/extra-typings": "^12.1.0",
"@suspensive/react-query-4": "workspace:^2.17.1",
"@suspensive/react-query-5": "workspace:^2.17.1",
"@suspensive/utils": "workspace:*",
"cli-table3": "^0.6.5",
"commander": "^12.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/src/scripts/utils/commands.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from 'fs'
import { noop } from '@suspensive/utils'
import type { Mock, MockInstance } from 'vitest'
import packageJson from '../../../package.json'
import { fixAction, statusAction, switchAction } from './commands'
import { noop } from './noop'
import {
getIndexFileContent,
getPackageJson,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/src/scripts/utils/copy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs'
import { noop } from '@suspensive/utils'
import { copy } from './copy'
import { noop } from './noop'

describe('copy', () => {
beforeEach(() => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-query/src/scripts/utils/noop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const noop = (): void => {}
3 changes: 0 additions & 3 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"prepack": "pnpm build",
"test:ui": "vitest --ui --coverage --typecheck"
},
"dependencies": {
"@suspensive/utils": "workspace:*"
},
"devDependencies": {
"@suspensive/eslint-config": "workspace:*",
"@suspensive/tsconfig": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/DefaultProps.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CustomError, FALLBACK, Suspend, TEXT } from '@suspensive/utils'
import { render, screen, waitFor } from '@testing-library/react'
import ms from 'ms'
import { createElement, useContext } from 'react'
Expand All @@ -7,6 +6,7 @@ import { DefaultProps, DefaultPropsProvider } from './DefaultProps'
import { Delay, type DelayProps } from './Delay'
import { Message_DefaultProp_delay_ms_should_be_greater_than_0, SuspensiveError } from './models/SuspensiveError'
import { Suspense, type SuspenseProps } from './Suspense'
import { CustomError, FALLBACK, Suspend, TEXT } from './test-utils'

const FALLBACK_GLOBAL = 'FALLBACK_GLOBAL'

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Delay.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CustomError, TEXT } from '@suspensive/utils'
import { render, screen, waitFor } from '@testing-library/react'
import ms from 'ms'
import { Delay } from './Delay'
import { Message_Delay_ms_prop_should_be_greater_than_or_equal_to_0, SuspensiveError } from './models/SuspensiveError'
import { CustomError, TEXT } from './test-utils'

beforeEach(() => {
vi.useFakeTimers({ shouldAdvanceTime: true })
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Delay.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTimeout } from '@suspensive/utils'
import { type PropsWithChildren, type ReactNode, useContext, useState } from 'react'
import { DelayDefaultPropsContext } from './contexts'
import { useTimeout } from './hooks'
import { Message_Delay_ms_prop_should_be_greater_than_or_equal_to_0, SuspensiveError } from './models/SuspensiveError'

export interface DelayProps extends PropsWithChildren {
Expand Down
Loading

0 comments on commit d84ee5c

Please sign in to comment.