Skip to content

Commit

Permalink
reset head from sails 1.0 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
MPuhakka committed Apr 8, 2017
1 parent c97cc7e commit 5e0a50c
Show file tree
Hide file tree
Showing 145 changed files with 10,946 additions and 9,169 deletions.
23 changes: 1 addition & 22 deletions .editorconfig
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
################################################
# ╔═╗╔╦╗╦╔╦╗╔═╗╦═╗┌─┐┌─┐┌┐┌┌─┐┬┌─┐
# ║╣ ║║║ ║ ║ ║╠╦╝│ │ ││││├┤ ││ ┬
# o╚═╝═╩╝╩ ╩ ╚═╝╩╚═└─┘└─┘┘└┘└ ┴└─┘
#
# > Formatting conventions for your Sails app.
#
# This file (`.editorconfig`) exists to help
# maintain consistent formatting throughout the
# files in your Sails app.
#
# For the sake of convention, the Sails team's
# preferred settings are included here out of the
# box. You can also change this file to fit your
# team's preferences (for example, if all of the
# developers on your team have a strong preference
# for tabs over spaces),
#
# To review what each of these options mean, see:
# http://editorconfig.org/
#
################################################
# editorconfig.org
root = true

[*]
Expand Down
35 changes: 31 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,43 @@
"node": true,
},
"rules": {
"max-len": [2, 120],
"indent": [1, 2],
"max-len": [1, 150],
"no-var": 0,
"prefer-template": 0,
"comma-dangle": 2,
"class-methods-use-this": 0,
"arrow-body-style": [1, "as-needed"],
"import/extensions": 0,
"import/prefer-default-export": 1,
"space-infix-ops": 0,
"object-shorthand": 0,
"spaced-comment": 0,
"vars-on-top": 0,
"arrow-spacing": 0,
"no-case-declarations": 0,
"func-names": 0,
"skipBlankLines": 0,
"no-param-reassign": 0,
"new-cap": 0,
"react/no-did-mount-set-state": 0,
"react/sort-comp": 0,
"react/jsx-indent": [1, 2],
"react/jsx-indent-props": [1, 2],
"react/jsx-filename-extension": 0,
"react/require-default-props": 1,
"react/prop-types": 1,
"react/prefer-stateless-function": 0,
"react/no-string-refs": 0,
"react/no-find-dom-node": 0,
"react/forbid-prop-types": 0,
"jsx-a11y/href-no-hash": 0,
},
"globals": {
"_": true,
"sails": true,
"TodoList": true,
"TodoItem": true,
"User": true,
"EmailService": true,
"UserService": true,
"TokenService": true,
},
}
63 changes: 27 additions & 36 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
################################################
# ┌─┐┬┌┬┐╦╔═╗╔╗╔╔═╗╦═╗╔═╗
# │ ┬│ │ ║║ ╦║║║║ ║╠╦╝║╣
# o└─┘┴ ┴ ╩╚═╝╝╚╝╚═╝╩╚═╚═╝
#
# > Files to exclude from your app's repo.
#
# This file (`.gitignore`) is only relevant if
# you are using git.
############### .gitignore ##################
################################################
#
# It exists to signify to git that certain files
# and/or directories should be ignored for the
# purposes of version control.
# This file is only relevant if you are using git.
#
# This keeps tmp files and sensitive credentials
# from being uploaded to your repository. And
# it allows you to configure your app for your
# machine without accidentally committing settings
# which will smash the local settings of other
# developers on your team.
# Files which match the splat patterns below will
# be ignored by git. This keeps random crap and
# sensitive credentials from being uploaded to
# your repository. It allows you to configure your
# app for your machine without accidentally
# committing settings which will smash the local
# settings of other developers on your team.
#
# Some reasonable defaults are included below,
# but, of course, you should modify/extend/prune
# to fit your needs!
#
################################################


Expand Down Expand Up @@ -56,29 +48,26 @@ config/local.js
################################################
# Dependencies
#
# Most of the time, the node_modules folder is
# excluded from your code repository.
#
# When releasing a production app, you might
# consider including your node_modules directory
# in your git repo, but during development, it
# is always best to exclude it, since different
# developers may be working on different kernels,
# where dependencies would need to be recompiled
# anyway.
# When releasing a production app, you may
# consider including your node_modules and
# bower_components directory in your git repo,
# but during development, its best to exclude it,
# since different developers may be working on
# different kernels, where dependencies would
# need to be recompiled anyway.
#
# More on that here about node_modules dir:
# http://www.futurealoof.com/posts/nodemodules-in-git.html
# (credit Mikeal Rogers, @mikeal)
#
# > Do you use bower?
# > re: the bower_components dir, see this:
# > http://addyosmani.com/blog/checking-in-front-end-dependencies/
# > (credit Addy Osmani, @addyosmani)
# About bower_components dir, you can see this:
# http://addyosmani.com/blog/checking-in-front-end-dependencies/
# (credit Addy Osmani, @addyosmani)
#
################################################

node_modules
bower_components



Expand All @@ -89,8 +78,8 @@ node_modules
# Files generated by Sails and Grunt, or related
# tasks and adapters.
################################################

.tmp
dump.rdb



Expand All @@ -102,7 +91,6 @@ node_modules
# Common files generated by Node, NPM, and the
# related ecosystem.
################################################

lib-cov
*.seed
*.log
Expand All @@ -118,7 +106,7 @@ npm-debug.log
# Miscellaneous
#
# Common files generated by text editors,
# operating systems, file systems, dbs, etc.
# operating systems, file systems, etc.
################################################

*~
Expand All @@ -129,4 +117,7 @@ nbproject
.idea
.node_history
.sass-cache
dump.rdb
/dist
/dev
yarn.lock

