Skip to content

Commit

Permalink
fix: generate dynamic amplify resource types before building cdk code (
Browse files Browse the repository at this point in the history
…#8778)

Co-authored-by: Ghosh <kaustavg@3c22fb229ff6.ant.amazon.com>
  • Loading branch information
2 people authored and sachscode committed Nov 11, 2021
1 parent 53ecf9f commit 5f640ed
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export async function buildCustomResources(context: $TSContext, resourceName?: s
const spinner = ora('Building custom resources');
try {
spinner.start();

const resourcesToBuild = (await getSelectedResources(context, resourceName)).filter(resource => resource.service === 'customCDK');
for await (const resource of resourcesToBuild) {
await buildResource(context, resource);
Expand Down Expand Up @@ -61,6 +62,9 @@ export async function generateDependentResourcesType(context: $TSContext) {
async function buildResource(context: $TSContext, resource: ResourceMeta) {
const targetDir = path.resolve(path.join(pathManager.getBackendDirPath(), categoryName, resource.resourceName));

// generate dynamic types for Amplify resources
await generateDependentResourcesType(context);

const packageManager = getPackageManager(targetDir);

if (packageManager === null) {
Expand Down Expand Up @@ -101,6 +105,4 @@ async function buildResource(context: $TSContext, resource: ResourceMeta) {
}

await generateCloudFormationFromCDK(resource.resourceName);

await generateDependentResourcesType(context);
}

0 comments on commit 5f640ed

Please sign in to comment.