Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Simplify build (#335)
Browse files Browse the repository at this point in the history
* Removing dependency on Grunt

* Move documentation build into npm script

* move uw-frame-static build into npm script

* Remove obsolute build.sh scripts

* Add static:dev and docs:dev npm targets

These targets are for building, watching, and serving the docs and
static sub-projects. The Gruntfile.js should be obsolete with this
change.

* Fix formatting

* Install rimraf, not rifraf

* Docker build without grunt
  • Loading branch information
jsamsa authored and Tim Levett committed Oct 13, 2016
1 parent f5253d7 commit ab764d6
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ node_modules
npm-debug.log
*.iml
*.swp

\.DS_Store
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM node:5.7.1-slim
MAINTAINER Tim Levett <tim.levett@wisc.edu>
RUN npm install -g grunt-cli superstatic
RUN npm install -g superstatic

RUN apt-get update && apt-get install -y bzip2 && apt-get install -y git

# Add frame
COPY tools /build/tools
copy docs /build/docs
COPY uw-frame-components /build/uw-frame-components
COPY uw-frame-static /build/uw-frame-static
COPY package.json /build/
COPY Gruntfile.js /build/

# build frame
WORKDIR /build
RUN npm install
RUN npm run build-static
RUN cp -r /build/uw-frame-static/target /data

Expand Down
85 changes: 0 additions & 85 deletions Gruntfile.js

This file was deleted.

14 changes: 0 additions & 14 deletions docs/build.sh

This file was deleted.

14 changes: 7 additions & 7 deletions docs/markdown/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Run a local instance of uw-frame in a matter of minutes using the following step
1. Clone the repo: `git clone git@github.com:UW-Madison-DoIT/uw-frame.git`
- (optional) If you want to use a specific release, checkout its [tag](https://github.com/UW-Madison-DoIT/uw-frame/releases): `git checkout <tag>`
2. Run the following commands:
```
npm install -g grunt-cli
npm install
npm run static
```
```
npm install
npm run static:dev
```

3. Open a browser and go to the location specified in the build output


Expand All @@ -36,11 +36,11 @@ There are a couple ways you can create a static frame application.
1. Use the [npm package](https://www.npmjs.com/package/uw-frame). See the [widget creator](https://github.com/UW-Madison-DoIT/myuw-smart-widget-creator) app for an example that uses the package.
2. Use the Docker superstatic container:
- Build the docker container (`docker build -t myuw/frame .`) and run it to get the frame demo application
- Run `docker run -v myapp-dir:/data/my-app myuw/frame` to replace the my-app directory with a volume mounted from localhost
- Run `docker run -v myapp-dir:/data/my-app -p 8009:8009 myuw/frame` to replace the my-app directory with a volume mounted from localhost
- For deployment, create a Dockerfile like so:
```
FROM myuw/frame

COPY ./someapp /data/my-app
```
See the [Dockerfile](https://github.com/UW-Madison-DoIT/uw-frame/blob/master/Dockerfile) for specifics.
See the [Dockerfile](https://github.com/UW-Madison-DoIT/uw-frame/blob/master/Dockerfile) for specifics.
30 changes: 18 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@
"test": "karma start uw-frame-components/karma.conf.js --single-run",
"posttest": "cd uw-frame-components",
"build-all": "npm run build-java && npm run build-static",
"build-docs": "cd docs && ./build.sh",
"postbuild-docs": "grunt",
"prebuild-docs": "npm run build-static && rimraf docs/target && mkdir -p docs/target",
"build-docs": "cp -r uw-frame-static/target/* docs/target && cp -r docs/js docs/img docs/markdown docs/my-app docs/superstatic.json docs/target",
"build:html": "htmlprocessor uw-frame-static/index.html -o uw-frame-static/target/index.html && htmlprocessor docs/index.html -o docs/target/index.html",
"postbuild-docs": "npm run build:html",
"build-java": "cd uw-frame-java && mvn clean install",
"prebuild-static": "npm install",
"build-static": "cd uw-frame-static && ./build.sh",
"postbuild-static": "grunt",
"prebuild-static": "rimraf uw-frame-static/target && mkdir uw-frame-static/target",
"build-static": "node tools/uw-frame-static/build.js",
"postbuild-static": "npm run build:html",
"predocs": "npm run build-docs",
"docs": "cd docs/target && superstatic",
"docs:watch": "onchange uw-frame-components/** docs/** -e docs/target -v -- npm run build-docs",
"docs:dev": "npm run build-docs -s && concurrently -k \"npm run docs -s\" \"npm run docs:watch -s\"",
"jetty": "cd uw-frame-java && mvn jetty:run",
"prestatic": "npm run build-static",
"static": "cd uw-frame-static/target && superstatic --host=0.0.0.0",
"static:watch": "onchange uw-frame-components/** -i -- npm run build-static",
"static:dev": "npm run build-static -s && concurrently -k \"npm run static -s\" \"npm run static:watch -s\"",
"docker": "docker run -d --name frame -p 8009:8009 docker.doit.wisc.edu/myuw/uw-frame-superstatic:latest",
"build-docker": "docker build -t docker.doit.wisc.edu/myuw/uw-frame-superstatic .",
"stop-docker": "docker stop frame; docker rm frame;",
Expand All @@ -27,8 +33,7 @@
},
"files": [
"uw-frame-components",
"uw-frame-static",
"Gruntfile.js"
"uw-frame-static"
],
"licenses": [
{
Expand Down Expand Up @@ -68,11 +73,9 @@
},
"homepage": "https://github.com/UW-Madison-DoIT/uw-frame",
"devDependencies": {
"concurrently": "^3.1.0",
"graceful-fs": "^4.0.0",
"grunt": "^0.4.5",
"grunt-contrib-watch": "^0.6.1",
"grunt-processhtml": "^0.3.8",
"grunt-run": "^0.5.2",
"htmlprocessor": "^0.2.4",
"jasmine-core": "^2.3.4",
"karma": "0.13.21",
"karma-chrome-launcher": "0.2.2",
Expand All @@ -84,10 +87,13 @@
"karma-jasmine-html-reporter": "0.2.0",
"karma-phantomjs-launcher": "1.0.0",
"karma-requirejs": "0.2.6",
"lodash": "^4.0.0",
"less": "1.7.5",
"lodash": "^4.0.0",
"onchange": "^3.0.2",
"phantomjs-prebuilt": "2.1.7",
"recursive-copy": "^2.0.5",
"requirejs": "^2.2.0",
"rimraf": "^2.5.4",
"superstatic": "^4.0.0"
}
}
29 changes: 29 additions & 0 deletions tools/uw-frame-static/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';
var less = require('less');
var exec = require('child_process').exec;

var exec_handler = function(error, stdout, stderr) {
if (error) throw error;
}

exec('cp -r uw-frame-components/* uw-frame-static/target', exec_handler);

exec('cp uw-frame-static/superstatic.json uw-frame-static/target/', exec_handler);

exec('mkdir -p uw-frame-static/target/css/themes', exec_handler);


var themes = ['uw-madison', 'uw-system', 'uw-river-falls',
'uw-stevens-point', 'uw-milwaukee', 'uw-whitewater', 'uw-stout',
'uw-superior', 'uw-platteville', 'uw-parkside', 'uw-oshkosh',
'uw-greenbay', 'uw-lacrosse', 'uw-eau-claire', 'uw-extension',
'uw-colleges'];


for (var i = 0; i < themes.length; i++) {
var cmd = 'node_modules/.bin/lessc -x uw-frame-components/css/themes/' +
themes[i] + '.less > uw-frame-static/target/css/themes/' +
themes[i] + '.css';
exec(cmd, exec_handler);
}

31 changes: 0 additions & 31 deletions uw-frame-static/build.sh

This file was deleted.

0 comments on commit ab764d6

Please sign in to comment.