Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core refactor #601

Merged
merged 13 commits into from
Oct 21, 2021
7 changes: 7 additions & 0 deletions .changeset/fifty-bears-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@faustjs/core': patch
'@faustjs/next': patch
'@faustjs/react': patch
---

Refactored core exports and naming to make root namespace cleaner
1,498 changes: 692 additions & 806 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/core/api.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/cjs/api';
export * from './dist/cjs/export/api';
1 change: 1 addition & 0 deletions packages/core/auth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/cjs/export/auth';
1 change: 1 addition & 0 deletions packages/core/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/cjs/export/client';
1 change: 1 addition & 0 deletions packages/core/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/cjs/export/config';
46 changes: 31 additions & 15 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,33 @@
"name": "@faustjs/core",
"version": "0.12.3",
"description": "This module helps you use WordPress as a Headless CMS",
"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"
},
"./api": {
"import": "./dist/mjs/api.js",
"require": "./dist/cjs/api.js"
"import": "./dist/mjs/export/api.js",
"require": "./dist/cjs/export/api.js"
},
"./auth": {
"import": "./dist/mjs/export/auth.js",
"require": "./dist/cjs/export/auth.js"
},
"./client": {
"import": "./dist/mjs/export/client.js",
"require": "./dist/cjs/export/client.js"
},
"./config": {
"import": "./dist/mjs/export/config.js",
"require": "./dist/cjs/export/config.js"
},
"./utils": {
"import": "./dist/mjs/export/utils.js",
"require": "./dist/cjs/export/utils.js"
}
},
"scripts": {
Expand Down Expand Up @@ -54,29 +70,29 @@
"cookie": "^0.4.1"
},
"devDependencies": {
"@gqty/cli": "^2.1.0",
"@gqty/cli": "^2.1.1",
"@testing-library/jest-dom": "^5.14.1",
"@types/cookie": "^0.4.1",
"@types/is-number": "^7.0.1",
"@types/isomorphic-fetch": "^0.0.35",
"@types/jest": "^27.0.2",
"@types/lodash": "^4.14.175",
"@types/node": "^16.10.3",
"@types/webpack-env": "^1.16.2",
"@types/lodash": "^4.14.176",
"@types/node": "^16.11.1",
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"clean-webpack-plugin": "^4.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"jest": "^27.2.4",
"jest": "^27.3.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.5",
"ts-jest": "^27.0.7",
"ts-loader": "^9.2.6",
"typescript": "^4.4.3",
"typescript": "^4.4.4",
"fetch-mock": "9.11.0"
}
}
1 change: 0 additions & 1 deletion packages/core/src/api.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/auth/client/accessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function fetchAccessToken(code?: string): Promise<string | null> {

if (isNil(apiBasePath)) {
throw new Error(
'You must provide an apiBasePath value in your Headless config in order to use the fetchToken middleware',
'You must provide an apiBasePath value in your Faust.js config in order to use the fetchToken middleware',
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface Config extends Record<string, unknown> {
*
* @default /api/faust
* @type {string}
* @memberof HeadlessConfig
* @memberof Config
*/
apiBasePath?: string;

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/export/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../server';
1 change: 1 addition & 0 deletions packages/core/src/export/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../auth';
1 change: 1 addition & 0 deletions packages/core/src/export/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../gqty';
1 change: 1 addition & 0 deletions packages/core/src/export/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../config';
8 changes: 8 additions & 0 deletions packages/core/src/export/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export {
getClient,
ClientConfig,
ApiClient,
WithClient,
GqlClientSchema,
} from '../gqty';
export { Config, config } from '../config';
1 change: 1 addition & 0 deletions packages/core/src/export/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../utils';
2 changes: 1 addition & 1 deletion packages/core/src/gqty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export interface ClientConfig<
* @param {string} url
* @param {RequestInit} init
* @returns {RequestContext}
* @memberof HeadlessConfig
* @memberof ClientConfig
*/
applyRequestContext?(
url: string,
Expand Down
Loading