Skip to content

Conversation

toddhainsworth
Copy link
Member

This change allows us to see more detail when the package manager fails for whatever reason. For most package managers, the specific error message when not using --verbose (for example) only include a fairly generic error, even if the error is unrecoverable.

This change allows us to see more detail when the package manager fails
for whatever reason. For most package managers, the specific error
message when not using `--verbose` (for example) only include a fairly
generic error, even if the error is unrecoverable.
@toddhainsworth toddhainsworth added the enhancement New feature or request label Mar 30, 2025
@toddhainsworth toddhainsworth self-assigned this Mar 30, 2025
Copy link
Contributor

@AdamJHall AdamJHall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

@kai-nguyen-aligent kai-nguyen-aligent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look great, @toddhainsworth
I'm so happy that there is someone else who cares about this repo.

return 'yarn install --frozen-lockfile';
export function getInstallCommand(
packageManager: PackageManager,
debug: boolean = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just import the global debug environment variables instead of passing it in as a parameter like this. Check out how it is setup in injectCfnRole.ts file:

import { env } from './env';

if (env.debug) {
            console.log(
                logSymbols.info,
                chalk.whiteBright(JSON.stringify(serverless, null, 2))
            );
        }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good pickup! Thanks, I'll update.

const installCommands: Record<PackageManager, string> = {
npm: 'npm ci',
pnpm: 'pnpm install --frozen-lockfile',
yarn: 'yarn install --frozen-lockfile',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this. yarn no longer use --frozen-lockfile. the correct flag is now --immutable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another great pickup! Do we need to decide based on the Yarn version or are we happy to only support versions >= the version that introduced --immutable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's there in Yarn Berry since version 2.0.0. I think it's safe for us to assume that no one ever run this pipeline in Yarn Classic. If they ever do it, probably they made another mistake and need to upgrade their package manager to Yarn Berry 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent - pushed a change to use --immutable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, Use --immutable for Yarn and debug from environment didn't actually use --immutable 🤣 .

@toddhainsworth
Copy link
Member Author

Thanks guys, ready for another review.

@toddhainsworth toddhainsworth merged commit 9ac3e5a into main Mar 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants