Skip to content

Commit

Permalink
feat: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
robgietema committed May 15, 2016
0 parents commit 4822b8e
Show file tree
Hide file tree
Showing 68 changed files with 8,177 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .babelrc
@@ -0,0 +1,25 @@
{
"presets": ["react", "es2015", "stage-0"],

"plugins": [
"transform-runtime",
"add-module-exports",
"transform-decorators-legacy",
"transform-react-display-name"
],

"env": {
"development": {
"plugins": [
"typecheck",
["react-transform", {
"transforms": [{
"transform": "react-transform-catch-errors",
"imports": ["react", "redbox-react"]
}
]
}]
]
}
}
}
9 changes: 9 additions & 0 deletions .editorconfig
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
webpack/*
karma.conf.js
tests.webpack.js
33 changes: 33 additions & 0 deletions .eslintrc
@@ -0,0 +1,33 @@
{
"extends": "airbnb",
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true,
"jasmine": true,
"protractor": true,
},
"parser": "babel-eslint",
"rules": {
"react/jsx-closing-bracket-location": 0,
"valid-jsdoc": 2,
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
}
}],
},
"globals": {
"root": true,
"__DEVELOPMENT__": true,
"__CLIENT__": true,
"__SERVER__": true,
"__DISABLE_SSR__": true,
"__DEVTOOLS__": true,
"socket": true,
"webpackIsomorphicTools": true,
},
}
11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
# Node
node_modules
coverage
jsdoc
webpack-assets.json
webpack-stats.json
npm-debug.log
dist

# Other
.DS_Store
2 changes: 2 additions & 0 deletions .npmrc
@@ -0,0 +1,2 @@
loglevel="warn"
save-exact=true
26 changes: 26 additions & 0 deletions README.md
@@ -0,0 +1,26 @@
Mosaic Editor
=============

### Installation

**Prerequisites**
* [Node.js](https://nodejs.org/)
* [Git](http://git-scm.com/)

**Install dependencies**

npm install

### Development

npm run dev

## Testing

$ npm run test
$ npm run test:unit
$ npm run test:e2e

If chromedriver could not be found, make sure to update with:

./node_modules/protractor/bin/webdriver-manager update
48 changes: 48 additions & 0 deletions api/api.js
@@ -0,0 +1,48 @@
/**
* Module for the backend API.
* @module api
*/

import express from 'express';

const app = express();

export { app };

app.get('/home', (req, res) => {
res.json({
content: {
title: 'Welcome to Plone',
description: 'This is the description',
body: '<p>Some body text with <b>markup</b></p>',
},
layout: [
[
{
width: 4,
content: 'Tile 1',
},
{
width: 8,
content: 'Tile 2',
},
],
[
{
width: 12,
content: 'Tile 3',
}
],
],
});
});

app.get('/about', (req, res) => {
res.json({
content: {
title: 'About page',
description: 'This is the about description',
body: '<p>About body text with <b>markup</b></p>',
}
});
});
28 changes: 28 additions & 0 deletions bin/server.js
@@ -0,0 +1,28 @@
#!/usr/bin/env node
require('../server.babel'); // babel registration (runtime transpilation for node)
var path = require('path');
var rootDir = path.resolve(__dirname, '..');
/**
* Define isomorphic constants.
*/
global.__CLIENT__ = false;
global.__SERVER__ = true;
global.__DISABLE_SSR__ = false; // <----- DISABLES SERVER SIDE RENDERING FOR ERROR DEBUGGING
global.__DEVELOPMENT__ = process.env.NODE_ENV !== 'production';

if (__DEVELOPMENT__) {
if (!require('piping')({
hook: true,
ignore: /(\/\.|~$|\.json|\.scss$)/i
})) {
return;
}
}

// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicTools = require('webpack-isomorphic-tools');
global.webpackIsomorphicTools = new WebpackIsomorphicTools(require('../webpack/webpack-isomorphic-tools'))
.development(__DEVELOPMENT__)
.server(rootDir, function() {
require('../src/server');
});
16 changes: 16 additions & 0 deletions jsdoc.json
@@ -0,0 +1,16 @@
{
"tags": {
"allowUnknownTags": true
},
"source": {
"include": ["./src"],
"includePattern": ".+\\.js$",
"excludePattern": ".+\\.(spec|e2e)\\.js$"
},
"opts": {
"encoding": "utf8",
"destination": "jsdoc",
"recurse": true,
"verbose": true
}
}
77 changes: 77 additions & 0 deletions karma.conf.js
@@ -0,0 +1,77 @@
var webpack = require('webpack');

module.exports = function (config) {
config.set({

browsers: ['PhantomJS'],

singleRun: false,

frameworks: [ 'mocha' ],

files: [
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
'tests.webpack.js',
],

preprocessors: {
'tests.webpack.js': [ 'webpack', 'sourcemap' ],
'src/**/*.js': [ 'webpack' ],
},

reporters: [ 'mocha', 'coverage' ],

plugins: [
require("karma-webpack"),
require("karma-mocha"),
require("karma-mocha-reporter"),
require("karma-phantomjs-launcher"),
require("karma-sourcemap-loader"),
require("karma-coverage"),
],

coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
{ type: 'text-summary' },
]
},

webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{ test: /\.(jpe?g|png|gif|svg)$/, loader: 'url', query: {limit: 10240} },
{ test: /\.js$/, exclude: /node_modules/, loaders: ['babel']},
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.less$/, loader: 'style!css!less' },
{ test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap' },
],
},
resolve: {
modulesDirectories: [
'src',
'node_modules'
],
extensions: ['', '.json', '.js'],
},
plugins: [
new webpack.IgnorePlugin(/\.json$/),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
__CLIENT__: true,
__SERVER__: false,
__DEVELOPMENT__: true,
__DEVTOOLS__: false
}),
],
},

webpackServer: {
noInfo: true,
}

});
};

0 comments on commit 4822b8e

Please sign in to comment.