Migrating from bower to yarn

* Works with the Docker development image
  * Requires an upgrade to Node 8
  * Using bower-away and yarn for simplicity

Change-Id: I353fb2f01f50f88707341369221d32ac9de513b1
This commit is contained in:
Chris Hoge 2018-06-07 11:34:17 -07:00 committed by Megan Guiney
parent 0f55b39a6b
commit 902d0362c7
5 changed files with 2807 additions and 45 deletions

View File

@ -14,9 +14,9 @@ Install API dependencies
Install RefStack UI dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -``
``sudo apt-get install nodejs``
``curl -sL 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``
Setup the RefStack database
^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -86,7 +86,7 @@ Install RefStack application
Install needed RefStack UI library dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``npm install``
``yarn``
API configuration file preparation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,45 +1,49 @@
FROM ubuntu:16.04
RUN apt update -y && apt install -y sudo
RUN \
groupadd dev && \
useradd -g dev -s /bin/bash -d /home/dev -m dev && \
( umask 226 && echo "dev ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/50_dev )
EXPOSE 443
ENV DEBIAN_FRONTEND noninteractive
RUN \
apt -y install \
sudo git vim wget \
nginx \
python-dev python3-dev python-pip \
libmysqlclient-dev mysql-client mysql-server libffi-dev\
npm && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/lib/mysql/* && \
rm -rf /etc/nginx/sites-enabled/default
RUN \
pip install virtualenv tox httpie && \
ln -s /usr/bin/nodejs /usr/bin/node
ENV PYTHONPATH=/home/dev/refstack \
SQL_DIR=/home/dev/mysql
ENV REFSTACK_MYSQL_URL="mysql+pymysql://root@localhost/refstack?unix_socket=${SQL_DIR}/mysql.socket&charset=utf8"
ADD /docker/scripts/* /usr/bin/
ADD . /refstack
ENV PYTHONPATH=/home/dev/refstack \
SQL_DIR=/home/dev/mysql
RUN apt update -y \
&& apt upgrade -y
ENV REFSTACK_MYSQL_URL="mysql+pymysql://root@localhost/refstack?unix_socket=${SQL_DIR}/mysql.socket&charset=utf8"
RUN apt install -y curl \
sudo \
&& groupadd dev \
&& useradd -g dev -s /bin/bash -d /home/dev -m dev \
&& ( umask 226 && echo "dev ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/50_dev ) \
&& curl -sL https://deb.nodesource.com/setup_8.x -o /tmp/setup_8.x.sh \
&& sudo bash /tmp/setup_8.x.sh \
&& apt install -y git \
libffi-dev \
libmysqlclient-dev \
mysql-client \
mysql-server \
nginx \
nodejs \
python-dev \
python-pip \
python3-dev \
sudo \
vim \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mysql/* \
&& rm -rf /etc/nginx/sites-enabled/default \
&& npm install -g yarn \
&& pip install virtualenv tox httpie
USER dev
RUN \
echo "cd /home/dev/refstack" >> /home/dev/.bashrc &&\
echo "alias activate='source /home/dev/refstack/.venv/bin/activate'" >> /home/dev/.bashrc &&\
echo "alias mysql='mysql --no-defaults -S ${SQL_DIR}/mysql.socket'" >> /home/dev/.bashrc &&\
start.sh &&\
api-init-db
RUN echo "cd /home/dev/refstack" >> /home/dev/.bashrc \
&& echo "alias activate='source /home/dev/refstack/.venv/bin/activate'" >> /home/dev/.bashrc \
&& echo "alias mysql='mysql --no-defaults -S ${SQL_DIR}/mysql.socket'" >> /home/dev/.bashrc \
&& start.sh \
&& api-init-db
CMD start.sh -s
EXPOSE 443

View File

@ -41,8 +41,7 @@ build_refstack_env () {
#Install some dev tools
.venv/bin/pip install pymysql httpie
cd /home/dev/refstack
npm install
# bower install --config.interactive=false
yarn
build_tmpl /refstack/docker/templates/config.json.tmpl /home/dev/refstack/refstack-ui/app/config.json
build_tmpl /refstack/docker/templates/refstack.conf.tmpl /home/dev/refstack.conf

View File

@ -1,11 +1,10 @@
{
"version": "0.0.1",
"version": "0.5.0",
"private": true,
"name": "refstack-ui",
"description": "A user interface for RefStack",
"license": "Apache2",
"devDependencies": {
"bower": "1.7.5",
"eslint": "^3.0.0",
"eslint-config-openstack": "4.0.1",
"eslint-plugin-angular": "1.4.0",
@ -13,14 +12,31 @@
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "^1.1.0"
"karma-jasmine": "^1.1.0",
"angular-mocks": "^1.3.15"
},
"scripts": {
"postinstall": "bower install --config.interactive=false",
"prestart": "npm install",
"pretest": "npm install",
"prestart": "yarn",
"pretest": "yarn",
"test": "if [ -z $CHROME_BIN ];then export CHROME_BIN=/usr/bin/chromium-browser;fi && karma start ./refstack-ui/tests/karma.conf.js --single-run",
"test-auto-watch": "if [ -z $CHROME_BIN ];then export CHROME_BIN=/usr/bin/chromium-browser;fi && karma start ./refstack-ui/tests/karma.conf.js --auto-watch",
"lint": "eslint -c ./.eslintrc --no-color ./refstack-ui"
"lint": "eslint -c ./.eslintrc --no-color ./refstack-ui",
"postinstall": "node -e \"try { require('fs').symlinkSync(require('path').resolve('node_modules/@bower_components'), 'refstack-ui/app/assets/lib', 'junction') } catch (e) { }\""
},
"dependencies": {
"bower-away": "^1.1.2",
"@bower_components/angular": "angular/bower-angular#1.3.15",
"@bower_components/angular-animate": "angular/bower-angular-animate#~1.3",
"@bower_components/angular-bootstrap": "angular-ui/bootstrap-bower#0.14.3",
"@bower_components/angular-busy": "cgross/angular-busy#4.1.3",
"@bower_components/angular-confirm-modal": "Schlogen/angular-confirm#1.2.3",
"@bower_components/angular-mocks": "angular/bower-angular-mocks#1.3.15",
"@bower_components/angular-resource": "angular/bower-angular-resource#1.3.15",
"@bower_components/angular-ui-router": "angular-ui/angular-ui-router-bower#0.2.13",
"@bower_components/bootstrap": "twbs/bootstrap#3.3.2",
"@bower_components/jquery": "jquery/jquery-dist#>= 1.9.1"
},
"engines": {
"yarn": ">= 1.0.0"
}
}

2743
yarn.lock Normal file

File diff suppressed because it is too large Load Diff