├── .gitignore ├── .meteor ├── .finished-upgraders ├── .gitignore ├── .id ├── packages ├── platforms ├── release └── versions ├── LICENSE ├── README.md └── packages ├── app-base ├── lib │ ├── data.js │ ├── functions.js │ └── methods.js └── package.js ├── app-desktop ├── lib │ ├── desktop.js │ └── routes.js ├── package.js └── views │ ├── layout.html │ ├── list.html │ └── list.js └── app-mobile ├── lib ├── mobile.js └── routes.js ├── package.js └── views ├── layout.html ├── list.html └── list.js /.gitignore: -------------------------------------------------------------------------------- 1 | .meteor/local 2 | .meteor/meteorite 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | -------------------------------------------------------------------------------- /.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | 4hrnl6jz7cjg8fcf1g 8 | -------------------------------------------------------------------------------- /.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-platform 8 | autopublish 9 | insecure 10 | app-base 11 | app-desktop 12 | app-mobile 13 | -------------------------------------------------------------------------------- /.meteor/platforms: -------------------------------------------------------------------------------- 1 | android 2 | browser 3 | ios 4 | server 5 | -------------------------------------------------------------------------------- /.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.0.2.1 2 | -------------------------------------------------------------------------------- /.meteor/versions: -------------------------------------------------------------------------------- 1 | app-base@0.0.1 2 | app-desktop@0.0.1 3 | app-mobile@0.0.1 4 | application-configuration@1.0.4 5 | autopublish@1.0.2 6 | autoupdate@1.1.4 7 | base64@1.0.2 8 | binary-heap@1.0.2 9 | blaze@2.0.4 10 | blaze-tools@1.0.2 11 | boilerplate-generator@1.0.2 12 | callback-hook@1.0.2 13 | check@1.0.3 14 | ddp@1.0.13 15 | deps@1.0.6 16 | ejson@1.0.5 17 | fastclick@1.0.2 18 | follower-livedata@1.0.3 19 | geojson-utils@1.0.2 20 | handlebars@1.0.2 21 | html-tools@1.0.3 22 | htmljs@1.0.3 23 | http@1.0.9 24 | id-map@1.0.2 25 | insecure@1.0.2 26 | iron:core@0.3.4 27 | iron:dynamic-template@0.4.1 28 | iron:layout@0.4.1 29 | iron:router@0.9.3 30 | jquery@1.0.2 31 | json@1.0.2 32 | launch-screen@1.0.1 33 | livedata@1.0.12 34 | logging@1.0.6 35 | meteor@1.1.4 36 | meteor-platform@1.2.1 37 | minifiers@1.1.3 38 | minimongo@1.0.6 39 | mobile-status-bar@1.0.2 40 | mongo@1.0.11 41 | observe-sequence@1.0.4 42 | ordered-dict@1.0.2 43 | random@1.0.2 44 | reactive-dict@1.0.5 45 | reactive-var@1.0.4 46 | reload@1.1.2 47 | retry@1.0.2 48 | routepolicy@1.0.3 49 | session@1.0.5 50 | spacebars@1.0.4 51 | spacebars-compiler@1.0.4 52 | templating@1.0.10 53 | tracker@1.0.4 54 | ui@1.0.5 55 | underscore@1.0.2 56 | url@1.0.3 57 | webapp@1.1.5 58 | webapp-hashing@1.0.2 59 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jimmy Lipham 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # meteor-mobile-desktop 2 | Sample showing how to break down a Meteor app into packages targeting both mobile and desktop experiences 3 | -------------------------------------------------------------------------------- /packages/app-base/lib/data.js: -------------------------------------------------------------------------------- 1 | /* Set up a collection and a publication that will be shared between 2 | * both desktop and mobile applications 3 | */ 4 | ProgLangs = new Meteor.Collection('proglangs'); 5 | 6 | /* We can also seed this collection with data if its empty -- OPTIONAL */ 7 | Meteor.startup(function() { 8 | if (Meteor.isServer) { 9 | if (ProgLangs.find().count() == 0) { 10 | console.log("[App-Base::Server] Seeding ProgLangs collection..."); 11 | ProgLangs.insert({ name: "C" }); 12 | ProgLangs.insert({ name: "C++" }); 13 | ProgLangs.insert({ name: "CoffeeScript" }); 14 | ProgLangs.insert({ name: "Go" }); 15 | ProgLangs.insert({ name: "Java" }); 16 | ProgLangs.insert({ name: "Javascript" }); 17 | ProgLangs.insert({ name: "Perl" }); 18 | ProgLangs.insert({ name: "PHP" }); 19 | ProgLangs.insert({ name: "Python" }); 20 | ProgLangs.insert({ name: "TCL" }); 21 | } 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /packages/app-base/lib/functions.js: -------------------------------------------------------------------------------- 1 | baseFunction = function() { 2 | console.log("[App-Base] baseFunction() called..."); 3 | return true; 4 | } 5 | 6 | Meteor.startup(function() { 7 | console.log("[App-Base] Initialized!"); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/app-base/lib/methods.js: -------------------------------------------------------------------------------- 1 | if (Meteor.isServer) { 2 | Meteor.methods({ 3 | echo: function(something) { 4 | console.log("[App-Base::Server] echo method called!"); 5 | return something; 6 | } 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /packages/app-base/package.js: -------------------------------------------------------------------------------- 1 | Package.describe({ 2 | summary: "MyApp base package", 3 | version: "0.0.1", 4 | name: "app-base" 5 | }); 6 | 7 | Package.onUse(function(api) { 8 | /* Add our packages that we depend on on both mobile/desktop sides */ 9 | api.use([ 10 | 'iron:router', 11 | 'meteor-platform', 12 | 'templating', 13 | 'handlebars', 14 | 'session', 15 | 'underscore', 16 | ],['client','server']); 17 | 18 | /* Add client side dependencies */ 19 | api.use([ 20 | 'jquery' 21 | ],'client'); 22 | 23 | /* Add each of our files that are a part of this package */ 24 | api.add_files([ 25 | 'lib/data.js', 26 | 'lib/functions.js', 27 | 'lib/methods.js' 28 | ],['client','server']); 29 | 30 | /* Export functions from this package that can be accessed anywhere */ 31 | api.export([ 32 | 'baseFunction', 33 | 'ProgLangs' 34 | ]); 35 | }); 36 | -------------------------------------------------------------------------------- /packages/app-desktop/lib/desktop.js: -------------------------------------------------------------------------------- 1 | Meteor.startup(function() { 2 | console.log("[App-Desktop] Initialized!"); 3 | 4 | // Call some sample functionality from our app-base functions 5 | var r = baseFunction(); 6 | console.log("[App-Desktop] baseFunction() returned " + r); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/app-desktop/lib/routes.js: -------------------------------------------------------------------------------- 1 | Router.configure({ 2 | layoutTemplate: 'layout' 3 | }); 4 | 5 | Router.map(function() { 6 | this.route('home', { 7 | path: '/', 8 | template: 'list' 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/app-desktop/package.js: -------------------------------------------------------------------------------- 1 | Package.describe({ 2 | summary: "MyApp desktop package", 3 | version: "0.0.1", 4 | name: "app-desktop" 5 | }); 6 | 7 | Package.onUse(function(api) { 8 | /* Add our packages that we depend on on both mobile/desktop sides */ 9 | api.use([ 10 | 'app-base', 11 | 'iron:router', 12 | 'meteor-platform', 13 | 'templating', 14 | 'handlebars', 15 | 'session', 16 | 'underscore', 17 | ],['client','server']); 18 | 19 | /* Add each of our files that are a part of this package */ 20 | api.add_files([ 21 | 'lib/desktop.js', 22 | 'lib/routes.js', 23 | 'views/layout.html', 24 | 'views/list.html', 25 | 'views/list.js' 26 | ],['web.browser']); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/app-desktop/views/layout.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /packages/app-desktop/views/list.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /packages/app-desktop/views/list.js: -------------------------------------------------------------------------------- 1 | Template.list.helpers({ 2 | programmingLanguages: function() { 3 | return ProgLangs.find(); 4 | } 5 | }); 6 | 7 | Template.list.events({ 8 | 'click .remove-lang': function(e,t) { 9 | ProgLangs.remove({_id: this._id }); 10 | }, 11 | 'submit #addLanguageForm': function(e,t) { 12 | e.preventDefault(); 13 | var name = t.find("#languageName").value; 14 | if (name.length > 0) 15 | ProgLangs.insert({name: name}); 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /packages/app-mobile/lib/mobile.js: -------------------------------------------------------------------------------- 1 | Meteor.startup(function() { 2 | console.log("[App-Mobile] Initialized!"); 3 | 4 | // Call some sample functionality from our app-base functions 5 | var r = baseFunction(); 6 | console.log("[App-Mobile] baseFunction() returned " + r); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/app-mobile/lib/routes.js: -------------------------------------------------------------------------------- 1 | Router.configure({ 2 | layoutTemplate: 'layout' 3 | }); 4 | 5 | Router.map(function() { 6 | this.route('home', { 7 | path: '/', 8 | template: 'list' 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/app-mobile/package.js: -------------------------------------------------------------------------------- 1 | Package.describe({ 2 | summary: "MyApp mobile package", 3 | version: "0.0.1", 4 | name: "app-mobile" 5 | }); 6 | 7 | Package.onUse(function(api) { 8 | /* Add our packages that we depend on on both mobile/desktop sides */ 9 | api.use([ 10 | 'app-base', 11 | 'iron:router', 12 | 'meteor-platform', 13 | 'templating', 14 | 'handlebars', 15 | 'session', 16 | 'underscore', 17 | ],['client','server']); 18 | 19 | /* Add each of our files that are a part of this package */ 20 | api.add_files([ 21 | 'lib/mobile.js', 22 | 'lib/routes.js', 23 | 'views/layout.html', 24 | 'views/list.html', 25 | 'views/list.js' 26 | ],['web.cordova']); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/app-mobile/views/layout.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /packages/app-mobile/views/list.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /packages/app-mobile/views/list.js: -------------------------------------------------------------------------------- 1 | Template.list.helpers({ 2 | programmingLanguages: function() { 3 | return ProgLangs.find(); 4 | } 5 | }); 6 | 7 | Template.list.events({ 8 | 'click .remove-lang': function(e,t) { 9 | ProgLangs.remove({_id: this._id }); 10 | }, 11 | 'submit #addLanguageForm': function(e,t) { 12 | e.preventDefault(); 13 | var name = t.find("#languageName").value; 14 | if (name.length > 0) 15 | ProgLangs.insert({name: name}); 16 | } 17 | }); 18 | --------------------------------------------------------------------------------