Skip to content

Instantly share code, notes, and snippets.

@jamesdwilson
Last active December 20, 2015 13:09
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesdwilson/6136770 to your computer and use it in GitHub Desktop.
Save jamesdwilson/6136770 to your computer and use it in GitHub Desktop.
Create Meteor project using meteor create, set up directory structure following the Unofficial Meteor FAQ (by oortcloud). Also initializes git and uses coffescript instead of JS. Note: I am using main.html instead of index.html as I think that is better as it loads last. To make this your default skeleton, empty your ~/.meteor/tools/latest/tools…
#!/bin/sh
# Follows https://github.com/oortcloud/unofficial-meteor-faq#where-should-i-put-my-files
# I release this into the Public domain -osirisx11 on freenode
: <<'END'
osiris@krypton:~/playpen$ ~/meteor-create.sh example
example: created.
To run your new app:
cd example
meteor
coffeescript: Javascript dialect with fewer braces and semicolons
Initialized empty Git repository in /home/osiris/playpen/example/.git/
osiris@krypton:~/playpen$ cd example/
osiris@krypton:~/playpen/example$ ll
total 40
drwxr-xr-x 10 osiris osiris 4096 Aug 1 20:04 ./
drwxrwxr-x 3 osiris osiris 4096 Aug 1 20:04 ../
drwxrwxr-x 5 osiris osiris 4096 Aug 1 20:04 client/
drwxrwxr-x 2 osiris osiris 4096 Aug 1 20:04 collections/
drwxrwxr-x 7 osiris osiris 4096 Aug 1 20:04 .git/
drwxrwxr-x 3 osiris osiris 4096 Aug 1 20:04 lib/
drwxr-xr-x 2 osiris osiris 4096 Aug 1 20:04 .meteor/
drwxrwxr-x 2 osiris osiris 4096 Aug 1 20:04 public/
drwxrwxr-x 3 osiris osiris 4096 Aug 1 20:04 server/
drwxrwxr-x 2 osiris osiris 4096 Aug 1 20:04 tests/
osiris@krypton:~/playpen/example$
END
meteor create $1
cd $1
meteor add coffeescript
git init #add git on this new project
#remove default meteor files
rm $1.html $1.css $1.js
mkdir lib # <- any common code for client/server.
echo \# - general configuration >> lib/environment.coffee
echo \# - Meteor.method definitions > lib/methods.coffee
mkdir lib/external # <- common code from someone else
## Note that js files in lib folders are loaded before other js files.
mkdir collections # <- definitions of collections and methods on them (could be models/)
mkdir -p client/lib # <- client specific libraries (also loaded first)
echo \# - configuration of any client side packages >> client/lib/environment.coffee
mkdir client/lib/helpers # <- any helpers (handlebars or otherwise) that are used often in view files
echo \# - subscriptions, basic Meteor.startup code. > client/application.coffee
touch client/main.html # <- toplevel html
touch client/main.coffee
mkdir client/views/ #<page>.html <- the templates specific to a single page
#client/views/<page>.coffee # <- and the JS to hook it up
#client/views/<type>/ # <- if you find you have a lot of views of the same object type
mkdir client/stylesheets/ # <- css / styl / less files
mkdir server
echo \# - Meteor.publish definitions > server/publications.coffee
mkdir server/lib
echo \# - configuration of server side packages > server/lib/environment.coffee
mkdir public/ # <- static files, such as images, that are served directly.
mkdir tests/ # <- unit test files (won't be loaded on client or server)
@justinriggio
Copy link

nice i'll give this a try :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment