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

Features/release checklist #42

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ tasks:
interactive: true
cmds:
- |
BASE_URL=dev.kloudlite.io
BASE_URL=devc.kloudlite.io
COOKIE_DOMAIN=".kloudlite.io"
GATEWAY_URL="http://gateway.karthik-testing.svc.cluster.local"
case {{.app}} in
"auth")
PORT=4000
Expand Down Expand Up @@ -38,7 +39,7 @@ tasks:
;;

"vision")
URL_SUFFIX="-vision"
URL_SUFFIX=""
;;

*)
Expand All @@ -47,18 +48,18 @@ tasks:

esac

REMIX_DEV_ORIGIN="https://{{.app}}$URL_SUFFIX.dev.kloudlite.io"
REMIX_DEV_ORIGIN="https://{{.app}}$URL_SUFFIX.devc.kloudlite.io"

cp -r ./static/common/. ./public/
cp -r ./static/{{.app}}/. ./public/

case "{{.tscheck}}" in
"no")
URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev
GATEWAY_URL=$GATEWAY_URL URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev
;;

*)
URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev & pnpm typecheck
GATEWAY_URL=$GATEWAY_URL URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev & pnpm typecheck
;;

esac
Expand Down Expand Up @@ -121,12 +122,12 @@ tasks:

case $(whoami) in
"bikash")
BASE_URL=dev.kloudlite.io
BASE_URL=devc.kloudlite.io
URL_SUFFIX=1
;;

"vision")
BASE_URL=dev.kloudlite.io
BASE_URL=devc.kloudlite.io
URL_SUFFIX="-vision"
;;

Expand Down
10 changes: 8 additions & 2 deletions lib/app-setup/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { TopBar } from '~/components/organisms/top-bar';
import styleZenerSelect from '@oshq/react-select/index.css';
import stylesUrl from '~/design-system/index.css';
import rcss from 'react-highlightjs-logs/dist/index.css';
import { isDev } from '../client/helpers/log';

export const links = () => [
{ rel: 'stylesheet', href: stylesUrl },
Expand Down Expand Up @@ -96,9 +97,14 @@ export function ErrorBoundary() {

if (error instanceof Error) {
return (
<ErrorWrapper message={error.message}>
<ErrorWrapper message={error.name}>
<code>
{typeof error.stack === 'string'
{/* eslint-disable-next-line no-nested-ternary */}
{isDev
? typeof error.stack === 'string'
? error.stack
: JSON.stringify(error.stack, null, 2)
: typeof error.stack === 'string'
? error.stack
: JSON.stringify(error.stack, null, 2)}
</code>
Expand Down
10 changes: 4 additions & 6 deletions lib/client/helpers/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const PostToHook = (message: string) => {
return {};
};

const isDev = getNodeEnv() === 'development';
export const isDev = getNodeEnv() === 'development';

const logger = {
time: isDev ? console.time : () => {},
Expand Down Expand Up @@ -98,11 +98,9 @@ const logger = {
console.trace(args);
}

// if (isDev && typeof window === 'undefined') {
// serverError(args);
// }

serverError(args);
if (isDev && typeof window === 'undefined') {
serverError(args);
}
},
};

Expand Down
24 changes: 20 additions & 4 deletions lib/server/helpers/execute-query-with-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,25 @@ export const ExecuteQueryWithContext = (
query: print(q),
variables: variables || {},
},
timeout: 5000,
});

let { data,errors } = resp.data;
if(errors){
throw new Error(JSON.stringify(errors))
let { data } = resp.data;
const { errors } = resp.data;

if (errors) {
const e = errors as Error[];
if (e.length === 1) {
throw errors[0];
}

throw new Error(
e.reduce((acc, curr) => {
return `${acc}\n\n1. ${curr.name ? `${curr.name}:` : ''}:${
curr.message
}${curr.stack ? `\n${curr.stack}` : ''}`;
}, 'Errors:')
);
}

if (data) {
Expand All @@ -97,11 +111,13 @@ export const ExecuteQueryWithContext = (
}
return { ...resp.data, data };
} catch (err) {
console.error('ErrorIn:', apiName, err);
if ((err as AxiosError).response) {
console.error('ErrorIn:', apiName, (err as Error).name);
return (err as AxiosError).response?.data;
}

console.error('ErrorIn:', apiName, (err as Error).message);

return {
errors: [
{
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import logger from '../client/helpers/log';

export const handleError = (e: unknown): void => {
const err = e as Error;
logger.error(e);
toast.error(err.message);
logger.error(e);
};

export const parseError = (e: unknown): Error => {
Expand Down
2 changes: 2 additions & 0 deletions src/apps/auth/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const links = () => {
return [...baseLinks(), { rel: 'stylesheet', href: authStylesUrl }];
};

export { ErrorBoundary } from '~/lib/app-setup/root';

const Layout = ({ children }: ChildrenProps) => {
return (
// <SSRProvider>
Expand Down
Loading