awsmobile-cli icon indicating copy to clipboard operation
awsmobile-cli copied to clipboard

Prevent yarn install

Open hrmoller opened this issue 7 years ago • 4 comments

As part awsmobile init there's run a step that invokes yarn install, but why?

My usecase: For building in CI I've made awsmobile-cli a part of my devDependencies to ease the use of the commands in my npm run-script's.
I have a command that somewhat looks like this awsmobile configure aws $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY $AWS_DEFAULT_REGION && awsmobile init -y $AWS_MOBILEHUB_PROJECT_ID that first configures awsmobile-cli then init's the MobileHub project and downloads it from AWS. So far so good but after successful initialisation yarn install is invoked and I can't see that step provides anything but extended build time so at least making it optional would be a nice thing. BTW, I'm not hosting my app with AWS and I'm using npm everywhere else so the resulting yarn.lock file in my tree is a bit annoying.

hrmoller avatar Jun 05 '18 11:06 hrmoller

One of the last steps of the init command is to install the dependency of the aws-amplify library. If your project is a react or react-native project, and the system has yarn installed, the cli will use yarn to add the dependency, otherwise it will use npm. I will mark this as a feature request to make this part of the cli configurable so it's easier to use in a script.

UnleashedMind avatar Jun 05 '18 17:06 UnleashedMind

I'm also facing this problem. Build time is longer and there is no way to fix aws-amplify and aws-amplify-react versions in package.json. That can cause issues. Maybe one option would be to check the presence of those packages, if they exist just skip this step.

jimmyn avatar Jun 21 '18 09:06 jimmyn

I'm currently having issues with CI because the version of aws-amplify installed by awsmobile init is different from the version we specify in package.json. So when our build server runs this, it pushes up a different version of aws-amplify with breaking changes.

I haven't seen a way to specify the AWS Mobile Project ID without doing an init.

pangolingo avatar Jul 12 '18 15:07 pangolingo

Looking at the API a little more, it would be awesome if I could pass the AWS Mobile Project ID to awsmobile pull. Or pass it to awsmobile configure aws and then run awsmobile pull.

pangolingo avatar Jul 12 '18 15:07 pangolingo