diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 6b6327176..8eef1dc3c 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -120,7 +120,6 @@ jobs: alias: - dev - ${{ github.sha }} - needs: - build-release-binary-alias - build-release-binary-branch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37ceb089f..e3105458a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,7 +129,6 @@ jobs: - edge - ${{ github.event.release.prerelease == false && 'stable' || 'prerelease' }} - ${{ github.ref_name }} - needs: - build-release-binary-alias - build-release-binary-tag diff --git a/CHANGELOG.md b/CHANGELOG.md index 74f787494..298946008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Fixed `lando shellenv` so it doesn't fail when `shell` profile is empty +* Fixed `lando update` so it removes lingering `lando.exe`s in the update bin directory +* Improved `lando shellenv` so that it always includes `~/.lando/bin` and includes it first +* Improved messaging on `lando shellenv --add` +* Improved messaging on `lando update` for `@lando/cli` + ## v3.23.11 - [November 20, 2024](https://github.com/lando/core/releases/tag/v3.23.11) * This release has no new content and is just to test the new modular release flow diff --git a/lib/checksums.txt b/lib/checksums.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/updates.js b/lib/updates.js index 8ace61653..1739e5246 100644 --- a/lib/updates.js +++ b/lib/updates.js @@ -6,6 +6,7 @@ const get = require('lodash/get'); const getOctokit = require('../utils/get-octokit'); const os = require('os'); const path = require('path'); +const remove = require('../utils/remove'); const semver = require('semver'); const uniqBy = require('lodash/uniqBy'); @@ -249,7 +250,16 @@ module.exports = class UpdateManager { // refresh the "symlink" require('../utils/link-bin')(this._cli.installPath, dest, {debug: this.debug}); - // is link is not in PATH then attempt to add it + // set a good default update messag + task.title = `Updated @lando/cli to ${version}`; + + // if lando.exe exists on windows in the install path then remove it so the link has primacy + // in PATHEXT hierarchy + if (process.platform === 'win32' && fs.existsSync(path.join(this._cli.installPath, filename))) { + remove(path.join(this._cli.installPath, filename)); + } + + // if link is not in PATH then attempt to add it // @NOTE: feels sufficient to just check for `lando` since it _should_ exist in win and posix if (!require('../utils/is-in-path')(path.join(this._cli.installPath, 'lando'))) { const binPaths = require('../utils/get-bin-paths')(this._cli); @@ -269,6 +279,7 @@ module.exports = class UpdateManager { const rcFile = require('../utils/get-shell-profile')(); require('../utils/update-shell-profile')(rcFile, shellEnv); this.debug('added %o to %o', shellEnv, rcFile); + task.title `${task.title}. Start a new terminal session to use the updated ${color.bold(`lando`)}`; // otherwis i guess do something else? // @TODO: throw a warning? @@ -276,7 +287,6 @@ module.exports = class UpdateManager { } // finish - task.title = `Updated @lando/cli to ${version}`; resolve(data); }); // handle errors diff --git a/tasks/shellenv.js b/tasks/shellenv.js index f2812e08c..91f0caf99 100644 --- a/tasks/shellenv.js +++ b/tasks/shellenv.js @@ -62,7 +62,7 @@ module.exports = lando => { console.log(); console.log(color.bold(binPaths.join(os.EOL))); console.log(); - console.log(`Open a new shell to load the changes!`); + console.log(`Start a new terminal session to use ${color.bold(`lando`)}`); return; // otherwise update the shell profile @@ -72,7 +72,7 @@ module.exports = lando => { console.log(); console.log(color.bold(shellEnv.map(line => line[0]).join(os.EOL))); console.log(); - console.log(`Open a new shell or run ${color.bold(`source ${options.add}`)} to load the changes`); + console.log(`Start a new terminal session or run ${color.bold(`eval "$(lando shellenv)"`)} to use ${color.bold(`lando`)}`); } else { console.log(`Looks like ${color.green(options.add)} is already ready to go!`); } diff --git a/utils/get-bin-paths.js b/utils/get-bin-paths.js index 9ea6865ba..db09c27c3 100644 --- a/utils/get-bin-paths.js +++ b/utils/get-bin-paths.js @@ -3,8 +3,8 @@ const fs = require('fs'); const path = require('path'); -module.exports = ({entrypoint, file, installPath}) => { - return [entrypoint, file, installPath] +module.exports = ({installPath}) => { + return [installPath] .filter(p => typeof p === 'string' && p !== '' && fs.existsSync(p)) .map(p => !fs.lstatSync(p).isDirectory() ? path.dirname(p) : p) .filter(p => !process.env.PATH.split(path.delimiter).includes(p)) diff --git a/utils/update-shell-profile.js b/utils/update-shell-profile.js index eddc9a989..239e1866b 100644 --- a/utils/update-shell-profile.js +++ b/utils/update-shell-profile.js @@ -18,8 +18,11 @@ module.exports = (file, updates = []) => { const content = read(file); // split into lines const lines = content.split('\n'); + // get penulimatimate + const penny = Math.max(lines.length - 2, 0); + // if we end up with second to last line that is empty then pop - if (lines[lines.length - 2].trim() === '') lines.pop(); + if (penny > 0 && lines[lines.length - 2].trim() === '') lines.pop(); // loops through the updates and add/update as needed for (const [update, search] of updates) {