From f578edf13b6a582dccd013f68728c9749efcaeea Mon Sep 17 00:00:00 2001 From: Martijn Walraven Date: Thu, 25 Feb 2016 12:39:51 +0100 Subject: [PATCH] Add `--server-only` option to `meteor build` to skip building mobile apps Closes #6270. --- tools/cli/commands.js | 16 ++++++++++------ tools/cli/help.txt | 28 ++++++++++++++++------------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/tools/cli/commands.js b/tools/cli/commands.js index 574ddce933..b3cac8980b 100644 --- a/tools/cli/commands.js +++ b/tools/cli/commands.js @@ -785,6 +785,7 @@ var buildCommands = { debug: { type: Boolean }, directory: { type: Boolean }, architecture: { type: String }, + "server-only": { type: Boolean }, 'mobile-settings': { type: String }, server: { type: String }, // XXX COMPAT WITH 0.9.2.2 @@ -815,7 +816,7 @@ main.registerCommand(_.extend({ name: 'bundle', hidden: true "a single tarball. See " + Console.command("'meteor help build'") + " " + "for more information."); Console.error(); - return buildCommand(_.extend(options, { _serverOnly: true })); + return buildCommand(_.extend(options, { _bundleOnly: true })); }); var buildCommand = function (options) { @@ -848,6 +849,9 @@ var buildCommand = function (options) { }); projectContext.packageMapDelta.displayOnConsole(); + // _bundleOnly implies serverOnly + const serverOnly = options._bundleOnly || !!options['server-only']; + // options['mobile-settings'] is used to set the initial value of // `Meteor.settings` on mobile apps. Pass it on to options.settings, // which is used in this command. @@ -859,7 +863,7 @@ var buildCommand = function (options) { let cordovaPlatforms; let parsedMobileServerUrl; - if (!options._serverOnly) { + if (!serverOnly) { cordovaPlatforms = projectContext.platformList.getCordovaPlatforms(); if (process.platform !== 'darwin' && _.contains(cordovaPlatforms, 'ios')) { @@ -904,7 +908,7 @@ ${Console.command("meteor build ../output")}`, } var bundlePath = options.directory ? - (options._serverOnly ? outputPath : + (options._bundleOnly ? outputPath : files.pathJoin(outputPath, 'bundle')) : files.pathJoin(buildDir, 'bundle'); @@ -935,14 +939,14 @@ ${Console.command("meteor build ../output")}`, return 1; } - if (! options._serverOnly) { + if (!options._bundleOnly) { files.mkdir_p(outputPath); } - if (! options.directory) { + if (!options.directory) { main.captureAndExit('', 'creating server tarball', () => { try { - var outputTar = options._serverOnly ? outputPath : + var outputTar = options._bundleOnly ? outputPath : files.pathJoin(outputPath, appName + '.tar.gz'); files.createTarball(files.pathJoin(buildDir, 'bundle'), outputTar); diff --git a/tools/cli/help.txt b/tools/cli/help.txt index 232dafac91..2cd2c7c6e1 100644 --- a/tools/cli/help.txt +++ b/tools/cli/help.txt @@ -276,27 +276,31 @@ tarball. See 'meteor help build' for more information. >>> build Build this project for all platforms. -Usage: meteor build [--debug] [--directory] +Usage: meteor build [--debug] [--directory] [--server-only] [--mobile-settings settings.json] [--server http://example.com:3000] Package this project up for deployment. The command outputs a directory with builds for all platforms in this project. -By default, the output directory will contain just a tarball that includes -everything necessary to run the application server. (See README in the tarball -for details.) - If you have added mobile platforms to your project with the 'meteor add-platform' command, then the output directory will contain subdirectories named 'android' (with the APK bundle and Android project source) and/or 'ios' (with the Xcode project source). +Pass `--server-only` to skip building mobile apps, but still build the +'web.cordova' client target so the server can support hot code push +for Cordova apps. + +The output directory will contain a tarball that includes everything necessary +to run the application server. (See README in the tarball for details.) Options: --debug Build in debug mode (don't minify, etc). --directory Output a directory (rather than a tarball) for the application server bundle. If the output location exists, it will be recursively deleted first. + --server-only Skip building mobile apps even if mobile platforms have + been added. --mobile-settings Set optional data for the initial value of Meteor.settings in your mobile application. A new value for Meteor.settings can be set later by the server as part of @@ -537,17 +541,17 @@ Test the application Usage: meteor test-app --driver-package [options] meteor test-app --driver-package --unit [options] meteor test-app --driver-package --integration [options] - + Runs tests against the application, either in *unit* or *integration* (the default) test mode. meteor test-app will start a special app based on -a test driver (specified with --driver-package -- read more about driver -packages at http://guide.meteor.com/testing.html#driver-packages) -which handles the task of running tests and displaying the results in the +a test driver (specified with --driver-package -- read more about driver +packages at http://guide.meteor.com/testing.html#driver-packages) +which handles the task of running tests and displaying the results in the browser when you visit it. In unit test mode, no files in your application are eagerly loaded, aside -from test files (in you tests/ directory or named test[s].* or *.test[s].*). -You can import your app's modules from within your tests and test them in +from test files (in you tests/ directory or named test[s].* or *.test[s].*). +You can import your app's modules from within your tests and test them in isolation. In integration test mode, your app is loaded as usual, and then made hidden, @@ -561,7 +565,7 @@ deploy' server by using --deploy. This gives you a public URL that you can use in conjunction with a service like Browserling or BrowserStack to try the tests against many different browser versions. -Read more about testing your application in the Testing Article of the +Read more about testing your application in the Testing Article of the Meteor Guide - https://guide.meteor.com/testing.html Options: