From 2be7585937a4036ce0eec483b16ad09fcda99a61 Mon Sep 17 00:00:00 2001 From: Renan Castro Date: Thu, 4 Nov 2021 11:33:08 -0300 Subject: [PATCH] Bump version to 2.5.1 and support plain root installs --- npm-packages/meteor-installer/config.js | 19 +++++++++++++++---- npm-packages/meteor-installer/install.js | 5 ++--- npm-packages/meteor-installer/package.json | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/npm-packages/meteor-installer/config.js b/npm-packages/meteor-installer/config.js index 6d88c908ec..65b24369c7 100644 --- a/npm-packages/meteor-installer/config.js +++ b/npm-packages/meteor-installer/config.js @@ -1,7 +1,7 @@ const path = require('path'); const os = require('os'); -const METEOR_LATEST_VERSION = '2.5'; +const METEOR_LATEST_VERSION = '2.5.1'; const sudoUser = process.env.SUDO_USER || ''; function isRoot() { return process.getuid && process.getuid() === 0; @@ -9,9 +9,20 @@ function isRoot() { const localAppData = process.env.LOCALAPPDATA; const isWindows = () => os.platform() === 'win32'; const isMac = () => os.platform() === 'darwin'; -const rootPath = isWindows() - ? localAppData - : `${isRoot() ? `/home/${sudoUser}` : os.homedir()}`; + +let rootPath; +if (isWindows()) { + rootPath = localAppData; +} else if (isRoot() && sudoUser) { + rootPath = `/home/${sudoUser}`; +} else { + if (isRoot()) { + console.info( + 'You are running the install script as root, without SUDO. This is not recommended and should be avoided. Continuing.' + ); + } + rootPath = os.homedir(); +} if (isWindows() && !localAppData) { throw new Error('LOCALAPPDATA env var is not set.'); diff --git a/npm-packages/meteor-installer/install.js b/npm-packages/meteor-installer/install.js index 1f58d2e641..d451d1690c 100644 --- a/npm-packages/meteor-installer/install.js +++ b/npm-packages/meteor-installer/install.js @@ -31,7 +31,6 @@ const semver = require('semver') process.on('unhandledRejection', err => { throw err; }); - if (os.arch() !== 'x64') { const isValidM1Version = semver.gte(METEOR_LATEST_VERSION, '2.5.1'); if(os.arch() !== 'arm64' || !isMac() || !isValidM1Version){ @@ -246,8 +245,6 @@ function showGettingStarted() { Meteor has been installed! -*You might need to open a new terminal windows to have access to the meteor command.* - To get started fast: $ meteor create ~/my_cool_app @@ -262,6 +259,8 @@ Deploy and host your app with Cloud: www.meteor.com/cloud +*************************************** +*You need to open a new terminal window to have access to the meteor command.* *************************************** `; diff --git a/npm-packages/meteor-installer/package.json b/npm-packages/meteor-installer/package.json index cb9e7e0899..de075aabb4 100644 --- a/npm-packages/meteor-installer/package.json +++ b/npm-packages/meteor-installer/package.json @@ -1,6 +1,6 @@ { "name": "meteor", - "version": "2.5.0", + "version": "2.5.1", "description": "Install Meteor on Windows", "main": "install.js", "scripts": {