浏览代码

added react redux project type

Brandon Wong 7 年之前
父节点
当前提交
42e9b34388
共有 10 个文件被更改,包括 140 次插入0 次删除
  1. 9 0
      redux/.babelrc
  2. 6 0
      redux/.gitignore
  3. 13 0
      redux/index.html
  4. 39 0
      redux/package.json
  5. 8 0
      redux/src/actions.js
  6. 9 0
      redux/src/components/App.js
  7. 22 0
      redux/src/main.js
  8. 11 0
      redux/src/reducers/index.js
  9. 7 0
      redux/styles/style.css
  10. 16 0
      redux/test/main.js

+ 9 - 0
redux/.babelrc

@@ -0,0 +1,9 @@
+{
+  "presets": ["latest", "react"],
+  "plugins": ["transform-runtime", "transform-object-rest-spread"],
+  "env": {
+    "production": {
+      "plugins": ["transform-remove-console"]
+    }
+  }
+}

+ 6 - 0
redux/.gitignore

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

+ 13 - 0
redux/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>

+ 39 - 0
redux/package.json

@@ -0,0 +1,39 @@
+{
+  "name": "@brwong/$foldername",
+  "author": "Brandon Wong",
+  "version": "0.1.0",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "postinstall": "npm run compile",
+    "compile-prod": "cross-env NODE_ENV=production npm run compile",
+    "compile": "npm run compile-src; npm run compile-test; npm run compile-frontend",
+    "compile-both": "npm run compile-src; npm run compile-frontend",
+    "compile-test": "babel test --out-dir test-build",
+    "compile-src": "babel src --out-dir build",
+    "compile-frontend": "webpack build/main.js build/bundle.js --module-bind 'js=babel-loader'",
+    "watch": "nodemon --watch src --watch test --watch styles -e js,css,html --exec \"npm run compile --silent\""
+  },
+  "dependencies": {
+    "babel-cli": "^6.18.0",
+    "babel-core": "^6.18.2",
+    "babel-loader": "^6.2.8",
+    "babel-plugin-transform-object-rest-spread": "^6.19.0",
+    "babel-plugin-transform-remove-console": "^6.8.0",
+    "babel-plugin-transform-runtime": "^6.15.0",
+    "babel-preset-latest": "^6.16.0",
+    "babel-preset-react": "^6.16.0",
+    "cross-env": "^1.0.8",
+    "react": "^15.4.1",
+    "react-dom": "^15.4.1",
+    "react-redux": "^4.4.6",
+    "redux": "^3.6.0",
+    "redux-thunk": "^2.1.0",
+    "webpack": "^1.13.3"
+  },
+  "devDependencies": {
+    "nodemon": "^1.9.1",
+    "tape-promise": "^2.0.0",
+    "tape": "^4.5.1"
+  },
+  "private": true
+}

+ 8 - 0
redux/src/actions.js

@@ -0,0 +1,8 @@
+
+
+export function action() {
+    return {
+        type: 'ACTION',
+    };
+}
+

+ 9 - 0
redux/src/components/App.js

@@ -0,0 +1,9 @@
+
+import React from 'react';
+
+
+export default function App() {
+    return <div>application</div>;
+}
+
+

+ 22 - 0
redux/src/main.js

@@ -0,0 +1,22 @@
+
+import React from 'react';
+import ReactDOM from 'react-dom';
+import { Provider, connect } from 'react-redux';
+import { createStore, applyMiddleware } from 'redux';
+import thunkMiddleware from 'redux-thunk';
+
+import App from './components/App.js';
+
+/*
+ex:
+createStore(reducer, applyMiddleware(thunkMiddleware))
+*/
+
+
+ReactDOM.render(
+    <App />,
+    document.getElementById('container')
+);
+
+
+

+ 11 - 0
redux/src/reducers/index.js

@@ -0,0 +1,11 @@
+
+import { combineReducers } from 'redux';
+//import reducer from './reducer.js';
+
+const mainReducer = combineReducers({
+    
+});
+
+export { mainReducer as default };
+
+

+ 7 - 0
redux/styles/style.css

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

+ 16 - 0
redux/test/main.js

@@ -0,0 +1,16 @@
+
+import tape from 'tape';
+import _test from 'tape-promise';
+
+const tapetest = _test(tape);
+
+import * as reducers from '../build/reducers/index.js';
+import * as actions from '../build/actions.js';
+
+
+tapetest('test', async function testProgram(t) {
+    t.pass('empty test file');
+    t.end();
+});
+
+