Skip to content

Commit

Permalink
chore(scope): Change scope to @brainly-gene
Browse files Browse the repository at this point in the history
  • Loading branch information
krzotki committed Nov 4, 2024
1 parent 51803f1 commit 308e7d9
Show file tree
Hide file tree
Showing 160 changed files with 349 additions and 412 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/generators-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,51 @@ jobs:
matrix:
config:
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:core-module --name my-module --directory examples --tags domain:social-qa && pnpm nx test examples-modules-my-module-module',
packageCommand: 'pnpm nx g @brainly-gene/tools:core-module --name my-module --directory examples --tags domain:social-qa && pnpm nx test examples-modules-my-module-module',
successRegexp: 'Successfully ran target test for project examples-modules-my-module-module',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:core-module --name my-module --directory examples --tags domain:social-qa && pnpm nx lint examples-modules-my-module-module',
packageCommand: 'pnpm nx g @brainly-gene/tools:core-module --name my-module --directory examples --tags domain:social-qa && pnpm nx lint examples-modules-my-module-module',
successRegexp: 'Successfully ran target lint for project examples-modules-my-module-module',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:core-module --name my-module --directory examples --tags domain:social-qa && pnpm nx e2e examples-modules-my-module-module-e2e --verbose',
packageCommand: 'pnpm nx g @brainly-gene/tools:core-module --name my-module --directory examples --tags domain:social-qa && pnpm nx e2e examples-modules-my-module-module-e2e --verbose',
successRegexp: 'Successfully ran target e2e for project examples-modules-my-module-module-e2e',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:components-library --name my-components --directory examples --tags domain:social-qa && pnpm nx test examples-components-my-components-ui',
packageCommand: 'pnpm nx g @brainly-gene/tools:components-library --name my-components --directory examples --tags domain:social-qa && pnpm nx test examples-components-my-components-ui',
successRegexp: 'Successfully ran target test for project examples-components-my-components-ui',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:components-library --name my-components --directory examples --tags domain:social-qa && pnpm nx lint examples-components-my-components-ui',
packageCommand: 'pnpm nx g @brainly-gene/tools:components-library --name my-components --directory examples --tags domain:social-qa && pnpm nx lint examples-components-my-components-ui',
successRegexp: 'Successfully ran target lint for project examples-components-my-components-ui',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:service --name=my-data --directory=my-feature/services --serviceType=apollo --tags=domain:social-qa && pnpm nx lint my-feature-services-my-data-service',
packageCommand: 'pnpm nx g @brainly-gene/tools:service --name=my-data --directory=my-feature/services --serviceType=apollo --tags=domain:social-qa && pnpm nx lint my-feature-services-my-data-service',
successRegexp: 'Successfully ran target lint for project my-feature-services-my-data-service',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:service --name=my-data --directory=my-feature/services --serviceType=apollo --tags=domain:social-qa && pnpm nx test my-feature-services-my-data-service',
packageCommand: 'pnpm nx g @brainly-gene/tools:service --name=my-data --directory=my-feature/services --serviceType=apollo --tags=domain:social-qa && pnpm nx test my-feature-services-my-data-service',
successRegexp: 'Successfully ran target test for project my-feature-services-my-data-service',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:service --name=my-data --directory=my-feature/services --serviceType=react-query --tags=domain:social-qa && pnpm nx lint my-feature-services-my-data-service',
packageCommand: 'pnpm nx g @brainly-gene/tools:service --name=my-data --directory=my-feature/services --serviceType=react-query --tags=domain:social-qa && pnpm nx lint my-feature-services-my-data-service',
successRegexp: 'Successfully ran target lint for project my-feature-services-my-data-service',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:service --name=my-data --directory=my-feature/services --serviceType=react-query --tags=domain:social-qa && pnpm nx test my-feature-services-my-data-service',
packageCommand: 'pnpm nx g @brainly-gene/tools:service --name=my-data --directory=my-feature/services --serviceType=react-query --tags=domain:social-qa && pnpm nx test my-feature-services-my-data-service',
successRegexp: 'Successfully ran target test for project my-feature-services-my-data-service',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:nextjs-app --name=my-app --directory=example --tags=domain:social-qa --rewrites=true --apollo=true --reactQuery=true --e2e=true && NODE_OPTIONS="--max-old-space-size=8192" pnpm nx e2e example-my-app-e2e --verbose',
packageCommand: 'pnpm nx g @brainly-gene/tools:nextjs-app --name=my-app --directory=example --tags=domain:social-qa --rewrites=true --apollo=true --reactQuery=true --e2e=true && NODE_OPTIONS="--max-old-space-size=8192" pnpm nx e2e example-my-app-e2e --verbose',
successRegexp: 'Successfully ran target e2e for project example-my-app-e2e',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:nextjs-app --name=my-app --directory=example --tags=domain:social-qa --rewrites=true --apollo=true --reactQuery=true --e2e=true && pnpm nx test example-my-app',
packageCommand: 'pnpm nx g @brainly-gene/tools:nextjs-app --name=my-app --directory=example --tags=domain:social-qa --rewrites=true --apollo=true --reactQuery=true --e2e=true && pnpm nx test example-my-app',
successRegexp: 'Successfully ran target test for project example-my-app',
}
- {
packageCommand: 'pnpm nx g @brainly/gene-tools:nextjs-app --name=my-app --directory=example --tags=domain:social-qa --rewrites=true --apollo=true --reactQuery=true --e2e=true && pnpm nx lint example-my-app',
packageCommand: 'pnpm nx g @brainly-gene/tools:nextjs-app --name=my-app --directory=example --tags=domain:social-qa --rewrites=true --apollo=true --reactQuery=true --e2e=true && pnpm nx lint example-my-app',
successRegexp: 'Successfully ran target lint for project example-my-app',
}
steps:
Expand Down
2 changes: 1 addition & 1 deletion README copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
To run gene generator inside this repo:

