amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

Prevent yarn install #146

Open hrmoller opened 6 years ago

hrmoller commented 6 years ago

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.

UnleashedMind commented 6 years ago

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.

jimmyn commented 6 years ago

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.

pangolingo commented 6 years ago

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 commented 6 years ago

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.