From 98b9123ac0ae8cb935ab1ce5900f9171c469e1be Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Fri, 31 Jul 2015 11:27:12 -0700 Subject: [PATCH 1/2] Make autoupdate depend on reload, which makes sense Since it actually calls reload --- packages/autoupdate/package.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/autoupdate/package.js b/packages/autoupdate/package.js index 648337a1da..b7bf2ca174 100644 --- a/packages/autoupdate/package.js +++ b/packages/autoupdate/package.js @@ -25,10 +25,10 @@ Package.onUse(function (api) { 'underscore' ], ['client', 'server']); - api.use('reload', 'client', {weak: true}); + api.use('reload', 'client'); api.use(['http', 'random'], 'web.cordova'); - + api.addFiles('autoupdate_server.js', 'server'); api.addFiles('autoupdate_client.js', 'web.browser'); api.addFiles('autoupdate_cordova.js', 'web.cordova'); From 3cfb718a91212b5cc635ea68ead982c09c1ab88b Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Thu, 30 Jul 2015 20:32:17 -0700 Subject: [PATCH 2/2] Split meteor-platform into smaller umbrella packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Discussion/plan here: https://github.com/meteor/meteor/pull/4851 `meteor-platform will no longer be a part of future Meteor releases. Apps `upgraded to Meteor 1.2 will be automatically updated to use the packages listed `above instead of meteor-platform. (Along with a set of packages like EJSON and `Random that used to be in meteor platform but probably shouldn’t have been) After this project, here is the set of packages that will be included by default in a newly created Meteor app: 1. `meteor-base` is the set of packages that basically every single Meteor app will have. If you don’t have these packages, you are probably doing something that isn’t really supported, like building a command line tool or switching out the whole web server stack. It comes with the following packages: 1. `meteor` - this includes stuff like `Meteor.isClient`, a default handler for `css` files, etc. 2. `webapp` - this is responsible for handling actual HTTP connections, Websockets, and serving files 3. `underscore` - almost all of Meteor is built on top of underscore, so it makes sense to let people assume that most or all Meteor apps right now will have this included 4. `autoupdate` - refreshing the client is a core part of the Meteor development experience, and it’s integrated into several layers of the stack 5. `ddp` - lots of core parts of Meteor assume that DDP can be used to communicate between client and server 2. `standard-minifiers` minifies your JS and CSS code in production 3. `ecmascript` allows you to write your app using new ES2015 JavaScript features 4. `es5-shim` polyfills some newer APIs in old and non-compliant browsers, in particular IE8 5. `mobile-experience` is a set of cordova-specific packages that set some good defaults when building for mobile. These packages only activate when you are building a native Android or iOS app. 1. `fastclick` - avoid the 300ms touch delay 2. `mobile-status-bar` - avoid the status bar information covering up your app content 3. `launch-screen` - cover the app with a launch image so that people don’t have to see things loading 6. `mongo` is the package that enables Meteor to connect to MongoDB on the server and watch queries in real-time. It also includes Minimongo for the client so that you can publish Mongo documents over DDP. This package will be removable in case you want to use one of the community-supported drivers for alternate databases, and for the desirable future where Meteor supports other databases officially. 7. `blaze-html-templates` compiles your `html` files with Spacebars and includes the Blaze runtime on the client so that the templates can run. If you remove this, you might want to include a different view layer like `react`, or `angular`, and use a package for rendering the starter HTML like `static-html` (also coming out in Meteor 1.2) 8. `tracker` the package that powers a lot of Meteor’s reactive APIs on the client. Including it in the app allows you to use `Tracker.autorun` directly. 9. `session` a simple global reactive dictionary for the client. 10. `jquery` a convenient utility library for the client. 11. `insecure` a prototyping package that lets you make any database modifications from the client. 12. `autopublish` a prototyping package that lets you access the whole database (except sensitive user data) from the client. --- packages/autopublish/package.js | 2 +- packages/blaze-html-templates/README.md | 9 ++++++ packages/blaze-html-templates/package.js | 25 +++++++++++++++ packages/blaze/preamble.js | 7 ++--- packages/insecure/package.js | 2 +- packages/meteor-base/README.md | 11 +++++++ packages/meteor-base/package.js | 31 +++++++++++++++++++ packages/mobile-experience/README.md | 7 +++++ packages/mobile-experience/package.js | 22 +++++++++++++ .../{ => non-core}/meteor-platform/.gitignore | 0 .../{ => non-core}/meteor-platform/README.md | 0 .../{ => non-core}/meteor-platform/package.js | 0 tools/static-assets/skel/.meteor/packages | 20 ++++++++---- tools/upgraders.js | 31 +++++++++++++++++++ 14 files changed, 155 insertions(+), 12 deletions(-) create mode 100644 packages/blaze-html-templates/README.md create mode 100644 packages/blaze-html-templates/package.js create mode 100644 packages/meteor-base/README.md create mode 100644 packages/meteor-base/package.js create mode 100644 packages/mobile-experience/README.md create mode 100644 packages/mobile-experience/package.js rename packages/{ => non-core}/meteor-platform/.gitignore (100%) rename packages/{ => non-core}/meteor-platform/README.md (100%) rename packages/{ => non-core}/meteor-platform/package.js (100%) diff --git a/packages/autopublish/package.js b/packages/autopublish/package.js index e23b9ebcdd..483e6a4473 100644 --- a/packages/autopublish/package.js +++ b/packages/autopublish/package.js @@ -1,5 +1,5 @@ Package.describe({ - summary: "Publish the entire database to all clients", + summary: "(For prototyping only) Publish the entire database to all clients", version: '1.0.4-plugins.0' }); diff --git a/packages/blaze-html-templates/README.md b/packages/blaze-html-templates/README.md new file mode 100644 index 0000000000..84ad905655 --- /dev/null +++ b/packages/blaze-html-templates/README.md @@ -0,0 +1,9 @@ +# blaze-html-templates + +A meta-package that includes everything you need to compile and run Meteor templates with Spacebars and Blaze. + +For more details, see the documentation of the component packages: + +- [templating](https://atmospherejs.com/meteor/templating): compiles `.html` files +- [blaze](https://atmospherejs.com/meteor/blaze): the runtime library +- [spacebars](https://atmospherejs.com/meteor/spacebars): the templating language diff --git a/packages/blaze-html-templates/package.js b/packages/blaze-html-templates/package.js new file mode 100644 index 0000000000..12f570a747 --- /dev/null +++ b/packages/blaze-html-templates/package.js @@ -0,0 +1,25 @@ +Package.describe({ + name: 'blaze-html-templates', + version: '1.0.0', + // Brief, one-line summary of the package. + summary: 'Compile HTML templates into reactive UI with Meteor Blaze', + // By default, Meteor will default to using README.md for documentation. + // To avoid submitting documentation, set this field to null. + documentation: 'README.md' +}); + +Package.onUse(function(api) { + api.imply([ + // A library for reactive user interfaces + 'blaze', + + // The following packages are basically empty shells that just exist to + // satisfy code checking for the existence of a package. Rest assured that + // they are not adding any bloat to your bundle. + 'ui', // XXX COMPAT WITH PACKAGES BUILT FOR 0.9.0. + 'spacebars', // XXX COMPAT WITH PACKAGES BUILT FOR 0.9.0 + + // Compile .html files into Blaze reactive views + 'templating' + ]); +}); diff --git a/packages/blaze/preamble.js b/packages/blaze/preamble.js index b90acdb3c3..aba9384a76 100644 --- a/packages/blaze/preamble.js +++ b/packages/blaze/preamble.js @@ -26,8 +26,7 @@ Blaze._escape = (function() { Blaze._warn = function (msg) { msg = 'Warning: ' + msg; - if ((typeof Log !== 'undefined') && Log && Log.warn) - Log.warn(msg); // use Meteor's "logging" package - else if ((typeof console !== 'undefined') && console.log) - console.log(msg); + if ((typeof console !== 'undefined') && console.warn) { + console.warn(msg); + } }; diff --git a/packages/insecure/package.js b/packages/insecure/package.js index f103d36fd3..4a42028932 100644 --- a/packages/insecure/package.js +++ b/packages/insecure/package.js @@ -1,5 +1,5 @@ Package.describe({ - summary: "Allow all database writes by default", + summary: "(For prototyping only) Allow all database writes from the client", version: '1.0.4-plugins.0' }); diff --git a/packages/meteor-base/README.md b/packages/meteor-base/README.md new file mode 100644 index 0000000000..8a62ab8fc5 --- /dev/null +++ b/packages/meteor-base/README.md @@ -0,0 +1,11 @@ +# meteor-base + +A default set of packages that almost every app will have. You should only remove this package if you really, really know what you are doing. + +It comes with the following packages: + +1. [`meteor`](https://atmospherejs.com/meteor/meteor) - Super basic stuff about the programming environment, and a handler for the `css` file type. +2. [`webapp`](https://atmospherejs.com/meteor/webapp) - The actual web server that handles connections, serves files, etc. +3. [`underscore`](https://atmospherejs.com/meteor/underscore) - A library with lots of useful utilities that most of Meteor is built on. +4. [`autoupdate`](https://atmospherejs.com/meteor/autoupdate) - Refreshes the client automatically when the server has new code. +5. [`ddp`](https://atmospherejs.com/meteor/ddp) - A protocol for communicating between the client and server. This is what enables `Meteor.methods`, `Meteor.publish`, `Meteor.subscribe`, etc. diff --git a/packages/meteor-base/package.js b/packages/meteor-base/package.js new file mode 100644 index 0000000000..0b64f228d4 --- /dev/null +++ b/packages/meteor-base/package.js @@ -0,0 +1,31 @@ +Package.describe({ + name: 'meteor-base', + version: '1.0.0', + // Brief, one-line summary of the package. + summary: 'Packages that every Meteor app needs', + // By default, Meteor will default to using README.md for documentation. + // To avoid submitting documentation, set this field to null. + documentation: 'README.md' +}); + +Package.onUse(function(api) { + api.imply([ + // Super basic stuff about where your code is running and async utilities + 'meteor', + + // This package enables making client-server connections; currently Meteor + // only supports building client/server web applications so this is not + // removable + 'webapp', + + // Most Meteor core packages depend on Underscore right now + 'underscore', + + // The protocol and client/server libraries that Meteor uses to send data + 'ddp', + 'livedata', // XXX COMPAT WITH PACKAGES BUILT FOR 0.9.0. + + // Push code changes to the client and automatically reload the page + 'autoupdate' + ]); +}); diff --git a/packages/mobile-experience/README.md b/packages/mobile-experience/README.md new file mode 100644 index 0000000000..4c0d0a980d --- /dev/null +++ b/packages/mobile-experience/README.md @@ -0,0 +1,7 @@ +# mobile-experience + +A set of Cordova/PhoneGap-specific packages that set some good defaults when building for mobile. These packages only activate when you are building a native Android or iOS app. + +1. [fastclick](https://atmospherejs.com/meteor/fastclick) - avoid the 300ms touch delay +2. [mobile-status-bar](https://atmospherejs.com/meteor/mobile-status-bar) - avoid the status bar information covering up your app content +3. [launch-screen](https://atmospherejs.com/meteor/launch-screen) - cover the app with a launch image so that people don’t have to see things loading diff --git a/packages/mobile-experience/package.js b/packages/mobile-experience/package.js new file mode 100644 index 0000000000..cc0d804d20 --- /dev/null +++ b/packages/mobile-experience/package.js @@ -0,0 +1,22 @@ +Package.describe({ + name: 'mobile-experience', + version: '1.0.0', + // Brief, one-line summary of the package. + summary: 'Packages for a great mobile user experience', + // By default, Meteor will default to using README.md for documentation. + // To avoid submitting documentation, set this field to null. + documentation: 'README.md' +}); + +Package.onUse(function(api) { + api.imply([ + // Fastclick: remove the 300 ms click event lag in mobile browsers + "fastclick", + + // A nicer appearance for the status bar in PhoneGap/Cordova apps + "mobile-status-bar", + + // Show a nice splash image while your PhoneGap/Cordova app's UI is loading + "launch-screen" + ], "web.cordova"); +}); diff --git a/packages/meteor-platform/.gitignore b/packages/non-core/meteor-platform/.gitignore similarity index 100% rename from packages/meteor-platform/.gitignore rename to packages/non-core/meteor-platform/.gitignore diff --git a/packages/meteor-platform/README.md b/packages/non-core/meteor-platform/README.md similarity index 100% rename from packages/meteor-platform/README.md rename to packages/non-core/meteor-platform/README.md diff --git a/packages/meteor-platform/package.js b/packages/non-core/meteor-platform/package.js similarity index 100% rename from packages/meteor-platform/package.js rename to packages/non-core/meteor-platform/package.js diff --git a/tools/static-assets/skel/.meteor/packages b/tools/static-assets/skel/.meteor/packages index 792d1296b6..a9f8340d51 100644 --- a/tools/static-assets/skel/.meteor/packages +++ b/tools/static-assets/skel/.meteor/packages @@ -4,9 +4,17 @@ # 'meteor add' and 'meteor remove' will edit this file for you, # but you can also edit it by hand. -meteor-platform -standard-minifiers # JS/CSS minifiers run for production mode -autopublish # publishes all data to the clients for prototyping -insecure # allows all DB writes from clients for prototyping -es5-shim # ECMAScript 5 compatibility for older browsers. -ecmascript # allows ECMAScript2015+ syntax by default +meteor-base # Packages every Meteor app needs to have +mobile-experience # Packages for a great mobile UX +mongo # The database Meteor supports right now +blaze-html-templates # Compile .html files into Meteor Blaze views +session # Client-side reactive dictionary for your app +jquery # Helpful client-side library +tracker # Meteor's client-side reactive programming library + +standard-minifiers # JS/CSS minifiers run for production mode +es5-shim # ECMAScript 5 compatibility for older browsers. +ecmascript # Enable ECMAScript2015+ syntax in app code + +autopublish # Publish all data to the clients (for prototyping) +insecure # Allow all DB writes from clients (for prototyping) diff --git a/tools/upgraders.js b/tools/upgraders.js index 40ff72e3f8..d8a12f0293 100644 --- a/tools/upgraders.js +++ b/tools/upgraders.js @@ -132,6 +132,37 @@ var upgradersByName = { projectContext.projectConstraintsFile.addConstraints( ['standard-minifiers']); projectContext.projectConstraintsFile.writeIfModified(); + }, + + "1.2.0-meteor-platform-split": function (projectContext) { + const packagesFile = projectContext.projectConstraintsFile; + // meteor-platform is split into a series of smaller umbrella packages + // Only run this upgrader if the app has meteor-platform + if (packagesFile.getConstraint('meteor-platform')) { + packagesFile.removePackages(['meteor-platform']); + + packagesFile.addConstraints([ + // These packages replace meteor-platform in newly created apps + 'meteor-base', + 'mobile-experience', + 'mongo', + 'blaze-html-templates', + 'session', + 'jquery', + 'tracker', + + // These packages are not in newly created apps, but were in + // meteor-platform so we need to add them just in case + 'logging', + 'reload', + 'random', + 'ejson', + 'spacebars', + 'check', + ].map((pkgName) => {return {package: pkgName}})); + + packagesFile.writeIfModified(); + } } ////////////