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

Universe: use Relay 13 and the new Rust Compiler #2119

Merged
merged 1 commit into from
Jan 7, 2022
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
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
node_modules/

src/babel-preset-adeira/src/__tests__/__fixtures__
src/example-relay/__github__/flow-typed
src/sx-tailwind-website/__github__/flow-typed

# https://github.com/prettier/prettier/issues/6102
**/__generated__/*.graphql.js

# https://github.com/eslint/eslint/issues/8429
!**/.storybook
6 changes: 6 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,9 @@ suppress_type=$FlowFixMe
; This option is always ON in the strict mode. We are enabling it even for the classic mode.
; Function parameters are considered const (i.e., treated as if they were declared with const rather than let).
experimental.const_params=true

relay_integration=true
relay_integration.module_prefix=./__generated__/
; TODO: consider removing the following excludes
relay_integration.excludes=.*/__tests__/.*
relay_integration.excludes=.*/__flowtests__/.*
42 changes: 42 additions & 0 deletions relay.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @flow strict

module.exports = {
root: '.',
sources: {
'src/abacus-backoffice': 'abacus',
'src/abacus-kochka': 'abacus',
'src/example-relay': 'example-relay',
},
excludes: ['**/__flowtests__/**'],
codegenCommand: './node_modules/.bin/relay-compiler',
projects: {
'abacus': {
language: 'flow',
flowEnums: [
// TODO: doesn't work (https://github.com/facebook/relay/issues/3596#issuecomment-1003148218)
'SupportedCurrency',
'SupportedLocale',
],
flowTypegen: {
phase: 'Compat', // TODO: "Final"
},
schema: 'src/abacus/schema.graphql',
customScalarTypes: {
ProductImageUploadable: 'string',
},
testPathRegex: '__tests__',
featureFlags: {
no_inline: { kind: 'enabled' },
},
},
'example-relay': {
language: 'flow',
flowTypegen: {
phase: 'Compat', // TODO: "Final"
},
schema: 'src/example-relay/schema.graphql',
schemaExtensions: ['src/example-relay/src/LocalForm'],
},
},
isDevVariableName: '__DEV__',
};
11 changes: 0 additions & 11 deletions src/abacus-backoffice/relay.config.js

This file was deleted.

7 changes: 3 additions & 4 deletions src/abacus-backoffice/src/NavigationHeaderBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import React, { type Node } from 'react';
import sx from '@adeira/sx';
import { graphql, useLazyLoadQuery } from '@adeira/relay';

import type { NavigationHeaderBadgeQuery } from './__generated__/NavigationHeaderBadgeQuery.graphql';

function ProdBadge(): Node {
return <span className={styles('prod')}>PROD</span>;
}
Expand All @@ -15,7 +13,8 @@ function DevBadge(): Node {
}

export default function NavigationHeaderBadge(): Node {
const data = useLazyLoadQuery<NavigationHeaderBadgeQuery>(
// eslint-disable-next-line relay/generated-flow-types -- https://github.com/relayjs/eslint-plugin-relay/issues/131
const data = useLazyLoadQuery(
graphql`
query NavigationHeaderBadgeQuery {
auth {
Expand All @@ -25,7 +24,7 @@ export default function NavigationHeaderBadge(): Node {
}
}
`,
{},
Object.freeze({}),
{
fetchPolicy: 'store-or-network',
},
Expand Down

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

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

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

5 changes: 2 additions & 3 deletions src/abacus-backoffice/src/analytics/AnalyticsRedirectsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { Badge, Link, Table } from '@adeira/sx-design';
import React, { type Node } from 'react';
import { useLazyLoadQuery, graphql } from '@adeira/relay';

import type { AnalyticsRedirectsPageQuery } from './__generated__/AnalyticsRedirectsPageQuery.graphql';

export default function AnalyticsRedirectsPage(): Node {
const { analytics } = useLazyLoadQuery<AnalyticsRedirectsPageQuery>(graphql`
// eslint-disable-next-line relay/generated-flow-types -- https://github.com/relayjs/eslint-plugin-relay/issues/131
const { analytics } = useLazyLoadQuery(graphql`
query AnalyticsRedirectsPageQuery {
analytics {
redirectHits {
Expand Down
Loading