Skip to content

Commit

Permalink
feat: (#591) migrating to src/gqty and exposing @faustjs/next/client
Browse files Browse the repository at this point in the history
  • Loading branch information
wjohnsto committed Oct 22, 2021
1 parent bb466b8 commit 38888e8
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 21 deletions.
1 change: 1 addition & 0 deletions packages/next/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/cjs/export/client';
14 changes: 9 additions & 5 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"name": "@faustjs/next",
"version": "0.12.4",
"description": "This module helps you use WordPress as a Headless CMS with Next.js",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
"types": "dist/cjs/index.d.ts",
"main": "dist/cjs/export/index.js",
"module": "dist/mjs/export/index.js",
"types": "dist/cjs/export/index.d.ts",
"exports": {
".": {
"import": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/mjs/export/index.js",
"require": "./dist/cjs/export/index.js"
},
"./client": {
"import": "./dist/mjs/export/client.js",
"require": "./dist/cjs/export/client.js"
}
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/HeadlessProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import isNil from 'lodash/isNil';
import React from 'react';
import type { getClient } from './client';
import type { getClient } from './gqty/client';
import {
AUTH_CLIENT_CACHE_PROP,
CLIENT_CACHE_PROP,
PageProps,
} from './getProps';
import { HeadlessContext } from './client';
import { HeadlessContext } from './gqty/client';

/**
* The HeadlessProvider is a React component required to properly facilitate SSR and SSG for Faust.js.
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/export/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../gqty';
7 changes: 7 additions & 0 deletions packages/next/src/export/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from '../gqty/client';
export * from '../config';
export * from '../getProps';
export * from '../HeadlessProvider';
export * from '../utils';
export * from '../withFaust';
export * from '../log';
2 changes: 1 addition & 1 deletion packages/next/src/getProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { RouterContext } from 'next/dist/shared/lib/router-context';

import React, { FunctionComponent, ComponentClass } from 'react';
import { config } from './config';
import { getClient, HeadlessContext } from './client';
import { getClient, HeadlessContext } from './gqty/client';

import {
hasCategoryId,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { RequiredSchema } from '@faustjs/react';
import { useRouter } from 'next/router';
import isString from 'lodash/isString';
import defaults from 'lodash/defaults';
import { hasCategoryId, hasCategorySlug } from '../utils';
import { hasCategoryId, hasCategorySlug } from '../../utils';
import type { NextClientHooks } from '.';

export function create<Schema extends RequiredSchema>(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { RequiredSchema } from '@faustjs/react';
import { useRouter } from 'next/router';
import defaults from 'lodash/defaults';
import isString from 'lodash/isString';
import { hasPageId, hasPageUri } from '../utils';
import { hasPageId, hasPageUri } from '../../utils';
import type { NextClientHooks } from '.';

export function create<Schema extends RequiredSchema>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { RequiredSchema } from '@faustjs/react';
import { useRouter } from 'next/router';
import defaults from 'lodash/defaults';
import isString from 'lodash/isString';
import { hasPostId, hasPostSlug, hasPostUri } from '../utils';
import { hasPostId, hasPostSlug, hasPostUri } from '../../utils';
import type { NextClientHooks } from '.';

export function create<Schema extends RequiredSchema>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RequiredSchema } from '@faustjs/react';
import { useRouter } from 'next/router';
import defaults from 'lodash/defaults';
import { hasCategoryId, hasCategorySlug } from '../utils';
import { hasCategoryId, hasCategorySlug } from '../../utils';
import type { NextClientHooks } from '.';

export function create<Schema extends RequiredSchema>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PageIdType, PostIdType } from '@faustjs/core/client';
import type { RequiredSchema } from '@faustjs/react';
import isUndefined from 'lodash/isUndefined';
import { useRouter } from 'next/router';
import { hasPageId, hasPostId } from '../utils';
import { hasPageId, hasPostId } from '../../utils';
import type { NextClientHooks, NextClientHooksWithAuth } from '.';

export type UsePreviewResponse<Schema extends RequiredSchema> =
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions packages/next/src/gqty/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './client';
export * from './hooks';
7 changes: 0 additions & 7 deletions packages/next/src/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/next/src/log.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { LoggerOptions } from '@gqty/logger';
import defaults from 'lodash/defaults';
import type { NextClient } from './client';
import type { NextClient } from './gqty/client';

export async function logQueries(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit 38888e8

Please sign in to comment.