-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support PNPM and Others #6382
Comments
We recently added support for installation of CLI as an executable using curl - |
Thanks for the reply, but that's not quite what I was talking about. Amplify will autodetect package-lock.json or yarn.lock and install accordingly. I was speaking towards that process. Related: #6035 (comment) |
I'm running into some issues now too, due to the use of When I run For now, I've created an executable script and run amplify push as follows:
And then in
|
NOTE: If you want to install this cli locally (and you are not using .pnpmfile.cjs#readPackage if (pkg.name === '@aws-amplify/cli') {
pkg.dependencies = {
...pkg.dependencies,
'uuid': '^3.2.1', // Must be 3, not 4.
// Dynamic requires.
// See `/node_modules/.pnpm/@[email protected]/node_modules/@aws-amplify/cli/lib/utils/post-install-initialization.js.`
'amplify-dynamodb-simulator': '*',
'amplify-frontend-ios': '*',
'amplify-go-function-runtime-provider': '*',
'amplify-java-function-runtime-provider': '*',
'amplify-python-function-runtime-provider': '*',
}
}
////////////////////
// When running `aws configure` this list is generated.
const officialPlugins = [
'amplify-provider-awscloudformation',
'amplify-category-analytics',
'amplify-category-api',
'amplify-category-auth',
'amplify-category-function',
'amplify-category-hosting',
'amplify-console-hosting',
'amplify-container-hosting',
'amplify-category-interactions',
'amplify-category-notifications',
'amplify-category-predictions',
'amplify-category-storage',
'amplify-category-xr',
'amplify-codegen',
'amplify-frontend-flutter',
'amplify-frontend-android',
'amplify-frontend-ios',
'amplify-frontend-javascript',
'amplify-util-mock',
]
/*
"peerDependenciesMeta": {
"node-sass": {
"optional": true
}
},
*/
pkg.peerDependenciesMeta = officialPlugins.reduce((acc, pkg) => {
acc[pkg] = {optional: true}
return acc
}, {})
////////////////////
if (pkg.name === 'amplify-category-auth') {
pkg.dependencies = {
...pkg.dependencies,
'cfn-response': '*',
'express': '*',
'body-parser': '*',
'aws-serverless-express': '*',
'@aws-cdk/aws-iam': '*',
'@aws-cdk/aws-lambda': '*',
'@aws-cdk/core': '*',
'axios': '*',
}
} Amplify should explicitly declare their dependencies in package.json. They also use a bunch of dynamic requires. All the plugins should be declared as optional peer dependencies using |
+1 to what @vjpr has mentioned.
|
I'm going to say +1 to asking for first class support for Either way, we are going to be looking at migrating to another system ASAP for our CI pipeline - trying to use |
Oh hey @mikhael28 fancy seeing you here. 😆 First class support would be great, but (commenting here so it can help others if applicable) a workaround that seems to be fairly effective (it solved our deploy issues) is to edit the |
@jayeclark is a boss 👩💻 |
@jayeclark Thanks! This worked great. |
pnpm is supported by Node.js's Corepack so it's reasonable for customers to expect first class pnpm support, alongside |
|
I see this was closed, but using
|
@siegerts since as I understand you are working on a new default image for amplify, perhaps it might be a good time to consider adding pnpm as well! |
Heya! Would just like to point out that you can currently use pnpm by including |
Yes but that’s slower because you have to download it each time, and surprising given yarn and npm have first class support. |
I am well aware, but I still rather do that then use npm/yarn 😁 |
Here's my current approach to PNPM Not found error while building:
|
i.e. package.json
amplify.yml
Note: You can grab the implicitly generated |
Is there a way to fork the Amplify image, install pnpm, and use that, so we have pnpm installed once in the image and not re-installed every build? |
I created a custom docker image You can use it by going to Build Settings → Edit → Click Build Image dropdown Amazon Linux 2023(default) then select Custom Build Image → type in I created the Docker Image by:
sudo yum install docker -y
sudo systemctl start docker
sudo systemctl enable docker
docker --version
sudo usermod -a -G docker $(whoami)
newgrp docker
docker pull amazonlinux
docker run -it amazonlinux:latest
yum update
yum install -y git openssh bash wget tar
curl -sL https://rpm.nodesource.com/setup_18.x | bash -
yum install -y nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
source ~/.nvm/nvm.sh
curl -fsSL https://get.pnpm.io/install.sh | sh -
source /root/.bashrc
yum clean all
exit
docker ps -a
docker commit 7c4fa070f776 amazonlinux-pnpm
docker images
docker tag amazonlinux-pnpm renchris/amazonlinux:pnpm
docker login
docker push renchris/amazonlinux:pnpm Replace the commit ID (ie. 7c4fa070f776), local published image name (ie. amazonlinux-pnpm), and Docker Hub image name (ie. renchris/amazonlinux:pnpm), with your own Now having this Custom Build Image, we have |
seems that there is an official guide on how to use |
Is your feature request related to a problem? Please describe.
I suppose you could consider this related to a problem; at present the Amplify CLI is forcing either
npm
oryarn
upon the userbase. Locking users into a vendor is never a good idea. I work in apnpm
shop, and not being able to use that for install duringpush
is not only putting us as a speed advantage, but it's forcing us to use a codepath that we didn't choose.Describe the solution you'd like
I'd like first-class support for modifying the install command that's used, or being able to skip the install step altogether, allowing the app's
amplify:{appName}
script to prepare the directory for push. e.g. copying/moving node_modules into the target directory, or running our installer of choice.Describe alternatives you've considered
There aren't any. Woo!
Additional context
n/a
The text was updated successfully, but these errors were encountered: