From 96def1c960d9f3e06f78f7af68eeb5eb7a8661a4 Mon Sep 17 00:00:00 2001 From: Nik Graf Date: Wed, 24 Feb 2016 18:10:14 -0800 Subject: [PATCH] initial setup --- .babelrc | 8 + .eslintignore | 3 + .eslintrc | 9 + .flowconfig | 20 ++ .gitignore | 15 ++ .jscsrc | 11 + .npmignore | 17 ++ .travis.yml | 7 + CHANGELOG.md | 5 + LICENSE | 7 + README.md | 5 + interfaces/CSSModule.js | 7 + package.json | 91 +++++++ scripts/publish_gh_pages.sh | 18 ++ site/README.md | 18 ++ site/css/normalize.css | 425 ++++++++++++++++++++++++++++++ site/css/style.css | 32 +++ site/index.html | 17 ++ site/index.js | 8 + site/package.json | 33 +++ site/server.js | 32 +++ site/webpack.config.js | 46 ++++ site/webpack.config.production.js | 43 +++ src/components/Editor/index.js | 15 ++ src/index.js | 5 + 25 files changed, 897 insertions(+) create mode 100644 .babelrc create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100644 .flowconfig create mode 100644 .gitignore create mode 100644 .jscsrc create mode 100644 .npmignore create mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 interfaces/CSSModule.js create mode 100644 package.json create mode 100755 scripts/publish_gh_pages.sh create mode 100644 site/README.md create mode 100644 site/css/normalize.css create mode 100644 site/css/style.css create mode 100644 site/index.html create mode 100644 site/index.js create mode 100644 site/package.json create mode 100644 site/server.js create mode 100644 site/webpack.config.js create mode 100644 site/webpack.config.production.js create mode 100644 src/components/Editor/index.js create mode 100644 src/index.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000000..c89d979d7a --- /dev/null +++ b/.babelrc @@ -0,0 +1,8 @@ +{ + "presets": ["react", "es2015", "stage-0"], + "env": { + "development": { + "presets": ["react-hmre"] + } + } +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..955fc4121b --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +**/node_modules/** +lib/** +scripts/** diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000..0407af2279 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,9 @@ +{ + "parser": "babel-eslint", + "plugins": [ "mocha" ], + "extends": "airbnb", + "rules": { + "max-len": 0, + "comma-dangle": 0 + } +} diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000000..99e871e950 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,20 @@ +[ignore] +.*docs/node_modules.* +.*examples/node_modules.* +.*node_modules/babel.* +.*node_modules/fbjs.* + +[include] +.*node_modules/react + +[libs] +./interfaces/CSSModule.js + +[options] +esproposal.class_static_fields=enable +module.name_mapper='.*\(.css\)' -> 'CSSModule' +module.system=haste +strip_root=true + +[version] +0.21.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..be7c4bde37 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Browserify cache & build files +bundle.js +.bundle.js + +# build +/lib/ + +# NPM debug +npm-debug.log +npm-debug.log* diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000000..ca601a0a87 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,11 @@ +{ + "preset": "airbnb", + "validateQuoteMarks": null, + "maximumLineLength": false, + "excludeFiles": [ + "coverage/**", + "node_modules/**", + "**/node_modules/**", + "lib/**" + ] +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000000..f61f012115 --- /dev/null +++ b/.npmignore @@ -0,0 +1,17 @@ +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Browserify cache & build files +bundle.js +.bundle.js + +# sources +/src/ + +# NPM debug +npm-debug.log + +tests +docs diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..010cc90699 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- "5" +sudo: false +script: + - npm test + - npm run lint diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..134ea9e92e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Change Log +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## To Be Released diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..1732d66c99 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2016 Nikolaus Graf + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000000..876eab0d38 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Unicorn Editor + +## License + +MIT diff --git a/interfaces/CSSModule.js b/interfaces/CSSModule.js new file mode 100644 index 0000000000..5a71bd2c0a --- /dev/null +++ b/interfaces/CSSModule.js @@ -0,0 +1,7 @@ +declare module CSSModule { // eslint-disable-line + declare var exports: { [key: string]: string }; +} + +declare module 'CSSModule' { + declare var exports: { [key: string]: string }; +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000..65120feecd --- /dev/null +++ b/package.json @@ -0,0 +1,91 @@ +{ + "name": "unicorn-editor", + "version": "0.0.0", + "description": "Everything about Unicorns!", + "author": { + "name": "Nik Graf", + "email": "nik@nikgraf.com", + "url": "http://www.nikgraf.com" + }, + "repository": { + "type": "git", + "url": "http://github.com/nikgraf/unicorn-editor.git" + }, + "main": "lib/index.js", + "keywords": [ + "unicorn", + "react", + "ux", + "components", + "widget", + "react-component" + ], + "peerDependencies": { + "react": ">=0.14.0", + "react-dom": ">=0.14.0" + }, + "scripts": { + "build": "BABEL_ENV=production ./node_modules/.bin/babel --out-dir='lib' --ignore='__tests__/*' src", + "prepublish": "npm run build", + "postpublish": "./scripts/publish_gh_pages.sh", + "test": "BABEL_ENV=test BABEL_JEST_STAGE=0 jest src/", + "test:watch": "npm run test -- --watch", + "lint": "npm run lint:eslint && npm run lint:jscs", + "lint:eslint": "eslint --rule 'mocha/no-exclusive-tests:2' ./", + "lint:eslint:fix": "eslint --fix --rule 'mocha/no-exclusive-tests:2' ./", + "lint:jscs": "jscs ./", + "lint:jscs:src": "jscs src", + "lint:jscs:examples": "jscs examples --max-old-space-size=4096", + "lint:jscs:docs": "jscs docs", + "alex": "alex README.md" + }, + "devDependencies": { + "alex": "^2.0.1", + "babel-cli": "^6.5.1", + "babel-core": "^6.5.2", + "babel-eslint": "^5.0.0", + "babel-jest": "^6.0.1", + "babel-loader": "^6.2.3", + "babel-plugin-react-transform": "^2.0.0", + "babel-preset-es2015": "^6.5.0", + "babel-preset-react": "^6.5.0", + "babel-preset-react-hmre": "^1.1.0", + "babel-preset-stage-0": "^6.5.0", + "css-loader": "^0.23.1", + "eslint": "^2.2.0", + "eslint-config-airbnb": "6.0.2", + "eslint-plugin-mocha": "^2.0.0", + "eslint-plugin-react": "^4.1.0", + "jest-cli": "^0.8.2", + "jscs": "^2.10.1", + "react": "^0.14.7", + "react-addons-test-utils": "^0.14.7", + "react-dom": "^0.14.7", + "react-transform-catch-errors": "^1.0.2", + "react-transform-hmr": "^1.0.2", + "redbox-react": "^1.2.2", + "style-loader": "^0.13.0", + "webpack": "^1.12.14", + "webpack-dev-middleware": "^1.5.1", + "webpack-hot-middleware": "^2.7.1" + }, + "jest": { + "testRunner": "/node_modules/jest-cli/src/testRunners/jasmine/jasmine2.js", + "unmockedModulePathPatterns": [ + "/node_modules/react", + "/node_modules/fbjs", + "/node_modules/react-dom", + "/node_modules/react-addons-test-utils", + "../utils/helpers", + "../utils/union-class-names", + "../utils/is-component-of-type" + ], + "scriptPreprocessor": "/node_modules/babel-jest", + "preprocessCachingDisabled": true + }, + "license": "MIT", + "dependencies": { + "classnames": "^2.2.3", + "extract-text-webpack-plugin": "^1.0.1" + } +} diff --git a/scripts/publish_gh_pages.sh b/scripts/publish_gh_pages.sh new file mode 100755 index 0000000000..4c8eb46321 --- /dev/null +++ b/scripts/publish_gh_pages.sh @@ -0,0 +1,18 @@ +git checkout master +git checkout -b tmp-gh-pages +rm .gitignore + +cd site +npm prune +npm install +npm run build + +git add static/bundle.js +git add css/googlecode.css +git commit -am 'add files' +cd .. +git subtree split --prefix site -b gh-pages +git push -f origin gh-pages:gh-pages +git checkout master +git branch -D tmp-gh-pages +git branch -D gh-pages diff --git a/site/README.md b/site/README.md new file mode 100644 index 0000000000..ab24063303 --- /dev/null +++ b/site/README.md @@ -0,0 +1,18 @@ +Unicorn Editor Site +================ + +## Install + +``` +npm install +``` + +Make sure you ran `npm install` in the root folder of site. + +## Run + +``` +npm start +``` + +The app will run with hot reloading on `http://localhost:3000`. diff --git a/site/css/normalize.css b/site/css/normalize.css new file mode 100644 index 0000000000..2c178bb8cc --- /dev/null +++ b/site/css/normalize.css @@ -0,0 +1,425 @@ +/*! normalize.css v3.0.1 | MIT License | git.io/normalize */ + +/** +* 1. Set default font family to sans-serif. +* 2. Prevent iOS text size adjust after orientation change, without disabling +* user zoom. +*/ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** +* Remove default margin. +*/ + +body { + margin: 0; +} + +/* HTML5 display definitions +========================================================================== */ + +/** +* Correct `block` display not defined for any HTML5 element in IE 8/9. +* Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. +* Correct `block` display not defined for `main` in IE 11. +*/ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** +* 1. Correct `inline-block` display not defined in IE 8/9. +* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. +*/ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** +* Prevent modern browsers from displaying `audio` without controls. +* Remove excess height in iOS 5 devices. +*/ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** +* Address `[hidden]` styling not present in IE 8/9/10. +* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. +*/ + +[hidden], +template { + display: none; +} + +/* Links +========================================================================== */ + +/** +* Remove the gray background color from active links in IE 10. +*/ + +a { + background: transparent; +} + +/** +* Improve readability when focused and also mouse hovered in all browsers. +*/ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics +========================================================================== */ + +/** +* Address styling not present in IE 8/9/10/11, Safari, and Chrome. +*/ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** +* Address style set to `bolder` in Firefox 4+, Safari, and Chrome. +*/ + +b, +strong { + font-weight: bold; +} + +/** +* Address styling not present in Safari and Chrome. +*/ + +dfn { + font-style: italic; +} + +/** +* Address variable `h1` font-size and margin within `section` and `article` +* contexts in Firefox 4+, Safari, and Chrome. +*/ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** +* Address styling not present in IE 8/9. +*/ + +mark { + background: #ff0; + color: #000; +} + +/** +* Address inconsistent and variable font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/** +* Prevent `sub` and `sup` affecting `line-height` in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content +========================================================================== */ + +/** +* Remove border when inside `a` element in IE 8/9/10. +*/ + +img { + border: 0; +} + +/** +* Correct overflow not hidden in IE 9/10/11. +*/ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content +========================================================================== */ + +/** +* Address margin not present in IE 8/9 and Safari. +*/ + +figure { + margin: 1em 40px; +} + +/** +* Address differences between Firefox and other browsers. +*/ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** +* Contain overflow in all browsers. +*/ + +pre { + overflow: auto; +} + +/** +* Address odd `em`-unit font size rendering in all browsers. +*/ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms +========================================================================== */ + +/** +* Known limitation: by default, Chrome and Safari on OS X allow very limited +* styling of `select`, unless a `border` property is set. +*/ + +/** +* 1. Correct color not being inherited. +* Known issue: affects color of disabled elements. +* 2. Correct font properties not being inherited. +* 3. Address margins set differently in Firefox 4+, Safari, and Chrome. +*/ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** +* Address `overflow` set to `hidden` in IE 8/9/10/11. +*/ + +button { + overflow: visible; +} + +/** +* Address inconsistent `text-transform` inheritance for `button` and `select`. +* All other form control elements do not inherit `text-transform` values. +* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. +* Correct `select` style inheritance in Firefox. +*/ + +button, +select { + text-transform: none; +} + +/** +* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` +* and `video` controls. +* 2. Correct inability to style clickable `input` types in iOS. +* 3. Improve usability and consistency of cursor style between image-type +* `input` and others. +*/ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** +* Re-set default cursor for disabled elements. +*/ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** +* Remove inner padding and border in Firefox 4+. +*/ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** +* Address Firefox 4+ setting `line-height` on `input` using `!important` in +* the UA stylesheet. +*/ + +input { + line-height: normal; +} + +/** +* It's recommended that you don't attempt to style these elements. +* Firefox's implementation doesn't respect box-sizing, padding, or width. +* +* 1. Address box sizing set to `content-box` in IE 8/9/10. +* 2. Remove excess padding in IE 8/9/10. +*/ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** +* Fix the cursor style for Chrome's increment/decrement buttons. For certain +* `font-size` values of the `input`, it causes the cursor style of the +* decrement button to change from `default` to `text`. +*/ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** +* 1. Address `appearance` set to `searchfield` in Safari and Chrome. +* 2. Address `box-sizing` set to `border-box` in Safari and Chrome +* (include `-moz` to future-proof). +*/ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** +* Remove inner padding and search cancel button in Safari and Chrome on OS X. +* Safari (but not Chrome) clips the cancel button when the search input has +* padding (and `textfield` appearance). +*/ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** +* Define consistent border, margin, and padding. +*/ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** +* 1. Correct `color` not being inherited in IE 8/9/10/11. +* 2. Remove padding so people aren't caught out if they zero out fieldsets. +*/ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** +* Remove default vertical scrollbar in IE 8/9/10/11. +*/ + +textarea { + overflow: auto; +} + +/** +* Don't inherit the `font-weight` (applied by a rule above). +* NOTE: the default cannot safely be changed in Chrome and Safari on OS X. +*/ + +optgroup { + font-weight: bold; +} + +/* Tables +========================================================================== */ + +/** +* Remove most spacing between table cells. +*/ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/site/css/style.css b/site/css/style.css new file mode 100644 index 0000000000..348b013dcf --- /dev/null +++ b/site/css/style.css @@ -0,0 +1,32 @@ +html { + box-sizing: border-box; +} + +*, *:before, *:after { + box-sizing: inherit; +} + +body { + font-size: 15px; + line-height: 1.6; + font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #444; + background: #F7F7F7; +} + +h3 { + margin-top: 60px; +} + +a, a:visited { + color: #888; + text-decoration: none; +} + +a:hover { + color: #aaa; +} + +a:active { + color: #444; +} diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000000..4e0c65a163 --- /dev/null +++ b/site/index.html @@ -0,0 +1,17 @@ + + + + + + + Unicorn Editor + + + + + +
+
+ + + diff --git a/site/index.js b/site/index.js new file mode 100644 index 0000000000..f74acc5f8e --- /dev/null +++ b/site/index.js @@ -0,0 +1,8 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Editor } from 'unicorn-editor'; + +// export for http://fb.me/react-devtools +window.React = React; + +ReactDOM.render(
Hello World!
, document.getElementById('react')); diff --git a/site/package.json b/site/package.json new file mode 100644 index 0000000000..bcc9c7e0a8 --- /dev/null +++ b/site/package.json @@ -0,0 +1,33 @@ +{ + "name": "unicorn-editor-site", + "version": "0.0.0", + "description": "Website for the fabolous Unicorn Editor", + "author": { + "name": "Nik Graf", + "email": "nik@nikgraf.com", + "url": "http://www.nikgraf.com" + }, + "main": "index.js", + "repository": { + "type": "git", + "url": "http://github.com/nikgraf/unicorn-editor.git" + }, + "dependencies": { + "react": "=0.14.7", + "react-dom": "^=0.14.7" + }, + "devDependencies": { + "babel-core": "^6.5.2", + "babel-loader": "^6.2.3", + "eslint": "^2.2.0", + "eslint-config-airbnb": "^6.0.2", + "express": "^4.13.4", + "node-libs-browser": "^1.0.0", + "webpack": "^1.12.14", + "uglify-js": "=2.6.2" + }, + "scripts": { + "start": "node server.js", + "build": "NODE_ENV=production webpack -p --config webpack.config.production.js" + } +} diff --git a/site/server.js b/site/server.js new file mode 100644 index 0000000000..a4d292d4ac --- /dev/null +++ b/site/server.js @@ -0,0 +1,32 @@ +/* eslint-disable no-var, no-console */ + +var path = require('path'); +var express = require('express'); +var webpack = require('webpack'); +var config = require('./webpack.config'); +var app = express(); +var compiler = webpack(config); + +app.use('/css', express.static('css')); +app.use('/icon', express.static('icon')); +app.use('/images', express.static('images')); + +app.use(require('webpack-dev-middleware')(compiler, { + noInfo: true, + publicPath: config.output.publicPath, +})); + +app.use(require('webpack-hot-middleware')(compiler)); + +app.get('*', (req, res) => { + res.sendFile(path.join(__dirname, 'index.html')); +}); + +app.listen(3000, 'localhost', (err) => { + if (err) { + console.log(err); + return; + } + + console.log('Listening at http://localhost:3000'); +}); diff --git a/site/webpack.config.js b/site/webpack.config.js new file mode 100644 index 0000000000..0d6d5568be --- /dev/null +++ b/site/webpack.config.js @@ -0,0 +1,46 @@ +var path = require('path'); // eslint-disable-line no-var +var webpack = require('webpack'); // eslint-disable-line no-var +var ExtractTextPlugin = require('extract-text-webpack-plugin'); // eslint-disable-line no-var + +module.exports = { + devtool: 'inline-source-map', + entry: [ + 'webpack-hot-middleware/client', + './index', + ], + output: { + path: path.join(__dirname, 'dist'), + filename: 'bundle.js', + publicPath: '/static/', + }, + plugins: [ + new ExtractTextPlugin('bundle.css', { disable: true }), + new webpack.HotModuleReplacementPlugin(), + new webpack.NoErrorsPlugin(), + ], + resolve: { + alias: { + 'unicorn-editor': path.join(__dirname, '..', 'src'), + react: path.join(__dirname, 'node_modules', 'react'), + }, + extensions: ['', '.js'], + }, + module: { + loaders: [ + { + test: /\.js$/, + loaders: ['babel'], + exclude: /node_modules/, + include: __dirname, + }, { + test: /\.js$/, + loaders: ['babel'], + include: path.join(__dirname, '..', 'src'), + }, { + test: /\.css/, + loader: ExtractTextPlugin.extract('style', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'), + include: path.join(__dirname, '../src'), + }, + ], + }, +}; diff --git a/site/webpack.config.production.js b/site/webpack.config.production.js new file mode 100644 index 0000000000..8315c73c64 --- /dev/null +++ b/site/webpack.config.production.js @@ -0,0 +1,43 @@ +var path = require('path'); // eslint-disable-line no-var +var webpack = require('webpack'); // eslint-disable-line no-var +var ExtractTextPlugin = require('extract-text-webpack-plugin'); // eslint-disable-line no-var + +module.exports = { + entry: [ + './index', + ], + output: { + path: path.join(__dirname, 'static'), + filename: 'bundle.js', + publicPath: '/static/', + }, + resolve: { + alias: { + 'unicorn-editor': path.join(__dirname, '..', 'src'), + react: path.join(__dirname, 'node_modules', 'react'), + }, + extensions: ['', '.js'], + }, + plugins: [ + new ExtractTextPlugin('bundle.css', { disable: true }), + new webpack.optimize.UglifyJsPlugin({ minimize: true }), + ], + module: { + loaders: [ + { + test: /\.js$/, + loaders: ['babel'], + exclude: /node_modules/, + include: __dirname, + }, { + test: /\.js$/, + loaders: ['babel'], + include: path.join(__dirname, '..', 'src'), + }, { + test: /\.css/, + loader: ExtractTextPlugin.extract('style', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'), + include: path.join(__dirname, '../src'), + }, + ], + }, +}; diff --git a/src/components/Editor/index.js b/src/components/Editor/index.js new file mode 100644 index 0000000000..5fd47bc36b --- /dev/null +++ b/src/components/Editor/index.js @@ -0,0 +1,15 @@ +/* @flow */ + +import React, { Component } from 'react'; +import type ReactElement from 'react'; + +export default class Editor extends Component { + + render(): ReactElement { + return ( +
+ I'm the Unicorn Editor. +
+ ); + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000000..4e2db7ee3d --- /dev/null +++ b/src/index.js @@ -0,0 +1,5 @@ +import Editor from './components/Editor'; + +module.exports = { + Editor, +};