Skip to content

Commit

Permalink
Rename planx-client to core (#1463)
Browse files Browse the repository at this point in the history
  • Loading branch information
builditben authored Feb 20, 2023
1 parent e34a404 commit 1412d9f
Show file tree
Hide file tree
Showing 36 changed files with 95 additions and 119 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- run: pnpm distribute ../api.planx.uk
working-directory: planx-client
working-directory: core
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: api.planx.uk
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- run: pnpm distribute ../${{ env.EDITOR_DIRECTORY }}
working-directory: planx-client
working-directory: core
- run: pnpm install --frozen-lockfile
working-directory: ${{ env.EDITOR_DIRECTORY }}
- run: pnpm build
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
cache-dependency-path: "**/pnpm-lock.yaml"
- run: pnpm distribute ../${{ env.EDITOR_DIRECTORY }}
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
working-directory: planx-client
working-directory: core
- run: pnpm install --frozen-lockfile
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
working-directory: ${{ env.EDITOR_DIRECTORY }}
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
cache-dependency-path: "**/pnpm-lock.yaml"
- run: pnpm distribute ../${{ env.EDITOR_DIRECTORY }}
if: steps.cache-storybook-assets.outputs.cache-hit != 'true'
working-directory: planx-client
working-directory: core
- run: pnpm install --frozen-lockfile
if: steps.cache-storybook-assets.outputs.cache-hit != 'true'
working-directory: ${{ env.EDITOR_DIRECTORY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
${{ runner.os }}-
- run: npm install -g pnpm@${{ env.PNPM_VERSION }}
- run: pnpm distribute ../editor.planx.uk
working-directory: planx-client
working-directory: core
- run: pnpm install --frozen-lockfile
working-directory: editor.planx.uk
- run: pnpm build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
${{ runner.os }}-
- run: npm install -g pnpm@${{ env.PNPM_VERSION }}
- run: pnpm distribute ../editor.planx.uk
working-directory: planx-client
working-directory: core
- run: pnpm install --frozen-lockfile
working-directory: editor.planx.uk
- run: pnpm build
Expand Down
4 changes: 2 additions & 2 deletions api.planx.uk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUN npm install -g [email protected]

# install cachable shared package
COPY shared ./shared
RUN pnpm install ./shared/planx-client*
RUN cd node_modules/planx-client && pnpm install && pnpm build
RUN pnpm install ./shared/core*
RUN cd node_modules/core && pnpm install && pnpm build

# update package cache using lockfile
# see https://pnpm.io/cli/fetch
Expand Down
9 changes: 4 additions & 5 deletions api.planx.uk/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Client } from "planx-client";
import { CoreDomainClient } from "core";
/**
* The planx-client doesn't expose a graphql interface like the graphql/hasura clients do
* core doesn't expose a graphql interface like the graphql/hasura clients do
* instead, they encapsulates query and business logic to only expose declarative interfaces
*/
export const adminClient = new Client({
export const _admin = new CoreDomainClient({
hasuraSecret: process.env.HASURA_GRAPHQL_ADMIN_SECRET!,
targetURL: process.env.HASURA_GRAPHQL_URL!,
});

export const publicClient = new Client({
hasuraSecret: "",
export const _public = new CoreDomainClient({
targetURL: process.env.HASURA_GRAPHQL_URL!,
});
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"passport": "^0.5.3",
"passport-google-oauth20": "^2.0.0",
"pino-noir": "^2.2.1",
"planx-client": "file:shared/planx-client-1.0.0.tgz",
"core": "file:shared/core-1.0.0.tgz",
"slack-notify": "^2.0.3",
"string-to-stream": "^3.0.1"
},
Expand Down
50 changes: 19 additions & 31 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added api.planx.uk/shared/core-1.0.0.tgz
Binary file not shown.
Binary file removed api.planx.uk/shared/planx-client-1.0.0.tgz
Binary file not shown.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions planx-client/README.md → core/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PlanX Client
# PlanX Core

This package is a declarative boundary between the data access layer (GraphQL/Hasura/Postgres) and the PlanX domain.

Currently, this package is not published but it is copied and linked to project folders (i.e. `pnpm link planx-client`).
Currently, this package is not published but it is copied and linked to project folders (i.e. `pnpm link core`).

To Update, run `pnpm distribute` which will build and install a local version of this package into each dependent project.
Optionally, you can distribute (copy files) to a specific location with `pnpm distribute ../api.planx.uk` (where the last argument is a relative path to a directory from the project root).
Expand Down
2 changes: 1 addition & 1 deletion planx-client/package.json → core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "planx-client",
"name": "core",
"private": true,
"version": "1.0.0",
"description": "A declarative interface for PlanX data operations",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ do
mkdir -p ${destination}/shared

# remove any previous version
rm -rf ${destination}/node_modules/planx-client
rm -rf ${destination}/shared/planx-client*
rm -rf ${destination}/node_modules/core
rm -rf ${destination}/shared/core*

# install a current build
cp -f ${pack} ${destination}/shared
cd ${destination}
pnpm add ./shared/${pack}
cd ${destination}/node_modules/planx-client
cd ${destination}/node_modules/core
pnpm install --frozen-lockfile
pnpm build
cd ${project_root}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion planx-client/src/index.ts → core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getDocumentTemplateNames } from "./document-templates";

const defaultURL = process.env.HASURA_GRAPHQL_URL;

export class Client {
export class CoreDomainClient {
client: GraphQLClient;

constructor(args: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion e2e/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPT_DIR=$(dirname "$0")

set -e

(cd "${SCRIPT_DIR}/../planx-client" && pnpm install && pnpm build && pnpm distribute)
(cd "${SCRIPT_DIR}/../core" && pnpm install && pnpm build && pnpm distribute)
(cd "${SCRIPT_DIR}/../editor.planx.uk" && pnpm install && pnpm build)

if [ -z "${CI}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"graphql-request": "^5.1.0",
"isomorphic-fetch": "^3.0.0",
"jsonwebtoken": "^8.5.1",
"planx-client": "link:../planx-client",
"core": "link:../core",
"serve": "^14.1.2"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1412d9f

Please sign in to comment.