```sh
nx g @brainly/gene-tools:nextjs-app --name=my-test --directory=test-dir --tags=domain:test --rewrites=true --apollo=true --reactQuery=true --e2e=true --verbose
nx g @brainly-gene/tools:nextjs-app --name=my-test --directory=test-dir --tags=domain:test --rewrites=true --apollo=true --reactQuery=true --e2e=true --verbose
```

It uses the code under packages/braniac-tools/generators, so there is no need to build the package.
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/backend-for-frontend/create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ title: Backend for Frontend (BFF) - Create a New BFF
The following command generates a new Backend for Frontend (BFF) application with customizable configurations:

```bash
nx generate @brainly/gene-tools:bff-app
nx generate @brainly-gene/tools:bff-app
```

**Generator Code:** [View on GitHub](https://github.com/brainly/gene/blob/master/packages/gene-tools/src/generators/bff-app/README.md)
Expand All @@ -21,7 +21,7 @@ nx generate @brainly/gene-tools:bff-app
Running the command above initiates a prompt to gather the required details for setting up your BFF. Below is an example of the command flow:

```bash
> NX Generating @brainly/gene-tools:bff-app
> NX Generating @brainly-gene/tools:bff-app

✔ What is the BFF name? (e.g. web, ios, android) · my-first-bff
✔ Application tittle · Example BFF Application
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/backend-for-frontend/handlers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ bff-dir

```typescript
import cors from 'cors';
import { apiHandlerConnect } from '@brainly/gene-next';
import { apiHandlerConnect } from '@brainly-gene/next';
import {
getQuestion,
postQuestion,
Expand All @@ -50,7 +50,7 @@ export default apiHandlerConnect()

```typescript
import cors from 'cors';
import { apiHandlerConnect } from '@brainly/gene-next';
import { apiHandlerConnect } from '@brainly-gene/next';
import {
getUser,
deleteUser
Expand Down
20 changes: 10 additions & 10 deletions docs/docs-site/pages/gene/cheatsheet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,61 @@ All of the generators used inside of a terminal are step-based to ease the way o
#### Module Generator 🎁

```shell copy
nx g @brainly/gene-tools:module
nx g @brainly-gene/tools:module
```

#### Core Module Generator 🎁

```shell copy
nx g @brainly/gene-tools:core-module
nx g @brainly-gene/tools:core-module
```

#### NextJS App Generator 💻

```shell copy
nx g @brainly/gene-tools:nextjs-app
nx g @brainly-gene/tools:nextjs-app
```

#### Library Generator 📕

```shell copy
nx g @brainly/gene-tools:library
nx g @brainly-gene/tools:library
```

#### Service Generator

```shell copy
nx generate @brainly/gene-tools:service
nx generate @brainly-gene/tools:service
```

#### Subapp Generator

```shell copy
nx g @brainly/gene-tools:subapp
nx g @brainly-gene/tools:subapp
```

If you have issues with jest tests failing such as `SyntaxError: Cannot use import statement outside a module`, check if your newly generated `jest.config` doesn't have a line with `transform`. If so, remove it.

#### UI Library Generator 📙

```shell copy
nx g @brainly/gene-tools:components-library
nx g @brainly-gene/tools:components-library
```

#### Component Generator 🧩

```shell copy
nx g @brainly/gene-tools:component
nx g @brainly-gene/tools:component
```

#### API Route Generator 🚏

```shell copy
nx g @brainly/gene-tools:api-route
nx g @brainly-gene/tools:api-route
```

#### BFF App Generator

```shell copy
nx g @brainly/gene-tools:bff-app
nx g @brainly-gene/tools:bff-app
```
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/components/create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import Image from 'next/image';
The target library for your new component must be created with the [components-library-generator](https://github.com/brainly/gene/blob/master/packages/gene-tools/src/generators/components-library-generator/README.md). If the library does not exist, you can generate a new one with the following command:

```shell
npx nx g @brainly/gene-tools:components-library
npx nx g @brainly-gene/tools:components-library
```

### Creating a Component

To create a component, use the NX plugin's [component-generator](https://github.com/brainly/gene/blob/master/packages/gene-tools/src/generators/component-generator/README.md) or run the following command in the CLI:

```shell
npx nx g @brainly/gene-tools:component --library=my-components-ui
npx nx g @brainly-gene/tools:component --library=my-components-ui
```

**Generator Options:**
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/components/event-delegation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This approach helps avoid prop drilling between nested components and keeps appl
Gene provides a `dispatch` method to handle proper event delegation:

```jsx
import { dispatch } from '@brainly/gene'
import { dispatch } from '@brainly-gene/core'

export function MyButton({ text }) {
const handleClick = React.useCallback((e) => {
Expand All @@ -50,7 +50,7 @@ To simplify event handling, Gene provides a `useMediator` hook, which manages ev
### Example Usage

```jsx
import { useMediator } from '@brainly/gene'
import { useMediator } from '@brainly-gene/core'
import { useRef } from 'react'

function MyApp() {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs-site/pages/gene/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ code .
### Generate a new Next.js app

```sh copy
pnpm nx g @brainly/gene-tools:next-app --name my-first-app --no-interactive
pnpm nx g @brainly-gene/tools:next-app --name my-first-app --no-interactive
```

### Run the app 🥳
Expand Down
2 changes: 1 addition & 1 deletion docs/docs-site/pages/gene/modules/branching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Based on these assumptions, the following steps should be conducted to use `Cust
Core module library can be generated using the NX generator:

```shell copy
nx g @brainly/gene-tools:core-module
nx g @brainly-gene/tools:core-module
```

The structure after application changes can be visualized as below:
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/modules/contexts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If you want to use context in your module we are recommending usage of `makeStor
Example context:

```tsx
import {makeStore} from '@brainly/gene';
import {makeStore} from '@brainly-gene/core';

export enum Actions {
UPDATE_HELLO,
Expand Down Expand Up @@ -77,7 +77,7 @@ To be able to use context on module level, you need to wrap your module with pro
all providers for modules:

```jsx
import {createGeneModule} from '@brainly/gene';
import {createGeneModule} from '@brainly-gene/core';
import {StoreProvider, AnotherStoreProvider} from './contexts';
import {MyModule as RawMyModule} from './MyModule';

Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/modules/custom-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Let's assume the starting point for working on the custom hooks example is a sim
```tsx filename="SimpleModule.tsx" showLineNumbers
import {Foo, Loading, FooButtonClick, FooEventsType, FooPropsType} from "@acme/components/simple-ui";
import {useServiceAbc, AbcType} from "@acme/services/service-abc";
import {useMediator} from '@brainly/gene'
import {useMediator} from '@brainly-gene/core'

type TransformedAbcType = {
items: Array<number>;
Expand Down Expand Up @@ -178,7 +178,7 @@ First, let's handle the `Foo` component with a custom hook. The custom hook will
```tsx filename="/hooks/useFoo.ts"
import {FooButtonClick, FooEventsType, FooPropsType} from "@acme/components/simple-ui";
import {useServiceAbc, AbcType} from "@acme/services/service-abc";
import {useMediator} from '@brainly/gene'
import {useMediator} from '@brainly-gene/core'
import * as React from "react";

type TransformedAbcType = {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/modules/dependencies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It means that whenever you will be rendering this module you need to inject rout
You can define your interface in module, let's take router example:

```jsx
import {useInjection} from '@brainly/gene';
import {useInjection} from '@brainly-gene/core';

// define interface to type it
export interface SimpleRouter {
Expand All @@ -46,7 +46,7 @@ This is how the module looks; now let's try to render it in a NextJS application
```jsx filename="pages/simple.tsx"
import {SimpleModule, SimpleRouter, RouterIdentifier} from '@acme/simple-module';
import {Container} from 'inversify';
import {withIoc} from '@brainly/gene';
import {withIoc} from '@brainly-gene/core';
import {useRouter} from 'next/router';

// we have to create container getter which will bind router
Expand Down
8 changes: 4 additions & 4 deletions docs/docs-site/pages/gene/modules/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Image from 'next/image'
To create a module use generator (use NX plugin and choose [module-generator](https://github.com/brainly/gene/blob/master/packages/gene-tools/src/generators/module-generator/README.md)) or write command in CLI:

```shell copy
nx g @brainly/gene-tools:module
nx g @brainly-gene/tools:module
```

The generator will ask for the application for which the module should be created and the module name. The concept of using modules exclusively by the app is developed in [branching section](/gene/modules/branching). For now, let's focus on the development of the generic module.
Expand Down Expand Up @@ -193,7 +193,7 @@ The next step is to handle side effects. In Gene, there might be several sources
```tsx filename="SimpleModule.tsx" {1,3,39..45,52,62,65}
import {FooButtonClick, FooEventsType} from "@acme/components/simple-ui";
import {useServiceAbc, AbcType} from "@acme/services/service-abc";
import {useMediator} from '@brainly/gene'
import {useMediator} from '@brainly-gene/core'

type TransformedAbcType = {
items: Array<number>;
Expand Down Expand Up @@ -277,7 +277,7 @@ The last piece of the module is the rendering. In this simple scenario, the modu
```tsx filename="SimpleModule.tsx" {1, 68..74}
import {Foo, Loading, FooButtonClick, FooEventsType} from "@acme/components/simple-ui";
import {useServiceAbc, AbcType} from "@acme/services/service-abc";
import {useMediator} from '@brainly/gene'
import {useMediator} from '@brainly-gene/core'

type TransformedAbcType = {
items: Array<number>;
Expand Down Expand Up @@ -385,7 +385,7 @@ The component map allows for gathering props for the component into a single obj
```tsx filename="SimpleModule.tsx" showLineNumbers {1,27,57..64,73,82,87,91}
import {Foo, Loading, FooButtonClick, FooEventsType, FooPropsType} from "@acme/components/simple-ui";
import {useServiceAbc, AbcType} from "@acme/services/service-abc";
import {useMediator} from '@brainly/gene'
import {useMediator} from '@brainly-gene/core'

type TransformedAbcType = {
items: Array<number>;
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-site/pages/gene/modules/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ context. This design choice promotes reusability and flexibility in various appl


```tsx filename="SimpleModule.tsx" {8,9,10,12,13,14}
import { useInjection } from '@brainly/gene';
import { useInjection } from '@brainly-gene/core';
import {
ROUTER_SERVICE_IDENTIFIER,
RouterIocType,
} from '@brainly/gene';
} from '@brainly-gene/core';

const useInit = () => {
const {navigate} = useInjection<RouterIocType>(
Expand Down
2 changes: 1 addition & 1 deletion docs/docs-site/pages/gene/modules/storybook-providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ title: Storybook Providers
To use `StorybookProviders`, generate it with the following `nx` command:

```bash
nx g @brainly/gene-tools:e2e-providers
nx g @brainly-gene/tools:e2e-providers
```

Then import it in your Storybook file:
Expand Down
8 changes: 4 additions & 4 deletions docs/docs-site/pages/gene/services/apollo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Callout } from 'nextra-theme-docs';
[Generator code](https://github.com/brainly/gene/blob/master/packages/gene-tools/src/generators/service-generator/README.md)

```bash
nx generate @brainly/gene-tools:service --name=myData --directory=my-feature/services --serviceType=apollo
nx generate @brainly-gene/tools:service --name=myData --directory=my-feature/services --serviceType=apollo
```

Running the command above will generate the following structure:
Expand Down Expand Up @@ -72,12 +72,12 @@ Example page with SSR:

```tsx filename=pages/example.tsx
import { compose } from 'ramda';
import { getRequestHeaders } from '@brainly/gene-next';
import { getRequestHeaders } from '@brainly-gene/next';
import { getHomePageContainer } from '../ioc/getHomePageIoc';
import { GetServerSideProps } from 'next/types';

import { withIoc } from '@brainly/gene';
import { apolloFactory } from '@brainly/gene-apollo';
import { withIoc } from '@brainly-gene/core';
import { apolloFactory } from '@brainly-gene/apollo';
import { ApolloClient, InMemoryCache } from '@apollo/client';
import { queryMyTest } from '@acme/services/my-test-service';

Expand Down
Loading

0 comments on commit 308e7d9

Please sign in to comment.