From f4d677fbc8042231971aae3de458be9368e54bde Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Thu, 9 Feb 2017 19:48:02 +0200 Subject: [PATCH] Add an upgrader which modifies `accounts-*` packages automatically. The transformations to be made here are: * Existence of `accounts-` **adds** `-config-ui` * Existence of `` **changes to** `-oauth` https://github.com/meteor/meteor/issues/7715#issuecomment-276529351 Relates to: * facebook: https://github.com/meteor/meteor/pull/7728 * github: https://github.com/meteor/meteor/pull/8303 * google: https://github.com/meteor/meteor/pull/8275 * meetup: https://github.com/meteor/meteor/pull/8231 * meteor-developer: https://github.com/meteor/meteor/pull/8305 * twitter: https://github.com/meteor/meteor/pull/8283 * weibo: https://github.com/meteor/meteor/pull/8302 --- tools/upgraders.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tools/upgraders.js b/tools/upgraders.js index 94528f9232..5605642d13 100644 --- a/tools/upgraders.js +++ b/tools/upgraders.js @@ -239,6 +239,52 @@ the guide about breaking changes here:`, packagesFile.writeIfModified(); }, + "1.4.3-split-account-service-packages": function (projectContext) { + + maybePrintNoticeHeader(); + Console.info( +`The account packages for different services (e.g. facebook, twitter, \ +google, etc.) have been split and now make it possible to avoid bundling Blaze \ +in the client bundle for projects not using Blaze. If found in the \ +.meteor/packages file, these packages have been split automatically. Assuming \ +there are no other Blaze dependencies, the "-config-ui" package can \ +be removed if there is no need for the Blaze configuration interface.`, + Console.options({ bulletPoint: "1.4.3: " }) + ); + + const packagesFile = projectContext.projectConstraintsFile; + + // The transformations to be made here are: + // * Existence of `accounts-` **adds** `-config-ui` + // * Existence of `` **changes to** `-oauth` + // https://github.com/meteor/meteor/issues/7715#issuecomment-276529351 + + const servicesAffected = [ + 'facebook', + 'github', + 'google', + 'meetup', + 'meteor-developer', + 'twitter', + 'weibo', + ]; + + servicesAffected.forEach(service => { + // If `accounts-`, we just add the configuration UI + if (packagesFile.getConstraint(`accounts-${service}`)) { + packagesFile.addPackages([`${service}-config-ui`]); + } + + // If ``, it changes to `-oauth` + if (packagesFile.getConstraint(service)) { + packagesFile.removePackages([service]) + packagesFile.addPackages([`${service}-oauth`]); + } + }); + + packagesFile.writeIfModified(); + }, + //////////// // PLEASE. When adding new upgraders that print mesasges, follow the // examples for 0.9.0 and 0.9.1 above. Specifically, formatting