-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: lambda support for yarn2/3 and pnpm package managers (#12750)
* feat: add support for pnpm and yarn2 for lambda function
- Loading branch information
Showing
39 changed files
with
1,012 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,6 +290,7 @@ | |
"pipfile", | ||
"pkill", | ||
"pluggable", | ||
"pnpm", | ||
"poller", | ||
"polly", | ||
"positionally", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
resolution-mode=highest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...on/src/provider-utils/awscloudformation/service-walkthroughs/packageManagerWalkthrough.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { getPackageManagerByType, packageManagers, PackageManagerType } from '@aws-amplify/amplify-cli-core'; | ||
import { BuildType, FunctionParameters } from '@aws-amplify/amplify-function-plugin-interface'; | ||
import { minLength, prompter } from '@aws-amplify/amplify-prompts'; | ||
|
||
export const packageManagerWalkthrough = async (runtime: string): Promise<Partial<FunctionParameters>> => { | ||
if (runtime === 'nodejs') { | ||
const packageManagerOptions = Object.values(packageManagers).map((pm) => ({ | ||
name: pm.displayValue, | ||
value: pm.packageManager as string, | ||
})); | ||
|
||
const packageManager = (await prompter.pick( | ||
'Choose the package manager that you want to use:', | ||
packageManagerOptions, | ||
)) as PackageManagerType; | ||
|
||
return { | ||
scripts: { | ||
build: await getBuildCommand(packageManager), | ||
}, | ||
}; | ||
} | ||
|
||
return {}; | ||
}; | ||
|
||
const getBuildCommand = async (packageManager: PackageManagerType): Promise<string> => { | ||
if (packageManager === 'custom') { | ||
return prompter.input('Enter command or script path to build your function:', { | ||
validate: minLength(1), | ||
}); | ||
} else { | ||
const packageManagerInstance = getPackageManagerByType(packageManager); | ||
return [packageManagerInstance.executable].concat(packageManagerInstance.getInstallArgs(BuildType.PROD)).join(' '); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.