Skip to content

Commit

Permalink
dashboard: scripts refactored, unit tests enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Pitonak <ppitonak@redhat.com>
  • Loading branch information
ppitonak committed Mar 22, 2019
1 parent c6b0af6 commit 3af1cd8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Red Hat, Inc. - initial API and implementation

# This is a Dockerfile allowing to build dashboard by using a docker container.
# Build step: $ docker build -t eclipse-che-dashboard
# Build step: $ docker build -t eclipse-che-dashboard .
# It builds an archive file that can be used by doing later
# $ docker run --rm eclipse-che-dashboard | tar -C target/ -zxf -
FROM node:8.10.0
Expand All @@ -20,9 +20,9 @@ RUN apt-get update && \
&& rm -rf /var/lib/apt/lists/*
COPY package.json /dashboard/
COPY yarn.lock /dashboard/
RUN cd /dashboard && npm i yarn && npx yarn install --ignore-scripts
RUN cd /dashboard && npx yarn install
COPY . /dashboard/
RUN cd /dashboard && npx yarn
RUN cd /dashboard && yarn build && yarn test
RUN cd /dashboard && cd target/ && tar zcf /tmp/dashboard.tar.gz dist/

CMD zcat /tmp/dashboard.tar.gz
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"node": ">=0.10.0"
},
"scripts": {
"postinstall": "yarn run typings && yarn run build",
"postinstall": "yarn run typings",
"typings": "typings install",
"build": "gulp build",
"test": "gulp test"
Expand Down
17 changes: 8 additions & 9 deletions dashboard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>install-yarn</id>
<id>install-deps</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- install yarn -->
<exec dir="${basedir}" executable="npm" failonerror="true">
<arg value="install" />
<!-- install dependencies -->
<exec dir="${basedir}" executable="npx" failonerror="true">
<arg value="yarn" />
<arg value="install" />
</exec>
</target>
</configuration>
Expand All @@ -221,8 +221,8 @@
<configuration>
<target>
<!-- build user dashboard -->
<exec dir="${basedir}" executable="node_modules/yarn/bin/yarn" failonerror="true">
<arg value="install" />
<exec dir="${basedir}" executable="node_modules/.bin/yarn" failonerror="true">
<arg value="build" />
</exec>
<!-- Change base HREF of the application that will be hosted on /dashboard -->
<replace file="${basedir}/target/dist/index.html">
Expand All @@ -233,16 +233,15 @@
</configuration>
</execution>
<execution>
<id>compilation</id>
<id>test-dashboard</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target unless="skipTests">
<!-- Run unit tests -->
<exec dir="${basedir}" executable="node_modules/yarn/bin/yarn" failonerror="true">
<arg value="run" />
<exec dir="${basedir}" executable="node_modules/.bin/yarn" failonerror="true">
<arg value="test" />
</exec>
</target>
Expand Down

0 comments on commit 3af1cd8

Please sign in to comment.