forked from mantrajs/mantra-sample-blog-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1334910
commit b7eec35
Showing
77 changed files
with
281 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,19 @@ | ||
## A Sample Blog App Written in Mantra | ||
What can you do with repo? | ||
|
||
This is a sample blog app written in [Mantra](https://github.com/kadirahq/mantra) covering core features of it. | ||
You can run the client part of the meteor application separately (building with webpack), with or without the server running.(you need the server to be run at least once though, after that, the server could be anywhere). There is no major code changes to the original mantra-sample-blog-app. (So there is no new learning involved) | ||
|
||
### Setting Up | ||
|
||
* Clone this repo | ||
* Do `npm install` to install dependencies | ||
* Make sure you've installed Meteor locally | ||
|
||
### Running The App | ||
|
||
Simply start your app with `meteor -p 5005`. | ||
Then you can access the app on <http://localhost:5005> | ||
|
||
### Running Tests | ||
|
||
In this app, every part of the client side is fully tested using the familiar tools like Mocha, Chai and Sinon. | ||
|
||
Run tests with: | ||
|
||
``` | ||
npm test | ||
``` | ||
cd server | ||
meteor | ||
**See package.json for more information about testing setup.** | ||
cd client | ||
npm install | ||
npm start | ||
### Running Storybook | ||
This app is setup for [React Storybook](https://github.com/kadirahq/react-storybook). Run following command to start the React Storybook: | ||
|
||
``` | ||
npm run storybook | ||
``` | ||
You can go to localhost:8080 to see your app. | ||
|
||
> **NOTE:** If this gives you missing module errors, React Storybook requires npm v3. Here's how to install npm3 and get it setup. | ||
> ```js | ||
> npm install -g npm@3.8.5 | ||
> rm -rf node_modules | ||
> npm install | ||
> npm run storybook | ||
> ``` | ||
--TODO | ||
-wallaby.js / mocha etc may need modifications. | ||
-will update them in due course in the sample |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## A Sample Blog App Written in Mantra | ||
|
||
This is a sample blog app written in [Mantra](https://github.com/kadirahq/mantra) covering core features of it. | ||
|
||
### Setting Up | ||
|
||
* Clone this repo | ||
* Do `npm install` to install dependencies | ||
* Make sure you've installed Meteor locally | ||
|
||
### Running The App | ||
|
||
Simply start your app with `meteor -p 5005`. | ||
Then you can access the app on <http://localhost:5005> | ||
|
||
### Running Tests | ||
|
||
In this app, every part of the client side is fully tested using the familiar tools like Mocha, Chai and Sinon. | ||
|
||
Run tests with: | ||
|
||
``` | ||
npm test | ||
``` | ||
|
||
**See package.json for more information about testing setup.** | ||
|
||
### Running Storybook | ||
|
||
This app is setup for [React Storybook](https://github.com/kadirahq/react-storybook). Run following command to start the React Storybook: | ||
|
||
``` | ||
npm run storybook | ||
``` | ||
|
||
> **NOTE:** If this gives you missing module errors, React Storybook requires npm v3. Here's how to install npm3 and get it setup. | ||
> ```js | ||
> npm install -g npm@3.8.5 | ||
> rm -rf node_modules | ||
> npm install | ||
> npm run storybook | ||
> ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
var WebpackDevServer = require("webpack-dev-server"); | ||
var HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
// -d --hot --inline --content-base build/ | ||
|
||
// If you are not using html-webpack-plugin use an index.html like the following in the build directory | ||
// <html> | ||
// <head> | ||
// <meta charset="utf-8"> | ||
// <link rel="stylesheet" href="style.css"> | ||
// </head> | ||
// <body> | ||
// <script type="text/javascript" src="app.js" charset="utf-8"></script> | ||
// <div id="root"></div> | ||
// </body> | ||
// </html> | ||
|
||
var webpack = require("webpack"); | ||
var path = require('path'); | ||
var config = require("./webpack.config.js"); | ||
config.entry.app.unshift("webpack-dev-server/client?http://localhost:8080/", "webpack/hot/dev-server"); | ||
config.plugins.unshift( | ||
new webpack.HotModuleReplacementPlugin() | ||
,new HtmlWebpackPlugin() | ||
); | ||
// IF you are struggling with a difficult problem, uncomment the following, (increases build speed though) | ||
config['devtool'] = 'source-map'; | ||
config['debug'] = true; | ||
var request = require('request'); | ||
server = new WebpackDevServer(webpack(config), { | ||
contentBase: config.output.path, | ||
publicPath: config.output.publicPath, | ||
historyApiFallback: true, | ||
hot: true, | ||
stats: {colors: true} | ||
}); | ||
// https://github.com/reactjs/react-router/issues/676 | ||
server.app.use(function pushStateHook(req, res, next) { | ||
var ext = path.extname(req.url); | ||
if ((ext === '' || ext === '.html') && req.url !== '/') { | ||
req.pipe(request( | ||
// localURL | ||
'http://localhost:8080' | ||
)).pipe(res); | ||
} else { | ||
next(); | ||
} | ||
}); | ||
server.listen(8080, "localhost", function() {}); | ||
|
||
|
||
// remove push state if not needed later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'meteor-imports'; | ||
import {Meteor} from 'meteor/meteor'; | ||
import {Tracker} from 'meteor/tracker'; | ||
global.Meteor = Meteor; | ||
global.Tracker = Tracker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import 'meteor-imports'; | ||
|
||
import {createApp} from 'mantra-core'; | ||
import initContext from './configs/context'; | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var WebpackStrip = require('strip-loader'); | ||
var path = require('path'); | ||
var devConfig = require('./webpack.config.js'); | ||
var stripLoader = { | ||
"test": [/.js$/,/.jsx$/], | ||
"include":[ | ||
path.resolve(__dirname, "entry"), | ||
path.resolve(__dirname, "../server/imports/common") | ||
], | ||
"loader":WebpackStrip.loader('console.log','debug') | ||
}; | ||
devConfig.module.loaders.push(stripLoader); | ||
module.exports = devConfig; | ||
|
||
// TODO | ||
// production bundle warning React | ||
// http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
var path = require('path'); | ||
// var webpack = require("webpack"); | ||
// This loads the meteor client files from .meteor/local so that it can be used in client applications | ||
// without running meteor or needing the meteor context | ||
var MeteorImportsPlugin = require('meteor-imports-webpack-plugin'); | ||
// we will create a separate bundle for css | ||
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
//Automatically prefix vendor prefixes to CSS | ||
var autoprefixer = require('autoprefixer'); | ||
|
||
module.exports = { | ||
"entry" : {"app":['./src/main.js','./src/globals.js']}, | ||
"output": { | ||
"path": path.resolve('./build'), | ||
"publicPath" :"/", | ||
"filename": '[name].js' | ||
}, | ||
"externals": [], | ||
"plugins": [ | ||
new MeteorImportsPlugin({ | ||
ROOT_URL: 'http://localhost:3000/', | ||
DDP_DEFAULT_CONNECTION_URL: 'http://localhost:3000/', | ||
PUBLIC_SETTINGS: {}, | ||
meteorFolder: '../server', | ||
meteorEnv: { | ||
NODE_ENV: 'development' | ||
}, | ||
exclude: ['ecmascript'] | ||
}), | ||
new ExtractTextPlugin('style.css') | ||
], | ||
"module": { | ||
"noParse": [/libphonenumber.js$/], | ||
// "preLoaders" : [{ | ||
// "test": [/.js$/,/.jsx$/], | ||
// "include":[ | ||
// path.resolve(__dirname, "entry") | ||
// // , | ||
// // path.resolve(__dirname, "../server/imports/common") | ||
// ], | ||
// "loader":"jshint-loader" | ||
// }], | ||
"loaders": [{ | ||
"test": require.resolve("react"), | ||
"loader": "expose-loader?React" | ||
}, { | ||
"test": /\.(js|jsx)$/, | ||
"loader": require.resolve("babel-loader"), | ||
"include": [path.resolve(__dirname, "src"), path.resolve(__dirname, "../server/lib")], | ||
"query": { | ||
"presets": [ | ||
require.resolve("babel-preset-es2015"), | ||
require.resolve("babel-preset-stage-2"), | ||
require.resolve("babel-preset-stage-0"), | ||
require.resolve("babel-preset-react") | ||
], | ||
"plugins": [ | ||
require.resolve("babel-plugin-react-require"), | ||
require.resolve("babel-root-slash-import"), | ||
require.resolve("babel-plugin-transform-decorators-legacy"), | ||
require.resolve("babel-plugin-add-module-exports") | ||
], | ||
"compact": false | ||
} | ||
}, { | ||
"test": /\.css$/, | ||
"exclude":/react-select/, | ||
"loader": ExtractTextPlugin.extract("style-loader", "css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader") | ||
}, | ||
// Global CSS | ||
// regular 'global' css or pre-compiled. | ||
// as of now, only react-select needs this | ||
{ | ||
"test": /\.css$/, | ||
"include":/react-select/, | ||
"loader": ExtractTextPlugin.extract("style-loader", "css-loader!postcss-loader") | ||
}, | ||
|
||
{ | ||
"test": /\.scss$/, | ||
"exclude":/node_modules/, | ||
"loader": ExtractTextPlugin.extract("style-loader","css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!sass-loader") | ||
}, { | ||
"test": /\.html$/, | ||
"exclude":/node_modules/, | ||
"loader": "html" | ||
}, { | ||
"test": /\.json$/, | ||
"include": [path.resolve(__dirname, "entry"), path.resolve(__dirname, "../server/imports/common")], | ||
"loader": require.resolve("json-loader") | ||
}, { | ||
"test": /\.(png|jpg|ttf|svg)$/, | ||
"exclude":/node_modules/, | ||
// base64 encode the image and inline if size is less than the limit | ||
"loader": "url-loader?limit=8182" | ||
}, { | ||
"test": /\.eot/, | ||
"loader": 'url-loader?limit=8182&mimetype=application/vnd.ms-fontobject' | ||
}, { | ||
"test": /\.woff2(\?\S*)?$/, | ||
"loader": 'url-loader?limit=8182&mimetype=application/font-woff2' | ||
}, { | ||
"test": /\.woff/, | ||
"loader": 'url-loader?limit=8182&mimetype=application/font-woff' | ||
}, { | ||
"test": /\.ttf/, | ||
"loader": 'url-loader?limit=8182&mimetype=application/font-ttf' | ||
}] | ||
}, | ||
//Automatically resove, import 'abc' [abc can be jsx or js], not allowing for json, css, scsss etc | ||
"resolve": { | ||
"extensions": ["", ".js", ".jsx"] | ||
}, | ||
"postcss": function() { | ||
return { | ||
"defaults": [ | ||
autoprefixer({"browsers": ["last 2 versions"]}) | ||
] | ||
}; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.