Commit 59911190 authored by Sietse Ringers's avatar Sietse Ringers

Use npm, grunt & bower

parent 1e0cde0c
*.swp
build
node_modules
bower_components
module.exports = function (grunt) {
// Setup urls for the keyshare server, api server, and irma_js
// these are used to configure the webclient
var api_server_url, api_web_url, irma_js_url;
if ( (typeof(grunt.option("api_server_url")) === "undefined") ) {
console.log("INFO: set api_server_url (possibly also irma_js_url) to enable email issuing");
}
api_server_url = grunt.option("api_server_url") + "/api/v2/";
api_web_url = grunt.option("api_web_url") || grunt.option("api_server_url");
api_web_url += "/server/";
irma_js_url = grunt.option("irma_js_url") || grunt.option("api_server_url");
irma_js_url += "/client/";
console.log("api_server_url:", api_server_url);
console.log("api_web_url:", api_web_url);
console.log("irma_js_url:", irma_js_url);
grunt.initConfig({
copy: {
// Copying the bower bundles is a bit of a hack
bower_bundle: {
cwd: "bower_components",
src: ["**/*"],
dest: "build/bower_components",
expand: "true",
},
examples: {
cwd: "src",
src: ["**/*", "!**/*.html"],
dest: "build/",
expand: "true",
},
},
"string-replace": {
examples: {
files: [{
cwd: "./src",
src: ["**/*.html"],
dest: "build/",
expand: "true",
}],
options: {
replacements: [{
pattern: /\[API_SERVER_URL\]/g,
replacement: api_server_url,
}, {
pattern: /\[API_WEB_URL\]/g,
replacement: api_web_url,
}, {
pattern: /\[IRMA_JS_URL\]/g,
replacement: irma_js_url,
},
],
},
},
},
watch: {
webfiles: {
files: [
"./src/**/*",
"!./src/**/*.html",
],
tasks: ["copy"],
},
htmlfiles: {
files: [
"./src/**/*.html",
],
tasks: ["string-replace"],
},
},
});
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-string-replace");
grunt.registerTask("default", ["copy", "string-replace", "watch"]);
grunt.registerTask("build", ["copy", "string-replace"]);
};
{
"name": "irma_idin_webclient",
"description": "Webclient for IRMA iDIN server",
"main": "",
"authors": [
"Fabian van den Broek",
"Sietse Ringers",
"Radboud University",
"Privacy by Design Foundation"
],
"license": "BSD-3-Clause",
"moduleType": [
"es6",
"globals"
],
"homepage": "https://privacybydesign.foundation/",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "~2.1.4",
"js-cookie": "2.1.3",
"jwt-decode": "~1.4.0",
"bootstrap": "~3.3.6"
}
}
{
"name": "irma_idin_webclient",
"version": "0.0.1",
"description": "IRMA iDIN webclient",
"author": "Fabian van den Broek, Sietse Ringers, Radboud University, Privacy by Design Foundation",
"license": "BSD-3-Clause",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-string-replace": "^1.2.0"
}
}
......@@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="irma-web-server" value="https://privacybydesign.foundation/tomcat/irma_api_server/server/" />
<meta name="irma-api-server" value="https://privacybydesign.foundation/tomcat/irma_api_server/api/v2/" />
<meta name="irma-web-server" value="[API_WEB_URL]" />
<meta name="irma-api-server" value="[API_SERVER_URL]" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://privacybydesign.foundation/tomcat/irma_api_server/bower_components/jwt-decode/build/jwt-decode.js"></script>
......@@ -46,4 +46,4 @@
</div>
</div>
</body>
</html>
\ No newline at end of file
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment