Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load via PINF JS Loader & minor changes #11

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
146561b
make scripts executable
cadorn Jan 6, 2015
d0e2dbd
dev server using requires or pinf loader
cadorn Jan 6, 2015
599c961
refactor to make it work against ping js loader (still works against …
cadorn Jan 6, 2015
1d4eaac
ignore build file
cadorn Jan 6, 2015
76a26bc
docs
cadorn Jan 6, 2015
fb34895
Update README.md
cadorn Jan 6, 2015
40af411
Update README.md
cadorn Jan 6, 2015
dc1c9c5
Update README.md
cadorn Jan 6, 2015
00a5a3b
Update README.md
cadorn Jan 6, 2015
9cc7881
Update README.md
cadorn Jan 6, 2015
2cea383
Update README.md
cadorn Jan 6, 2015
b9a6cfe
widgetize things more (generate separate self-contained bundle); relo…
cadorn Jan 6, 2015
1c5198d
use passed-in dom node
cadorn Jan 7, 2015
3ca711c
wip: pinf-publish to github pages
cadorn Jan 7, 2015
35001fc
wip: bundeling
cadorn Jan 7, 2015
ebfaff4
build
cadorn Jan 7, 2015
27b509a
[pinf-for-github-pages] Wrote boot files
cadorn Jan 7, 2015
a15f806
files should be on gh-pages branch
cadorn Jan 7, 2015
421d8e2
configure program
cadorn Jan 9, 2015
f07815b
inline css files and assets
cadorn Jan 12, 2015
843a9d4
load examples files using proper uris
cadorn Jan 12, 2015
d14f42a
build fix
cadorn Jan 12, 2015
7418a55
new build
cadorn Jan 12, 2015
7bf1b55
build fix
cadorn Jan 12, 2015
b8cf241
new build
cadorn Jan 12, 2015
bdf76d7
swfobject fetch for firefox
cadorn Jan 13, 2015
39e4fdd
build
cadorn Jan 13, 2015
80d9169
embed info
cadorn Jan 13, 2015
3ade075
new build
cadorn Jan 13, 2015
446e798
docs
cadorn Jan 13, 2015
7baf069
misc
cadorn Jan 15, 2015
4a32c02
rename config ns
cadorn Jan 16, 2015
0412e16
install pinf-for-nodejs from nom registry
cadorn Jan 16, 2015
88a3c82
doc
cadorn Jan 16, 2015
4e7af8d
descriptor fix
cadorn Jan 16, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/extension/build/
/extension/release/
*.graphml
/webapp-build/

# Files from NPM
/extension/node_modules/
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ Testing

Development
-----------
* To start the build, go to the webapp/scripts directory and execute the following command:

`..\..\requirejs\build\build.bat app.build.js`

* Run from source on NodeJS using RequireJS or PINF JavaScript module loader:
````
cd dev
npm install
npm start
open http://localhost:8080
````
* Run from source (PHP) using RequireJS module loader:
* Build client to `./webapp-build`: `ant`
* Mount document root: `./webapp`
* Open in web browser
* Build and publish to github pages:
* Run: `ant publish-to-github`
* Open: http://fireconsole.github.io/harviewer/
15 changes: 14 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,21 @@
</exec>
</target>

<!-- Run PINF build tools -->
<target name="pinf-bundle">
<exec dir="${app.dir}/../fireconsole" executable="npm" resolveexecutable="true">
<arg value="run-script"/>
<arg value="build"/>
</exec>
</target>

<target name="publish-to-github" depends="pinf-bundle">
<exec dir="${app.dir}/.." executable="./dev/node_modules/.bin/pinf-publish" resolveexecutable="true">
</exec>
</target>

<!-- Build HAR Viewer package (the result is within build.dir) -->
<target name="build" depends="clean, requirejs-mac, requirejs-win, requirejs-unix">
<target name="build" depends="clean, requirejs-mac, requirejs-win, requirejs-unix, pinf-bundle">

<!-- Log info about the current OS -->
<echo message="Building HAR Viewer on:" />
Expand Down
3 changes: 3 additions & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/client/.rt/
/node_modules/
/npm-debug.log
18 changes: 18 additions & 0 deletions dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "dev",
"version": "0.0.0",
"private": true,
"main": "./server.js",
"dependencies": {
"express": "^4.7.2",
"pinf-for-nodejs": "0.1.x",
"send": "^0.7.3",
"pinf-to-github-pages": "0.1.x",
"rework": "^1.0.1",
"rework-import": "^2.0.0",
"rework-plugin-inline": "^1.0.1"
},
"scripts": {
"start": "rm -Rf client/.rt ../fireconsole/.rt ; node server.js"
}
}
81 changes: 81 additions & 0 deletions dev/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