2 changes: 1 addition & 1 deletion .sailsrc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"generators": {
"modules": {}
}
}
}
27 changes: 0 additions & 27 deletions .vscode/launch.json

This file was deleted.

82 changes: 82 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* Gruntfile
*
* This Node script is executed when you run `grunt` or `sails lift`.
* It's purpose is to load the Grunt tasks in your project's `tasks`
* folder, and allow you to add and remove tasks as you see fit.
* For more information on how this works, check out the `README.md`
* file that was generated in your `tasks` folder.
*
* WARNING:
* Unless you know what you're doing, you shouldn't change this file.
* Check out the `tasks` directory instead.
*/

module.exports = function(grunt) {


// Load the include-all library in order to require all of our grunt
// configurations and task registrations dynamically.
var includeAll;
try {
includeAll = require('include-all');
} catch (e0) {
try {
includeAll = require('sails/node_modules/include-all');
} catch (e1) {
console.error('Could not find `include-all` module.');
console.error('Skipping grunt tasks...');
console.error('To fix this, please run:');
console.error('npm install include-all --save`');
console.error();

grunt.registerTask('default', []);
return;
}
}


/**
* Loads Grunt configuration modules from the specified
* relative path. These modules should export a function
* that, when run, should either load/configure or register
* a Grunt task.
*/
function loadTasks(relPath) {
return includeAll({
dirname: require('path').resolve(__dirname, relPath),
filter: /(.+)\.js$/,
excludeDirs: /^\.(git|svn)$/
}) || {};
}

/**
* Invokes the function from a Grunt configuration module with
* a single argument - the `grunt` object.
*/
function invokeConfigFn(tasks) {
for (var taskName in tasks) {
if (tasks.hasOwnProperty(taskName)) {
tasks[taskName](grunt);
}
}
}



// Load task functions
var taskConfigurations = loadTasks('./tasks/config'),
registerDefinitions = loadTasks('./tasks/register');

// (ensure that a default task exists)
if (!registerDefinitions.default) {
registerDefinitions.default = function(grunt) {
grunt.registerTask('default', []);
};
}

// Run task functions to configure Grunt.
invokeConfigFn(taskConfigurations);
invokeConfigFn(registerDefinitions);

};
47 changes: 17 additions & 30 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,47 +1,30 @@
# Silverbullet - Sails v1.0 React Kitchensink
# Silver bullet - The ultimate Sails/React boilerplate

A [Sails](http://sailsjs.org) kitchensink with React and Webpack.
A [Sails](http://sailsjs.org) application

## About

This is a starter kitchensink app using [Sails](http://sailsjs.org) and [React](https://facebook.github.io/react/).
This is a starter boilerplate app using [Sails](http://sailsjs.org) and [React](https://facebook.github.io/react/).

## Goals
- ~~Isomorphic~~ [Universal](https://medium.com/@mjackson/universal-javascript-4761051b7ae9) react redux application in sails environment
- Sails remains usable for API and static pages
- Proper development and production builds with webpack
- Proper development and production builds
- Use Redux and React Router along with Sails routing

## Frontend features
- React App along side with SailsJS
- Redux with Immutable state
- React Router
- Sync relevant parts of Redux state to server with Socket.io
- Webpack as build tool (no Grunt)

## Backend features
- User register / activate / login
- Token service, [JWT](https://jwt.io)
- Email service
- Sessions
- React app server side rendering with styles and initialized redux state

## Work in progress
- Sails code upgrade to v1.0
- Validate token on server side
- Secure API endpoints with policies
- Clean and update code (also sails) with eslint rules
- Refactor React app with Redux/Immutable best practises
- Facebook / Google / Twitter etc login/register
- Test with MySQL
- Documentation and code review
- Automated tests
- activation screen for entering activation code
- finish registration page
- generate user login on successful auth and save to session
- tie todoItems - model to user
- set policies to require authentication everywhere
- documentation and code review
- facebook / google / twitter etc login/register

## Technologies used
- [Sails](http://sailsjs.org)
- Sails
- [React](https://github.com/facebook/react)
- [Redux](https://github.com/rackt/redux)
- [ImmutableJS](https://facebook.github.io/immutable-js)
- [React Router](https://github.com/rackt/react-router)
- [React Router Redux](https://github.com/reactjs/react-router-redux)
- [Webpack](http://webpack.github.io)
Expand All @@ -56,18 +39,22 @@ This is a starter kitchensink app using [Sails](http://sailsjs.org) and [React](

### Requirements:
- Node 4.x ->
- For production build, npm package `pm2` globally installed

## Running the application
- Edit config/env/development.js and config/env/production.js to hold your email config (or use config/local.js).
- Run `npm install`
- `npm start` will start the sails server and webpack watcher,
after this the react application can be developed without restarting the sails server
- Nodemon is also available, via `npm run-script nodemon`, restarting the sails
server as files are changed while also rebuilding jsx resources in src folder using the dev configuration.
- Production build is started with `npm run pm2-start` which runs the app with pm2. Stop the server with `npm run pm2-stop`.
- Build uses `NODE_ENV` environment variable to choose how to build the application. Use `development` for dev build and `production` for build optimized for production.

## Views

Sails - views are still enabled and will take precedence over the react routing.
Template engine is currently dust, for more options and information, read [the sails documentation on views](http://sailsjs.org/documentation/concepts/views)
We are currently using dust templates, for more options and information, read [the sails documentation on views](http://sailsjs.org/documentation/concepts/views)

## Serverside redux store (socket.io)

Expand Down
Empty file modified api/controllers/.gitkeep
100755 → 100644
Empty file.
Loading

0 comments on commit 5e0a50c

Please sign in to comment.