-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb4caec
commit a67248a
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Panoptes.js dev app</title> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>Panoptes.js dev app</h1> | ||
<form | ||
id="login-form" | ||
method="POST" | ||
> | ||
<input type="text" name="username" /> | ||
<br> | ||
<input type="password" name="password" /> | ||
<br> | ||
<button type="submit">Login</button> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class App { | ||
constructor () { | ||
this.html = { | ||
loginForm: document.getElementById('login-form') | ||
} | ||
|
||
this.html.loginForm.addEventListener('submit', this.loginForm_onSubmit.bind(this)) | ||
} | ||
|
||
loginForm_onSubmit (e) { | ||
console.log('+++ loginForm_onSubmit', e) | ||
|
||
e.preventDefault() | ||
return false | ||
} | ||
} | ||
|
||
function init () { | ||
new App() | ||
} | ||
|
||
window.onload = init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
const { execSync } = require('child_process') | ||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
|
||
function gitCommit() { | ||
try { | ||
const commitHash = execSync('git describe --always').toString('utf8').trim() | ||
return commitHash | ||
} catch (error) { | ||
console.log(error) | ||
return 'Not a git repository.' | ||
} | ||
} | ||
|
||
const EnvironmentWebpackPlugin = new webpack.EnvironmentPlugin({ | ||
COMMIT_ID: gitCommit(), | ||
DEBUG: false, | ||
NODE_ENV: 'development', | ||
PANOPTES_ENV: 'staging' | ||
}) | ||
|
||
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({ | ||
template: './dev/index.html', | ||
filename: 'index.html', | ||
inject: 'body' | ||
}) | ||
|
||
module.exports = { | ||
devServer: { | ||
allowedHosts: [ | ||
'bs-local.com', | ||
'localhost', | ||
'.zooniverse.org' | ||
], | ||
server: 'https' | ||
}, | ||
entry: [ | ||
'./dev/index.js' | ||
], | ||
mode: 'development', | ||
resolve: { | ||
fallback: { | ||
fs: false, | ||
// for markdown-it plugins | ||
path: require.resolve("path-browserify"), | ||
process: false, | ||
url: false, | ||
} | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js?$/, | ||
exclude: /node_modules/, | ||
use: [{ | ||
loader: 'babel-loader', | ||
options: { compact: false } | ||
}] | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader' | ||
] | ||
} | ||
] | ||
}, | ||
output: { | ||
path: path.resolve('build'), | ||
filename: 'main.js', | ||
library: '@zooniverse/user', | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true | ||
}, | ||
plugins: [ | ||
new webpack.ProvidePlugin({ | ||
process: 'process/browser', | ||
}), | ||
EnvironmentWebpackPlugin, | ||
HtmlWebpackPluginConfig | ||
] | ||
} |