const PATH = require("path");
const FS = require("fs");
const PINF = require("pinf-for-nodejs");
const EXPRESS = require("express");
const SEND = require("send");
const HTTP = require("http");
const REWORK = require("rework");
const REWORK_IMPORT = require("rework-import");
const REWORK_INLINE = require("rework-plugin-inline");


const PORT = process.env.PORT || 8080;

return PINF.main(function(options, callback) {

var app = EXPRESS();

app.get(/^\/scripts\/css\/(.+\.css)$/, function (req, res, next) {
var basePath = PATH.join(__dirname, "../webapp/scripts/css");

var source = FS.readFileSync(PATH.join(basePath, req.params[0]), "utf8");

source = REWORK(source)
.use(REWORK_IMPORT({
path: basePath
}))
.toString();

source = source.replace(/(background[\s\w-]*:[\s#\w]*]*)url(\('?"?images\/)/g, "$1inline$2");

source = res.end(REWORK(source)
.use(REWORK_INLINE(basePath))
.toString());

return res.end(source);
});

// For RequireJS loader.
app.get(/^\/scripts\/(.+)$/, function (req, res, next) {
return SEND(req, req.params[0], {
root: PATH.join(__dirname, "../webapp/scripts")
}).on("error", next).pipe(res);
});
app.get(/^\/examples\/(.+)$/, function (req, res, next) {
return SEND(req, req.params[0], {
root: PATH.join(__dirname, "../webapp/scripts/examples")
}).on("error", next).pipe(res);
});

// For PINF loader.
app.get(/^\/lib\/pinf-loader-js\/(.+)$/, function (req, res, next) {
return SEND(req, req.params[0], {
root: PATH.join(__dirname, "node_modules/pinf-for-nodejs/node_modules/pinf-loader-js")
}).on("error", next).pipe(res);
});
app.get(/^\/(plugin.+)$/, PINF.hoist(PATH.join(__dirname, "../fireconsole/program.json"), options.$pinf.makeOptions({
debug: true,
verbose: true,
PINF_RUNTIME: "",
$pinf: options.$pinf
})));

// For both loaders and dev helper files.
app.get(/^(\/.*)$/, function (req, res, next) {
var path = req.params[0];
if (path === "/") path = "/index.html";
return SEND(req, path, {
root: PATH.join(__dirname, "www")
}).on("error", next).pipe(res);
});

HTTP.createServer(app).listen(PORT)

// Wait for debug output from `PINF.hoist()` to finish.
setTimeout(function() {
console.log("Open browser to: http://localhost:" + PORT + "/");
}, 2 * 1000);

}, module);

6 changes: 6 additions & 0 deletions dev/www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<body>
<ul>
<li><a href="requirejs.htm">RequireJS-based loader development</a></li>
<li><a href="pinf.htm">PINF-based loader development</a></li>
</ul>
</body>
19 changes: 19 additions & 0 deletions dev/www/pinf.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTTP Archive Viewer @VERSION@</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="/lib/pinf-loader-js/loader.js"></script>
</head>
<body class="harBody">
<div id="content" version="@VERSION@"></div>
<!--[if IE]><script type="text/javascript" src="scripts/excanvas/excanvas.js"></script><![endif]-->
<script>
PINF.sandbox("/plugin.js", function (sandbox) {
sandbox.main();
}, function (err) {
console.error("Error while loading bundle '/plugin.js':", err.stack);
});
</script>
</body>
</html>
15 changes: 15 additions & 0 deletions dev/www/requirejs.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTTP Archive Viewer @VERSION@</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body class="harBody">
<div id="content" version="@VERSION@"></div>
<!--[if IE]><script type="text/javascript" src="scripts/excanvas/excanvas.js"></script><![endif]-->
<script>
window.harviewerInitOnLoad = true;
</script>
<script data-main="scripts/harViewer" src="scripts/require.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions fireconsole/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.rt/
4 changes: 4 additions & 0 deletions fireconsole/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FireConsole Plugin
==================

Everything needed to use the harviewer as a [FireConsole](http://fireconsole.org) plugin.
Loading