Giter Site home page Giter Site logo

maka-cli's Introduction

#maka

Subscribe on twitter for latest @maka_cli announcements!

Meteor Apps Kick Ass! (maka)

Maka is a command line scaffolding tool for Meteor applications.

It automatically creates project structure, files and boilerplate code. You may use maka where ever you use meteor.

Maka works great on OSX, Linux, and Windows.

Notice v2.5.11

I'm continually trying to improve the flow of scaffolding with React; making sure I'm in line with the Meteor documentation. Looking at how MDG wants to handle pub/sub I've implemented the createContainer symbol as a stubbed out constant in the React component template. I did stray a little from convention, in that the container that wraps it's component doesn't prepend the word "Container" to it. Let me know if it should, I'm on the fence about it.

NOTICE v2.5.0

I'm happy to announce that I've added React and React Router support for Maka-Cli! Now you may create apps that use React and React Router simply by declaring your client render engine:

$ maka create ReactApp --client=react

Maka still defaults to Blaze, and this update is backwards compatible with your existing Blaze projects. Please let me know if you run into any problems.

Enjoy!

NOTICE: v2.3.4

FINALLY fixed that bug where $ maka mongo wouldn't kick off the mongo shell. Also fixed that strange spacing that always happens...so now it looks more normal.

This will also show all the processes that are happening when starting your app, or if Meteor is updating (rather than just seeing a blank line).

NOTICE: v2.3.0

Maka may now use the popular JSDocs CLI to generate documentation for your meteor app. All you need is to make sure you have:

$ npm install -g jsdoc

Once you have jsdoc, simply run the following command to create a jsdoc-config.json file in your config/ directory, and output the JSDoc to /docs/

$ maka jsdoc

All the Meteor 1.3 style templates have been updated with JSDoc tags. This includes the api, ui, routes, and some others. So if you start a new project with maka, you'll get documentation right from the get go! Otherwise you'll have to enjoy the new JSDoc comments on newly generated files.

Enjoy! Let me know what you think, or if you have any suggestions!

-- Maka

Installation

Make sure Meteor is installed:

Linux & OSX

$ curl https://install.meteor.com/ | sh

Windows: Download Installer

Install the maka command line tool globally so you can use it from any project directory.

$ npm install -g maka-cli

Usage

Use the help command to get a list of the top level commands.

$ maka help

Use the g command to see a list of generators.

$ maka g

Commands

Migrate from Iron-meteor

In the app directory:

$ maka migrate

Create an Application

$ maka create my-app

The following parameters can be specified:

--skip-template-css=true|false       Don't generate CSS files when templates are made.
--skip-template-js=true|false        Don't generate JS files when templates are made.
--skip-template-html=true|false      Don't generate HTML files when templates are made.
--skip-flow-router                   Don't install flow-router. (route generators will be disabled in maka-cli)
--skip-route-template                Don't create templates with route generators.
--skip-testing                         Don't install testing packages (jasmine, html/console reporter, factory, etc)

Run Your Application

$ maka run

or just

$ maka

Generators

$ maka g:scaffold todos
$ maka g:template todos/todo_item [--layout] [--component] # no route
$ maka g:api cars
$ maka g:collection todos
$ maka g:route webhooks/stripe				# also creates a page template
$ maka g:route todos/show todos/:id
$ maka g:route todos/edit todos/:id/edit
$ maka g:publish todos
$ maka g:stylesheet main
$ maka g:package username:packageName
$ maka g:package packageName

Help:
$ maka g 

Testing

$ maka --test

This may be used with --env to test prod settings as well as other options such as --port:

$ maka --test --env production --port 3010

Testing packages in isolation with jasmine has also been added:

$ maka --test-packages package-name

To prevent the install of this testing package use the param:

$ maka create package-name --skip-jasmine

If you don't have jasmine, and would like it in your existing app:

$ maka add sanjo:jasmine velocity:html-reporter.

This will automatically load your config/development/env.sh and config/development/settings.json files.

Run the Application with a Different Environment

$ maka run --env=staging

This will use the config files in config/staging instead.

Debug Your Application on the Server Side

$ maka debug

Build Your Application

$ maka build

Connect to MongoDB Database

$ maka mongo

Connect to Meteor shell

$ maka shell

Deployment

Deploy Your Application with Meteor Up

Meteor Up is a command line tool to deploy any Meteor app to your own server.

Configure Meteor Up

The following configuration options are supported in config.json:

"mup": {
  "environment": "/path/to/environment"
}

Initialize Meteor Up

Use maka mupx to run Meteor Up commands. To create a mup.json file for an environment run:

maka mupx <environment> --init

Deploy Your Application on Heroku

Maka projects require buildpacks to look for the app in /app/ in addition to the root for deployments to work. Currently there is a patched version of the Horse buildpack available that is compatible with Iron based projects. Use this fork until the patches has been added to the main Horse repo.

