Skip to content

Commit

Permalink
updating frontend project structure to work with IDEA
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-mcginty committed Jun 4, 2020
1 parent 1e737df commit 8cf9a88
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gradle
out
stale_outputs_checked
src/main/resources/public/dist
src/main/js/**/*.js
frontend/**/*.js
node_modules
lib
.merlin
21 changes: 10 additions & 11 deletions bsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"name": "bs",
"version": "0.1.0",
"name": "reason-react-examples",
"reason": {
"react-jsx": 3,
},
"sources": {
"dir" : "src/main/js",
"dir" : "frontend",
"subdirs" : true
},
"package-specs": {
"bsc-flags": ["-bs-super-errors", "-bs-no-version-header"],
"package-specs": [{
"module": "commonjs",
"in-source": true
},
}],
"suffix": ".bs.js",
"namespace": true,
"bs-dependencies": [
"reason-react"
],
"warnings": {
"error" : "+101"
},
"reason": {
"react-jsx": 3
},
"refmt": 3
}
1 change: 1 addition & 0 deletions frontend/Login.re
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ReactDOMRe.renderToElementWithId(<LoginPage name="John" />, "login-page-app");
Empty file added frontend/Main.re
Empty file.
3 changes: 3 additions & 0 deletions frontend/components/loginPage/LoginPage.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[@react.component]
let make = (~name) =>
<div> {ReasonReact.string("Hello " ++ name ++ "!")} </div>;
74 changes: 68 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"name": "bs",
"name": "bringo",
"version": "0.1.0",
"scripts": {
"webpack": "webpack",
"clean": "bsb -clean-world",
"build": "bsb -make-world && webpack",
"watch": "bsb -make-world -w"
"start": "bsb -make-world -w -ws _ ",
"clean": "bsb -clean-world",
"server": "moduleserve ./ --port 8000",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"BuckleScript"
"BuckleScript",
"ReasonReact",
"reason-react"
],
"author": "",
"license": "MIT",
"dependencies": {
"react": "^16.8.1",
"react-dom": "^16.8.1",
"reason-react": "^0.8.0"
},
"devDependencies": {
"bs-platform": "^7.3.2",
"webpack": "^4.43.0",
Expand Down
3 changes: 0 additions & 3 deletions src/main/js/main.ml

This file was deleted.

8 changes: 2 additions & 6 deletions src/main/resources/templates/login.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
<title>Test</title>
</head>
<body>
Login Page bitches!
<form action="/login" method="post">
<input name="uname" required />
<input name="pdub" type="password" required />
<button type="submit">Submit</button>
</form>
<section id="login-page-app"></section>
<script src="/dist/login.js"></script>
</body>
</html>
12 changes: 9 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
const path = require('path');

module.exports = {
entry: path.resolve(__dirname, 'src/main/js/main.bs.js'),
module.exports = [{
entry: path.resolve(__dirname, 'frontend/Main.bs.js'),
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'src/main/resources/public/dist'),
},
};
}, {
entry: path.resolve(__dirname, 'frontend/Login.bs.js'),
output: {
filename: 'login.js',
path: path.resolve(__dirname, 'src/main/resources/public/dist'),
},
}];

0 comments on commit 8cf9a88

Please sign in to comment.