Skip to content

Commit

Permalink
Merge pull request #147 from dscrobonia/add-webpack
Browse files Browse the repository at this point in the history
Add xo linter, ava test framework, webpack build tool, README
  • Loading branch information
psiinon committed Jul 12, 2018
2 parents 4bd3026 + 3021e0b commit 6925acb
Show file tree
Hide file tree
Showing 8 changed files with 9,595 additions and 0 deletions.
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/
18 changes: 18 additions & 0 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,24 @@
<build-deploy-addon name="hud" />
</target>

<target name="lint-staged-hud" description="run the XO linter on the staged hud extension">
<exec executable="npm">
<arg line="run lint-staged" />
</exec>
</target>

<target name="lint-all-hud" description="run the XO linter on all files of the hud extension">
<exec executable="npm">
<arg line="run lint" />
</exec>
</target>

<target name="test-hud" description="run the ava tests for the hud extension">
<exec executable="npm">
<arg line="run test" />
</exec>
</target>

<target name="deploy-and-reset-hud" description="deploy the hud extension and delete the config directory">
<build-deploy-addon name="hud" />
<delete dir="${hud.config.dir}"/>
Expand Down
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

0 comments on commit 6925acb

Please sign in to comment.