From 64b8e34bbba5a7c33ff918e530acd0e3d324df36 Mon Sep 17 00:00:00 2001 From: stefano solinas Date: Sun, 22 Jan 2017 21:04:05 +0000 Subject: [PATCH 01/14] Adding React, building the feedback page --- package.json | 131 +- src/assets/popup.html | 1 + src/client/README.md | 234 + src/client/bin/compile.js | 56 + src/client/bin/dev-server.js | 6 + src/client/config/environments.config.js | 29 + src/client/config/karma.config.js | 73 + src/client/config/project.config.js | 133 + src/client/config/webpack.config.js | 217 + src/client/package.json | 148 + src/client/server/main.js | 69 + src/client/src/components/Header/Header.js | 42 + src/client/src/components/Header/Header.scss | 0 src/client/src/components/Header/index.js | 3 + src/client/src/components/Sidebar/Sidebar.js | 82 + .../src/components/Sidebar/Sidebar.scss | 15 + .../Sidebar/assets/background_sidebar.png | Bin 0 -> 65372 bytes .../Sidebar/assets/logo_dashboard.png | Bin 0 -> 52906 bytes src/client/src/components/Sidebar/index.js | 3 + src/client/src/containers/AppContainer.js | 30 + src/client/src/index.html | 32 + .../src/layouts/CoreLayout/CoreLayout.js | 23 + .../src/layouts/CoreLayout/CoreLayout.scss | 3 + src/client/src/layouts/CoreLayout/index.js | 3 + src/client/src/main.js | 60 + .../src/routes/Counter/components/Counter.js | 22 + .../Counter/containers/CounterContainer.js | 38 + src/client/src/routes/Counter/index.js | 24 + .../src/routes/Counter/modules/counter.js | 56 + .../src/routes/Home/components/HomeView.js | 25 + .../src/routes/Home/components/HomeView.scss | 5 + src/client/src/routes/Home/index.js | 6 + src/client/src/routes/index.js | 36 + src/client/src/store/createStore.js | 52 + src/client/src/store/location.js | 31 + src/client/src/store/reducers.js | 18 + src/client/src/styles/_bootstrap.scss | 56 + .../styles/_light-bootstrap-dashboard.scss | 3393 +++++++++ src/client/src/styles/core.scss | 2 + src/client/tests/.eslintrc | 11 + .../tests/components/Header/Header.spec.js | 36 + src/client/tests/layouts/CoreLayout.spec.js | 33 + .../routes/Counter/components/Counter.spec.js | 80 + src/client/tests/routes/Counter/index.spec.js | 17 + .../routes/Counter/modules/counter.spec.js | 125 + .../routes/Home/components/HomeView.spec.js | 23 + src/client/tests/routes/Home/index.spec.js | 17 + src/client/tests/store/createStore.spec.js | 29 + src/client/tests/store/location.spec.js | 84 + src/client/tests/test-bundler.js | 37 + src/client/yarn.lock | 6037 +++++++++++++++++ 51 files changed, 11682 insertions(+), 4 deletions(-) create mode 100755 src/client/README.md create mode 100755 src/client/bin/compile.js create mode 100755 src/client/bin/dev-server.js create mode 100755 src/client/config/environments.config.js create mode 100755 src/client/config/karma.config.js create mode 100755 src/client/config/project.config.js create mode 100755 src/client/config/webpack.config.js create mode 100755 src/client/package.json create mode 100755 src/client/server/main.js create mode 100755 src/client/src/components/Header/Header.js create mode 100755 src/client/src/components/Header/Header.scss create mode 100755 src/client/src/components/Header/index.js create mode 100755 src/client/src/components/Sidebar/Sidebar.js create mode 100755 src/client/src/components/Sidebar/Sidebar.scss create mode 100644 src/client/src/components/Sidebar/assets/background_sidebar.png create mode 100644 src/client/src/components/Sidebar/assets/logo_dashboard.png create mode 100755 src/client/src/components/Sidebar/index.js create mode 100755 src/client/src/containers/AppContainer.js create mode 100755 src/client/src/index.html create mode 100755 src/client/src/layouts/CoreLayout/CoreLayout.js create mode 100755 src/client/src/layouts/CoreLayout/CoreLayout.scss create mode 100755 src/client/src/layouts/CoreLayout/index.js create mode 100755 src/client/src/main.js create mode 100755 src/client/src/routes/Counter/components/Counter.js create mode 100755 src/client/src/routes/Counter/containers/CounterContainer.js create mode 100755 src/client/src/routes/Counter/index.js create mode 100755 src/client/src/routes/Counter/modules/counter.js create mode 100755 src/client/src/routes/Home/components/HomeView.js create mode 100755 src/client/src/routes/Home/components/HomeView.scss create mode 100755 src/client/src/routes/Home/index.js create mode 100755 src/client/src/routes/index.js create mode 100755 src/client/src/store/createStore.js create mode 100755 src/client/src/store/location.js create mode 100755 src/client/src/store/reducers.js create mode 100644 src/client/src/styles/_bootstrap.scss create mode 100644 src/client/src/styles/_light-bootstrap-dashboard.scss create mode 100755 src/client/src/styles/core.scss create mode 100755 src/client/tests/.eslintrc create mode 100755 src/client/tests/components/Header/Header.spec.js create mode 100755 src/client/tests/layouts/CoreLayout.spec.js create mode 100755 src/client/tests/routes/Counter/components/Counter.spec.js create mode 100755 src/client/tests/routes/Counter/index.spec.js create mode 100755 src/client/tests/routes/Counter/modules/counter.spec.js create mode 100755 src/client/tests/routes/Home/components/HomeView.spec.js create mode 100755 src/client/tests/routes/Home/index.spec.js create mode 100755 src/client/tests/store/createStore.spec.js create mode 100755 src/client/tests/store/location.spec.js create mode 100755 src/client/tests/test-bundler.js create mode 100755 src/client/yarn.lock diff --git a/package.json b/package.json index 4645ba5..26ffb15 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,82 @@ "description": "Worldbrain.io research engine", "main": "index.js", "dependencies": { + "babel-core": "^6.17.0", + "babel-loader": "^6.2.5", + "babel-plugin-transform-runtime": "^6.15.0", + "babel-preset-es2015": "^6.14.0", + "babel-preset-react": "^6.11.1", + "babel-preset-stage-0": "^6.3.13", + "babel-runtime": "^6.11.6", + "better-npm-run": "0.0.13", + "bootstrap": "^3.3.7", + "bootstrap-sass": "^3.3.7", "cheerio": "^0.22.0", + "compression": "^1.6.2", + "css-loader": "^0.26.0", + "cssnano": "^3.7.4", + "debug": "^2.2.0", + "extract-text-webpack-plugin": "^1.0.0", + "file-loader": "^0.9.0", "fs": "0.0.1-security", + "fs-extra": "^1.0.0", + "html-webpack-plugin": "^2.22.0", + "imports-loader": "^0.7.0", + "ip": "^1.1.2", + "json-loader": "^0.5.4", "lodash": "^4.17.4", - "npm-run-all": "^4.0.0" + "node-sass": "^4.0.0", + "normalize.css": "^5.0.0", + "npm-run-all": "^4.0.0", + "postcss-loader": "^1.1.0", + "react": "^15.0.0", + "react-dom": "^15.0.0", + "react-redux": "^5.0.1", + "react-router": "^3.0.0", + "redux": "^3.6.0", + "redux-thunk": "^2.0.0", + "rimraf": "^2.5.4", + "sass-loader": "^4.0.0", + "style-loader": "^0.13.1", + "url-loader": "^0.5.6", + "webpack": "^1.12.14", + "yargs": "^6.3.0" }, "devDependencies": { "cpx": "^1.5.0", - "watchify": "^3.8.0" + "browserify": "^13.1.1", + "watchify": "^3.8.0", + "babel-eslint": "^7.1.0", + "babel-plugin-istanbul": "^3.0.0", + "chai": "^3.4.1", + "chai-as-promised": "^6.0.0", + "chai-enzyme": "^0.6.1", + "cheerio": "^0.22.0", + "codecov": "^1.0.1", + "enzyme": "^2.0.0", + "eslint": "^3.0.1", + "eslint-config-standard": "^6.0.0", + "eslint-config-standard-react": "^4.0.0", + "eslint-plugin-babel": "^4.0.0", + "eslint-plugin-promise": "^3.0.0", + "eslint-plugin-react": "^6.0.0", + "eslint-plugin-standard": "^2.0.0", + "express": "^4.14.0", + "karma": "^1.0.0", + "karma-coverage": "^1.0.0", + "karma-mocha": "^1.0.1", + "karma-mocha-reporter": "^2.0.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-webpack-with-fast-source-maps": "^1.9.2", + "mocha": "^3.0.1", + "nodemon": "^1.10.2", + "phantomjs-prebuilt": "^2.1.12", + "react-addons-test-utils": "^15.0.0", + "redbox-react": "^1.2.10", + "sinon": "^1.17.5", + "sinon-chai": "^2.8.0", + "webpack-dev-middleware": "^1.6.1", + "webpack-hot-middleware": "^2.12.2" }, "scripts": { "build": "npm-run-all build:*", @@ -24,7 +92,13 @@ "watch:copy-assets": "cpx 'src/assets/**/*.*' build/assets --watch", "build:browserify": "mkdir -p ./build/js && browserify src/js-browserify/download_urls.js -o build/js/bundle.js", "watch:browserify": "mkdir -p ./build/js && watchify src/js-browserify/download_urls.js -o build/js/bundle.js", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "watch:react": "better-npm-run start", + "build:react": "better-npm-run deploy:prod", + "copy:react": "cpx 'src/client/dist/**/*.*' build/client", + "react-build:clean": "rimraf dist/client", + "react-build:react": "better-npm-run deploy", + "react-build:react-compile": "better-npm-run compile" }, "repository": { "type": "git", @@ -35,5 +109,54 @@ "bugs": { "url": "https://github.com/WorldBrain/Research-Engine/issues" }, - "homepage": "https://github.com/WorldBrain/Research-Engine#readme" + "homepage": "https://github.com/WorldBrain/Research-Engine#readme", + "betterScripts": { + "compile": { + "command": "node src/client/bin/compile && npm run copy:react", + "env": { + "DEBUG": "app:*" + } + }, + "dev": { + "command": "nodemon bin/dev-server --ignore dist --ignore coverage --ignore tests --ignore src", + "env": { + "NODE_ENV": "development", + "DEBUG": "app:*" + } + }, + "deploy": { + "command": "npm run react-build:clean && npm run react-build:react-compile", + "env": { + "DEBUG": "app:*" + } + }, + "deploy:dev": { + "command": "npm run react-build:react", + "env": { + "NODE_ENV": "development", + "DEBUG": "app:*" + } + }, + "deploy:prod": { + "command": "npm run react-build:react", + "env": { + "NODE_ENV": "production", + "BASENAME": "/client/", + "DEBUG": "app:*" + } + }, + "start": { + "command": "node src/client/bin/dev-server", + "env": { + "DEBUG": "app:*" + } + }, + "test": { + "command": "node ./node_modules/karma/bin/karma start config/karma.config", + "env": { + "NODE_ENV": "test", + "DEBUG": "app:*" + } + } + } } diff --git a/src/assets/popup.html b/src/assets/popup.html index 4dfc22c..f2b78d5 100644 --- a/src/assets/popup.html +++ b/src/assets/popup.html @@ -39,6 +39,7 @@ FAQs How to use the tool Feedback + Feedback Import History & Bookmarks diff --git a/src/client/README.md b/src/client/README.md new file mode 100755 index 0000000..37accec --- /dev/null +++ b/src/client/README.md @@ -0,0 +1,234 @@ +#Obsidianart - a couple of notes to myself +- Fix the watcher (currently run the watch on localhost) +- remove all unused files etc (like this readme) +- keep a link to the source of this project (just in case) +- npm run watch:react to start the server +- npm run build:react to build in the dist folder +- Fix the clean script for the react folder (inside dist) + + + + + + +# React Redux Starter Kit + +[![Join the chat at https://gitter.im/davezuko/react-redux-starter-kit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/davezuko/react-redux-starter-kit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/davezuko/react-redux-starter-kit.svg?branch=master)](https://travis-ci.org/davezuko/react-redux-starter-kit?branch=master) +[![dependencies](https://david-dm.org/davezuko/react-redux-starter-kit.svg)](https://david-dm.org/davezuko/react-redux-starter-kit) +[![devDependency Status](https://david-dm.org/davezuko/react-redux-starter-kit/dev-status.svg)](https://david-dm.org/davezuko/react-redux-starter-kit#info=devDependencies) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) + +This starter kit is designed to get you up and running with a bunch of awesome new front-end technologies, all on top of a configurable, feature-rich webpack build system that's already setup to provide hot reloading, CSS preprocessing with Sass, unit testing, code coverage reports, bundle splitting, and more. + +The primary goal of this project is to remain as **unopinionated** as possible. Its purpose is not to dictate your project structure or to demonstrate a complete sample application, but to provide a set of tools intended to make front-end development robust, easy, and, most importantly, fun. Check out the full feature list below! + +Finally, This project wouldn't be possible without the help of our many contributors, so [thank you](#thank-you) for all of your help. + +## Table of Contents +1. [Features](#features) +1. [Requirements](#requirements) +1. [Getting Started](#getting-started) +1. [Application Structure](#application-structure) +1. [Development](#development) + 1. [Developer Tools](#developer-tools) + 1. [Routing](#routing) +1. [Testing](#testing) +1. [Deployment](#deployment) +1. [Build System](#build-system) + 1. [Configuration](#configuration) + 1. [Globals](#globals) + 1. [Styles](#styles) + 1. [Server](#server) + 1. [Production Optimization](#production-optimization) +1. [Learning Resources](#learning-resources) +1. [FAQ](#troubleshooting) +1. [Thank You](#thank-you) + +## Features +* [react](https://github.com/facebook/react) +* [redux](https://github.com/rackt/redux) +* [react-router](https://github.com/rackt/react-router) +* [webpack](https://github.com/webpack/webpack) +* [babel](https://github.com/babel/babel) +* [express](https://github.com/expressjs/express) +* [karma](https://github.com/karma-runner/karma) +* [eslint](http://eslint.org) + +## Requirements +* node `^4.5.0` +* yarn `^0.17.0` or npm `^3.0.0` + +## Getting Started + +After confirming that your development environment meets the specified [requirements](#requirements), you can create a new project based on `react-redux-starter-kit` by doing the following: + +### Install from source + +First, clone the project: + +```bash +$ git clone https://github.com/davezuko/react-redux-starter-kit.git +$ cd +``` + +Then install dependencies and check to see it works. It is recommended that you use [Yarn](https://yarnpkg.com/) for deterministic installs, but `npm install` will work just as well. + +```bash +$ yarn install # Install project dependencies +$ yarn start # Compile and launch (same as `npm start`) +``` +If everything works, you should see the following: + + + +While developing, you will probably rely mostly on `npm start`; however, there are additional scripts at your disposal: + +|`npm run