Initialize the git repo

$ git init
$ git add .
$ git commit -m 'init'

Create the heroku app:

$ heroku create <app-name>

Setup the build pack

$ heroku buildpacks:set https://github.com/AdmitHub/meteor-buildpack-horse.git

This will build your application and put the resulting bundle into the project's build folder.

If that doesn't work, and you're getting a version issue try this build pack:

$ heroku buildpacks:set https://github.com/AdmitHub/meteor-buildpack-horse.git#beta

Setup MongoDB

$heroku addons:create mongolab

Configure your ROOT_URL

$ heroku config:set ROOT_URL=https://<app-name>.herokuapp.com

or, if you have DNS setup

$ heroku config:set ROOT_URL=https://www.<domain-name>.com

Depoy to heroku

$ git push heroku master

Enable sticky session-support

$ heroku labs:enable http-session-affinity

Set your settings path

$ heroku config:add METEOR_SETTINGS="$(cat config/production/settings.json)"

Deploy Meteor App on CentOS

$ maka build --architecture os.linux.x86_32
or
$ maka build --architecture os.linux.x86_64

Copy the build to its final home on the CentOS box.

Update Yum:
	$ yum -y update

    Install EPEL
    $ yum -y install epel-release

    Install NodeJS and Npm:
    $ yum -y install nodejs npm

    Verify Node Version
    $ node --version

    Install MongoDB
    	1. Add the MongoDB Yum repo by editing mongodb.repo and adding in the definition:
    	$ vim /etc/yum.repos.d/mongodb.repo

            [mongodb]
            name=MongoDB repo
            baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
            gpgcheck=0
            enabled=1

        2. Install the MongoDB packages
            $ yum install mongodb-org

        3. Start MongoDB
            $ chkconfig mongod on
            $ service mongod start


The following environment variables should be modified to suit your needs.
$ export MONGO_URL='mongodb://localhost:27017/<dbName>'
$ export ROOT_URL='http://localhost'
$ export MAIL_URL='smtp://user:password@mailhost:port/'
$ export PORT=3000

$ (cd programs/server && npm install)

$ (cd to bundle root)
$ node main.js

Directory Structure

The application will have the following directory structure:

.
├── app
│   ├── client
│   │   ├── head.html					 # The <head> tag
│   │   └── main.js  					 # The entry point for imports/ui
│   ├── imports      					 # Lazy loaded files live here
│   │   ├── api      					 # Server concept logic
│   │   │   └── todos					 # "maka g:api todos"
│   │   │       ├── api.js   			 # RESTFul endpoints (restivus)
│   │   │       ├── fixtures.js 		 # Preload data
│   │   │       ├── methods.js   		 # Client invoked Server functions.
│   │   │       ├── publications.js  	 # Broadcasted sets of data
│   │   │       ├── todos.app-tests.js
│   │   │       └── todos.js    		 # Collection
│   │   ├── startup  					 
│   │   │   ├── client
│   │   │   │   ├── index.js
│   │   │   │   ├── routes.js   		 # FlowRouter routes
│   │   │   │   └── templates.js     	 # Registers templates from ui/
│   │   │   ├── lib
│   │   │   │   └── index.js
│   │   │   └── server
│   │   │       ├── index.js
│   │   │       └── register-todos-api.js
│   │   └── ui
│   │       ├── components      		 # Reusable components
│   │       │   └── header   			 # "maka g:t header --component"
│   │       │       ├── header.css
│   │       │       ├── header.html
│   │       │       └── header.js
│   │       ├── layouts      			 # Site layout
│   │       │   └── master-layouts   	 # "maka g:t masterLayout --component" 
│   │       │       ├── master-layout.html
│   │       │       └── master-layout.js
│   │       ├── pages       			 # "maka g:route home" or for no route:"maka g:t home" 
│   │       │   └── home
│   │       │       ├── home.css
│   │       │       ├── home.html
│   │       │       └── home.js
│   │       └── test-helpers.js  		 # UI test helper function
│   ├── lib
│   │   └── main.js     				 # The entry point for imports/lib
│   ├── packages				      	 # "maka g:package [account:]package"
│   ├── private          				 # Server accessible (only) files
│   ├── public          				 # Globally accessible files
│   └── server
│       └── main.js      				 # The entry point for imports/api
├── bin
├── build      		# "maka build --architecture [os.linux.x86_64] [os.linux.x86_32] [os.osx.x86_64] [os.windows.x86_32]"
│   └── README
└── config
    ├── development
    │   ├── env.sh
    │   └── settings.json
    └── production
        ├── env.sh
        └── settings.json


26 directories, 30 files

License

The MIT License (MIT) Copyright (C) 2016 Campbell Labs

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.

maka-cli's People

Contributors

maka-io avatar

Watchers

James Cloos avatar Darren Impey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.