Bladeren bron

added basic react support

Brandon Wong 8 jaren geleden
bovenliggende
commit
1c600c082c
8 gewijzigde bestanden met toevoegingen van 79 en 0 verwijderingen
  1. 2 0
      maker.sh
  2. 3 0
      react/.babelrc
  3. 6 0
      react/.gitignore
  4. 13 0
      react/index.html
  5. 28 0
      react/package.json
  6. 20 0
      react/src/main.js
  7. 7 0
      react/styles/style.css
  8. 0 0
      react/test/main.js

+ 2 - 0
maker.sh

@@ -41,5 +41,7 @@ do
     sed -i "s/\$foldername/$foldername/" $i;
 done;
 
+
+echo "Don't forget to run \"npm init\" as well as \"npm install\""
 echo "done."
 

+ 3 - 0
react/.babelrc

@@ -0,0 +1,3 @@
+{
+  "presets": ["es2015", "react"]
+}

+ 6 - 0
react/.gitignore

@@ -0,0 +1,6 @@
+.idea
+node_modules
+build
+test-build
+npm-debug*
+*.swp

+ 13 - 0
react/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>$foldername</title>
+    <link rel="stylesheet" href="styles/style.css">
+</head>
+<body>
+    <h2>$foldername</h2>
+    <div id="container"></div>
+    <script src="build/bundle.js"></script>
+</body>
+</html>

+ 28 - 0
react/package.json

@@ -0,0 +1,28 @@
+{
+  "name": "$foldername",
+  "version": "0.1.0",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "postinstall": "npm run compile",
+    "compile-test": "babel test --out-dir test-build",
+    "compile-src": "babel src --out-dir build",
+    "compile-frontend": "webpack src/main.js build/bundle.js --module-bind 'js=babel-loader'",
+    "compile": "npm run compile-src; npm run compile-test; npm run compile-frontend",
+    "watch": "nodemon --watch src --watch test --watch styles -e js,css,html --exec \"npm run compile --silent\""
+  },
+  "private": true,
+  "dependencies": {
+    "babel-cli": "^6.6.5",
+    "babel-core": "^6.7.7",
+    "babel-loader": "^6.2.4",
+    "babel-preset-es2015": "^6.6.0",
+    "babel-preset-react": "^6.5.0",
+    "react": "^15.0.1",
+    "react-dom": "^15.0.1",
+    "webpack": "^1.13.0"
+  },
+  "devDependencies": {
+    "blue-tape": "^0.2.0",
+    "nodemon": "^1.9.1"
+  }
+}

+ 20 - 0
react/src/main.js

@@ -0,0 +1,20 @@
+
+import React from 'react';
+import ReactDOM from 'react-dom';
+
+
+const App = React.createClass({
+    render() {
+        return <div></div>;
+    },
+});
+
+
+
+ReactDOM.render(
+    <App />,
+    document.getElementById('container')
+);
+
+
+

+ 7 - 0
react/styles/style.css

@@ -0,0 +1,7 @@
+/* styles */
+
+
+
+
+
+

+ 0 - 0
react/test/main.js