Skip to content

Commit 39684a6

Browse files
authored
chore: Merge PR #55 from feat/generator-improvements
2 parents 8f32666 + 8f9dfbb commit 39684a6

File tree

21 files changed

+205
-140
lines changed

21 files changed

+205
-140
lines changed

apps/next/schema.graphql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,11 +980,14 @@ type UpsertResumeResponse {
980980
upsertedResume: ResumeData!
981981
}
982982

983+
type Mutation {
984+
syncUserBiosFromAirtable(args: SyncUserBiosFromAirtableArgs!): SyncUserBiosFromAirtableResponse
985+
upsertResume(args: UpsertResumeArgs!): UpsertResumeResponse
986+
}
987+
983988
type Query {
984989
getResumeDataByUserSlug(args: GetResumeDataByUserSlugArgs!): ResumeData
985990
getShopifyProducts(args: GetShopifyProductsArgs): GetShopifyProductsResponse
986991
getUserBioBySlug(args: UserBioInput!): UserBio
987992
healthCheck(args: HealthCheckArgs): HealthCheckResponse
988-
syncUserBiosFromAirtable(args: SyncUserBiosFromAirtableArgs!): SyncUserBiosFromAirtableResponse
989-
upsertResume(args: UpsertResumeArgs!): UpsertResumeResponse
990993
}

features/cv-page/schemas/GetResumeDataByUserSlugDataBridge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ export type GetResumeDataByUserSlugResponse = z.infer<typeof GetResumeDataByUser
2929
/** -i- API Config for getResumeDataByUserSlug() */
3030
export const GetResumeDataByUserSlugDataBridge = createDataBridge({
3131
resolverName: 'getResumeDataByUserSlug',
32+
resolverType: 'query',
3233
argsSchema: GetResumeDataByUserSlugArgs,
3334
responseSchema: GetResumeDataByUserSlugResponse,
3435
apiPath: '/api/resume/[slug]',
35-
allowedMethods: ['GET', 'POST'],
36+
allowedMethods: ['GRAPHQL', 'GET', 'POST'],
3637
})

features/cv-page/schemas/UpsertResumeDataBridge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ export type UpsertResumeResponse = z.infer<typeof UpsertResumeResponse>
3535
/** -i- Aetherspace API Config for upsertResume() */
3636
export const UpsertResumeDataBridge = createDataBridge({
3737
resolverName: 'upsertResume',
38+
resolverType: 'mutation',
3839
argsSchema: UpsertResumeArgs,
3940
responseSchema: UpsertResumeResponse,
4041
apiPath: '/api/resume/[slug]/upsert',
41-
allowedMethods: ['GET', 'POST'],
42+
allowedMethods: ['GRAPHQL', 'GET', 'POST'],
4243
})

features/links-page/schemas/GetUserBioBySlugDataBridge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { UserBio, UserBioInput } from './UserBio'
55
/** -i- API Config for getResumeDataByUserSlug() */
66
export const GetUserBioBySlugDataBridge = createDataBridge({
77
resolverName: 'getUserBioBySlug',
8+
resolverType: 'query',
89
argsSchema: UserBioInput,
910
responseSchema: UserBio,
1011
apiPath: '/api/bio/[slug]',
11-
allowedMethods: ['GET', 'POST'],
12+
allowedMethods: ['GRAPHQL', 'GET', 'POST'],
1213
})

features/links-page/schemas/SyncUserBiosFromAirtableDataBridge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ export type SyncUserBiosFromAirtableResponse = z.infer<typeof SyncUserBiosFromAi
4141
/** -i- Aetherspace API Config for syncUserBiosFromAirtable() */
4242
export const SyncUserBiosFromAirtableDataBridge = createDataBridge({
4343
resolverName: 'syncUserBiosFromAirtable',
44+
resolverType: 'mutation',
4445
argsSchema: SyncUserBiosFromAirtableArgs,
4546
responseSchema: SyncUserBiosFromAirtableResponse,
4647
apiPath: '/api/links/syncs/airtable',
47-
allowedMethods: ['GET', 'POST'],
48+
allowedMethods: ['GRAPHQL', 'GET', 'POST'],
4849
})

packages/@aetherspace-commerce/schemas/GetShopifyProductsDataBridge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ export type GetShopifyProductsResponse = z.infer<typeof GetShopifyProductsRespon
2424
/** -i- The API config for the getShopifyProduct() resolver */
2525
export const GetShopifyProductsDataBridge = createDataBridge({
2626
resolverName: 'getShopifyProducts',
27+
resolverType: 'query',
2728
argsSchema: GetShopifyProductsArgs,
2829
responseSchema: GetShopifyProductsResponse,
2930
apiPath: '/api/aetherspace/commerce/shopify/products',
30-
allowedMethods: ['GET', 'POST'],
31+
allowedMethods: ['GRAPHQL', 'GET', 'POST'],
3132
})

packages/@aetherspace/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ yarn dev:docs
2626

2727
## Up and running in minutes
2828

29-
`packages/@aetherspace` houses a bunch of helpers that can be imported under the `aetherspace` namespace. These aim to make your cross-platform journey a breeze. All of it has been written in Typescript and is in the process of being documented in Storybook. Feel free to edit these to your liking, but here's what it you can do with it out of the box:
29+
`packages/@aetherspace` houses a bunch of helpers that can be imported under the `aetherspace` namespace. These aim to make your cross-platform journey a breeze. All of it has been written in Typescript and is documented in Storybook and the repo README's. Feel free to edit these to your liking if you make changes, but here's what it you can do with it out of the box:
3030

