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

Add xo linter, ava test framework, webpack build tool, README #147

Merged
merged 8 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ build/temp/
build/zap-exts/
.idea/
*.iml
node_modules/
dist/
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**Dependences**
thc202 marked this conversation as resolved.
Show resolved Hide resolved


**Installing**


**Building**
The HUD uses `webpack` as its *static module bundler* to transpile Vue & javascript files.

Run webpack with:
`npm run build`

The HUD uses `ant` as its Java build tool.

Run ant with from the `build` directory with:
`ant deploy-hud`

**Testing**
The HUD uses `ava` as its testing framework.

Run all tests with:
`npm run test`

Tests are found in the `test` directory.

**Linting**
The HUD uses `xo` as its linter.

Run the linter with:
`npm run lint`
10 changes: 10 additions & 0 deletions build/loaders/zap-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = function zapLoader(source) {
source = source.replace("<<ZAP_HUD_FILES>>", "https://zap");
source = source.replace("<<ZAP_HUD_URL>>", "https://targetdomain.com");
source = source.replace("<<ZAP_HUD_API>>", "https://zap/api");
source = source.replace("<<ZAP_HUD_WS>>", "https://zap/websocket");
source = source.replace("<<ZAP_HUD_TOOLS>>", "'http://zap/to/some/tool'");
source = source.replace("<<ZAP_SHARED_SECRET>>", "sometestsecret");

return source;
};
34 changes: 34 additions & 0 deletions build/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict'

const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
mode: 'development',
entry: [
'./src/org/zaproxy/zap/extension/hud/files/hud/serviceworker.js',
'./src/org/zaproxy/zap/extension/hud/files/hud/panel.js'
],
resolveLoader: {
alias: {'zap-loader': path.join(__dirname, 'loaders/zap-loader.js')}
},
module: {
rules: [
{
test: /\.js$/,
use: [
'zap-loader'
]
},
{
test: /\.vue$/,
use: [
'vue-loader'
]
}
]
},
plugins: [
new VueLoaderPlugin()
]
}
Loading