Skip to content

Commit 30c9f0c

Browse files
authored
fix(amplify-cli-core): use build script for overrides (aws-amplify#13858)
Updated the TypeScript compilation of overrides so that it doesn't require `node_modules/.bin/tsc`. Instead, it simply relies on the `build` script to execute `tsc`. This is more flexible and can support alternative setups w/ hoisting (e.g. via Yarn workspaces). This is an override corollary fix to aws-amplify#11854, which is for custom resources. aws-amplify#11889
1 parent 6715c82 commit 30c9f0c

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

packages/amplify-cli-core/src/overrides-manager/override-skeleton-generator.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,7 @@ export const buildOverrideDir = async (cwd: string, destDirPath: string): Promis
9393
const tsConfigSampleFilePath = path.join(__dirname, '..', '..', 'resources', 'overrides-resource', 'tsconfig.resource.json');
9494
fs.writeFileSync(tsConfigDestFilePath, fs.readFileSync(tsConfigSampleFilePath));
9595

96-
// get locally installed tsc executable
97-
98-
const localTscExecutablePath = path.join(cwd, 'node_modules', '.bin', 'tsc');
99-
100-
if (!fs.existsSync(localTscExecutablePath)) {
101-
throw new AmplifyError('MissingOverridesInstallationRequirementsError', {
102-
message: 'TypeScript executable not found.',
103-
resolution: 'Please add it as a dev-dependency in the package.json file for this resource.',
104-
});
105-
}
106-
execa.sync(localTscExecutablePath, [`--project`, `${tsConfigDestFilePath}`], {
96+
execa.sync(packageManager.executable, [`run`, `build`, `--project`, `${tsConfigDestFilePath}`], {
10797
cwd: tsConfigDir,
10898
stdio: 'pipe',
10999
encoding: 'utf-8',

0 commit comments

Comments
 (0)