3131
#### Write & style your components just once
3232

33-
> 💚 Aetherspace primitives are ___built with [tailwind](), iOS, Android, web, node and ssr (+ media queries) in mind___.
33+
> 💚 Aetherspace primitives are ___built with [tailwind](https://tailwindcss.com/), iOS, Android, web, node and ssr (+ media queries) in mind___.
3434
> We mention media queries specifically because react-native-web does not support them out of the box. But we've got you covered.
3535
3636
```tsx
@@ -133,7 +133,8 @@ export const MyComponent = (props: AetherProps<typeof PropSchema>) => {
133133
#### Hook into automatic docgen
134134

135135
> 📚 ___Documentation drives adoption___... and Storybook is a great way to do it.
136-
> Just assign your `aetherSchema()` & `zod` powered prop definition as a __`getDocumentationProps` export__ and our scripts will __automatically turn it into Storybook controls.__
136+
> However, it can be a pain to set up and maintain the docs for every component manually. Luckily, we've already set it up for you.
137+
> On top of that, all you need to do is assign your `aetherSchema()` & `zod` powered prop definition as a __`getDocumentationProps` export__ and our scripts will __automatically turn it into Storybook controls.__
137138

138139
`../../components/MyComponent.tsx`
139140

@@ -243,11 +244,12 @@ Performing these 6 steps has provided us with a bunch of value in little time:
243244

244245
<p>
245246
<a href="https://dev.to/codinsonn/how-to-compete-with-elons-twitter-a-dev-perspective-4j64#:~:text=%27Move%20fast%20%26%20build%20things%27%20with%20Zod%2C%20Expo%20%26%20Next.js" target="_blank">
246-
<img alt="Intro Article on DEV" longdesc="Read the Intro Artical on DEV.to" src="https://img.shields.io/badge/dev.to-0A0A0A?style=for-the-badge&logo=devdotto&logoColor=white" />
247+
<img alt="Intro Article on DEV" longdesc="Read the Intro Article on DEV.to" src="https://img.shields.io/badge/dev.to-0A0A0A?style=for-the-badge&logo=devdotto&logoColor=white" />
247248
</a>
248249
</p>
249250

250251
- [Aetherspace Core Concepts](/packages/@aetherspace/core/README.md)
252+
- [Recommended way of working](/packages/@aetherspace/scripts/README.md)
251253
- [Single Sources of Truth for Front & Back-End with Zod](/packages/@aetherspace/schemas/README.md)
252254
- [Styling your components with Tailwind for Web & Mobile](/packages/@aetherspace/styles/README.md)
253255
- [Universal Routing with Expo and Next.js](/packages/@aetherspace/navigation/README.md)

packages/@aetherspace/core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ Similar to adding recurring features, removing features or packages from a fresh
177177
## Getting started with Aetherspace
178178

179179
- [Quickstart](/packages/@aetherspace/README.md)
180+
- [Recommended way of working](/packages/@aetherspace/scripts/README.md)
180181
- [Universal Routing](/packages/@aetherspace/navigation/README.md)
181-
- [Free and Premium Licenses](/LICENSE.md)
182182

183183
...
184184

packages/@aetherspace/generators/aether-form.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
uppercaseFirstChar,
88
createAutocompleteSource,
99
validateNonEmptyNoSpaces,
10+
normalizeName,
1011
} from '../scripts/helpers/scriptUtils'
1112

1213
/* --- Disclaimer ------------------------------------------------------------------------------ */
@@ -20,14 +21,14 @@ const workspaceOptions = getWorkspaceOptions('')
2021

2122
const availableSchemas = getAvailableSchemas('')
2223

23-
const availableDataBridges = getAvailableDataBridges('')
24+
const availableDataBridges = getAvailableDataBridges('', 'mutation', true)
2425

2526
const LINES = 100 - 12 // -i- 100 = max length, 12 = everything but the title & '-' lines
2627

2728
const schemaTypeOptions = {
2829
["No, I'll create my own form state schema"]: 'new',
2930
['Yes, use an existing schema']: 'existing-schema',
30-
['Yes, use an existing data bridge to integrate with a resolver']: 'bridge',
31+
['Yes, use an existing data bridge to integrate state for a resolver']: 'bridge',
3132
}
3233

3334
/** --- Resolver Generator --------------------------------------------------------------------- */
@@ -72,14 +73,16 @@ export const registerAetherFormGenerator = (plop: PlopTypes.NodePlopAPI) => {
7273
const schemaName = schemaConfig?.schemaName || bridgeConfig?.resolverName || 'useSomeFormState' // prettier-ignore
7374
let formHookName = `use${uppercaseFirstChar(schemaName)}FormState`
7475
formHookName = formHookName.replace('Edit', '').replace('Resolver', '').replace('Update', '') // prettier-ignore
75-
return formHookName
76+
return normalizeName(formHookName)
7677
},
7778
validate: validateNonEmptyNoSpaces,
79+
transformer: normalizeName,
7880
},
7981
],
8082
actions: (data) => {
8183
// Args
82-
const { workspaceTarget, formHookName, schemaTarget, bridgeTarget } = data || {}
84+
const { workspaceTarget, schemaTarget, bridgeTarget } = data || {}
85+
const formHookName = normalizeName(data!.formHookName)
8386
const workspacePath = workspaceOptions[workspaceTarget]
8487
const dataBridgeConfig = availableDataBridges[bridgeTarget]
8588
const schemaConfig = availableSchemas[schemaTarget]

0 commit comments

Comments
 (0)