Skip to content

Commit 14a4d8e

Browse files
committed
Use build script to build custom resources #11889
…rather than invoking tsc directly from the node_modules/.bin directory
1 parent 4b3db16 commit 14a4d8e

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

packages/amplify-category-custom/src/utils/build-custom-resources.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,14 @@ const buildResource = async (resource: ResourceMeta): Promise<void> => {
8181
}
8282
}
8383

84-
// get locally installed tsc executable
85-
86-
const localTscExecutablePath = path.join(targetDir, 'node_modules', '.bin', 'tsc');
87-
88-
if (!fs.existsSync(localTscExecutablePath)) {
89-
throw new AmplifyError('MissingOverridesInstallationRequirementsError', {
90-
message: 'TypeScript executable not found.',
91-
resolution: 'Please add it as a dev-dependency in the package.json file for this resource.',
92-
});
93-
}
94-
9584
try {
96-
execa.sync(localTscExecutablePath, {
85+
execa.sync(packageManager.executable, ['run', 'build'], {
9786
cwd: targetDir,
9887
stdio: 'pipe',
9988
encoding: 'utf-8',
10089
});
10190
} catch (error: $TSAny) {
102-
printer.error(`Failed building resource ${resource.resourceName}`);
91+
printer.error(`Failed building resource ${resource.resourceName} with TypeScript`);
10392
throw error;
10493
}
10594

0 commit comments

Comments
 (0)