Open philschatz opened 6 years ago
None of these are the preferred way to install yarn on Ubuntu. This is what I recommend:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
and
On Ubuntu 16.04 or below and Debian Stable, you will also need to configure the NodeSource repository to get a new enough version of Node.js.
then
sudo apt-get update && sudo apt-get install yarn
which is from the documentation at https://yarnpkg.com/lang/en/docs/install/#linux-tab
Option 2 in the initial message above hurts my eyes. It would be better as:
if type -a yarn > /dev/null; then if type -a brew > /dev/null; then brew install yarn; else; curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -; echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list; sudo apt-get update && sudo apt-get install yarn; fi
in order to use proper Bash conditionals, use a builtin instead of an external executable (it will detect functions and aliases in addition to files in the $PATH
) and it incorporates the recommended installation method.
As a general comment, it might be better for the repo-specific setup scripts to only be used in dev environments; operational deployments should use the operational automation, which for CNX is cnx-deploy and ansible. This can lead to divergence, but I think it's important to be able to look in one, cross repo location for things like the list of system packages a deployment requires, rather than parsing every setup script.
I don't know if this would be useful but I have this ansible role: https://github.com/openstax/ansible-role-nodejs. If you need to install yarn you can add it to the npm global packages and it will be installed.
Ok. So, what if:
nvm
)./script/setup
will prompt "Would you like to install yarn now? (y/N)" if yarn is not installed and being executed on a debian machineI think that addresses @dtwilliamson concerns and partially @reedstrm 's concern.
I would like to have a separate discussion about reducing the need to update deployment scripts whenever dev tools change. DM me if you have a preference for where that discussion should occur (GitHub Issue, Trello Card, Schedule a meeting, etc)
@m1yag1 Thanks for bringing up that option but it seems like the consensus is to install it as a system package. I'm curious, are there any other packages you install globally? (I'm not a fan of globals because they run into each other)
@kajalp Should I create a DevOps Trello card to get yarn installed on bastion and jenkins?
I started looking into how to prompt the user when... all of a sudden.... a wild @dtwilliamson appeared! https://stackoverflow.com/a/1885534
Yeah I also feel like ./script/setup
can be used for development and testing (travis), but it probably shouldn't be used directly in deployment (ansible). It can be used as a reference to see what needs to be done when someone works on the deployment script.
Tutor deployment should include installation for everything (all the local_action
) that needs to be done locally (install nvm, rbenv, yarn? etc).
@philschatz, The only one I'm installing globally is gulp-cli and it's per the install instructions for hypothes.is. There could be a task added to install yarn as package too.
There are many ways to install https://yarnpkg.com . The options I see are:
curl -o- -L https://yarnpkg.com/install.sh | bash || exit 1
if [[ ! $(which yarn) ]]; then if [[ $(which brew) ]]; then brew install yarn; else; sudo apt-get install yarn; fi
npm install --global yarn
(does not work when folks usenvm
)npm install yarn
(annoyingly requires installing additional packages all the time)It seems that the use-cases are (everyone would use it implicitly through
./script/setup
):Some questions are:
./script/setup
install it?./script/setup
already installs system packages for osx & debian (and so do Dockerfiles)It would be great to get feedback from @dtwilliamson, @pandafulmanda , @nathanstitt , @reedstrm, @pumazi , @karenc on which approach to use. Since it would impact almost all of the Frontend repositories I posted it in here.
Refs https://github.com/openstax/os-webview/pull/964 , https://github.com/openstax/os-webview/pull/957 , https://github.com/Connexions/cnx-recipes/pull/346