From 002b6f9e89e95b173d07aa3924380cdb8536b482 Mon Sep 17 00:00:00 2001 From: Daniel Mil <84205762+mildaniel@users.noreply.github.com> Date: Mon, 13 May 2024 14:15:10 -0700 Subject: [PATCH] chore: Improve npm install debug logging (#652) --- Makefile | 6 +++--- .../workflows/nodejs_npm/actions.py | 4 ++-- .../workflows/nodejs_npm/workflow.py | 5 +++++ pyproject.toml | 16 +++++++++------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 0232ed82f..4f6d51d97 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,8 @@ integ-test: LAMBDA_BUILDERS_DEV=1 pytest tests/integration lint: - # Liner performs static analysis to catch latent bugs - ruff aws_lambda_builders + # Linter performs static analysis to catch latent bugs + ruff check aws_lambda_builders lint-fix: ruff aws_lambda_builders --fix @@ -35,4 +35,4 @@ black-check: # Verifications to run before sending a pull request pr: init dev black-check -format: lint-fix black \ No newline at end of file +format: lint-fix black diff --git a/aws_lambda_builders/workflows/nodejs_npm/actions.py b/aws_lambda_builders/workflows/nodejs_npm/actions.py index d73f0bd80..2b7dc656c 100644 --- a/aws_lambda_builders/workflows/nodejs_npm/actions.py +++ b/aws_lambda_builders/workflows/nodejs_npm/actions.py @@ -108,7 +108,7 @@ def execute(self): :raises lambda_builders.actions.ActionFailedError: when NPM execution fails """ try: - LOG.debug("NODEJS installing in: %s", self.install_dir) + LOG.debug("NODEJS installing production dependencies in: %s", self.install_dir) command = ["install", "-q", "--no-audit", "--no-save", "--unsafe-perm", "--production"] self.subprocess_npm.run(command, cwd=self.install_dir) @@ -132,7 +132,7 @@ def execute(self): :raises lambda_builders.actions.ActionFailedError: when NPM execution fails """ try: - LOG.debug("NODEJS updating in: %s", self.install_dir) + LOG.debug("NODEJS updating production dependencies in: %s", self.install_dir) command = [ "update", diff --git a/aws_lambda_builders/workflows/nodejs_npm/workflow.py b/aws_lambda_builders/workflows/nodejs_npm/workflow.py index f1e9ff5b1..894045cee 100644 --- a/aws_lambda_builders/workflows/nodejs_npm/workflow.py +++ b/aws_lambda_builders/workflows/nodejs_npm/workflow.py @@ -243,6 +243,11 @@ def get_install_action( if build_options and isinstance(build_options, dict): npm_ci_option = build_options.get("use_npm_ci", False) + LOG.debug( + "npm installation actions install only production dependencies. " + "Dev dependencies are omitted from the Lambda artifacts package" + ) + if (osutils.file_exists(lockfile_path) or osutils.file_exists(shrinkwrap_path)) and npm_ci_option: return NodejsNpmCIAction( install_dir=install_dir, subprocess_npm=subprocess_npm, install_links=is_building_in_source diff --git a/pyproject.toml b/pyproject.toml index 84605b183..02b61a4d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,20 @@ [tool.ruff] line-length = 120 +[tool.ruff.lint] + select = [ - "E", # Pycodestyle - "F", # Pyflakes - "PL", # pylint - "I", # isort + "E", # Pycodestyle + "F", # Pyflakes + "PL", # pylint + "I", # isort ] ignore = ["PLR0913"] -[tool.ruff.pylint] +[tool.ruff.lint.pylint] max-branches = 13 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "E501"] "aws_lambda_builders/workflow.py" = ["E501"] @@ -32,4 +34,4 @@ exclude = ''' | pip-wheel-metadata )/ ) -''' \ No newline at end of file +'''