Skip to content

Commit 036cbf5

Browse files
Merge branch 'develop'
2 parents 2d5f583 + 40cbfa5 commit 036cbf5

File tree

6 files changed

+106
-6
lines changed

6 files changed

+106
-6
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Create an issue to report a bug for AWS Lambda Builders
44
title: "Bug: TITLE"
5-
labels: ['type/bug', 'stage/needs-triage']
5+
labels: ['stage/needs-triage']
66
assignees: ''
77

88
---

.github/workflows/codeql.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "develop", main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "develop" ]
20+
schedule:
21+
- cron: '44 21 * * 2'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
if: github.repository_owner == 'aws'
27+
runs-on: ubuntu-latest
28+
permissions:
29+
actions: read
30+
contents: read
31+
security-events: write
32+
statuses: write
33+
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
language: [ 'python' ]
38+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
39+
# Use only 'java' to analyze code written in Java, Kotlin or both
40+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
41+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v3
46+
47+
# Initializes the CodeQL tools for scanning.
48+
- name: Initialize CodeQL
49+
uses: github/codeql-action/init@v2
50+
with:
51+
languages: ${{ matrix.language }}
52+
# If you wish to specify custom queries, you can do so here or in a config file.
53+
# By default, queries listed here will override any specified in a config file.
54+
# Prefix the list here with "+" to use these queries and those in the config file.
55+
56+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
57+
# queries: security-extended,security-and-quality
58+
59+
60+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
61+
# If this step fails, then you should remove it and run the build manually (see below)
62+
- name: Autobuild
63+
uses: github/codeql-action/autobuild@v2
64+
65+
# ℹ️ Command-line programs to run using the OS shell.
66+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
67+
68+
# If the Autobuild fails above, remove it and uncomment the following three lines.
69+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
70+
71+
# - run: |
72+
# echo "Run, Build Application using script"
73+
# ./location_of_script_within_repo/buildscript.sh
74+
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@v2
77+
with:
78+
category: "/language:${{matrix.language}}"

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
# Changing version will trigger a new release!
66
# Please make the version change as the last step of your development.
7-
__version__ = "1.24.0"
7+
__version__ = "1.25.0"
88
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/workflows/nodejs_npm_esbuild/esbuild.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def run(self, args, cwd=None):
120120
SUPPORTED_ESBUILD_APIS_MULTI_VALUE = [
121121
"external",
122122
"loader",
123+
"out_extension",
123124
]
124125

125126

tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import tempfile
44
from pathlib import Path
55
from unittest import TestCase
6-
from unittest.mock import patch
76

87
from aws_lambda_builders.builder import LambdaBuilder
98
from aws_lambda_builders.exceptions import WorkflowFailedError
@@ -32,7 +31,7 @@ def setUp(self):
3231
def _set_esbuild_binary_path(self):
3332
npm = SubprocessNpm(self.osutils)
3433
esbuild_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-binary")
35-
npm.run(["ci"], cwd=esbuild_dir)
34+
npm.run(["install"], cwd=esbuild_dir)
3635
self.root_path = npm.run(["root"], cwd=esbuild_dir)
3736
self.binpath = Path(self.root_path, ".bin")
3837

@@ -169,7 +168,7 @@ def test_bundles_project_without_dependencies(self, runtime):
169168
osutils = OSUtils()
170169
npm = SubprocessNpm(osutils)
171170
esbuild_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-binary")
172-
npm.run(["ci"], cwd=esbuild_dir)
171+
npm.run(["install"], cwd=esbuild_dir)
173172
binpath = Path(npm.run(["root"], cwd=esbuild_dir), ".bin")
174173

175174
self.builder.build(
@@ -195,7 +194,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w
195194
osutils = OSUtils()
196195
npm = SubprocessNpm(osutils)
197196
esbuild_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-binary")
198-
npm.run(["ci"], cwd=esbuild_dir)
197+
npm.run(["install"], cwd=esbuild_dir)
199198
binpath = Path(npm.run(["root"], cwd=esbuild_dir), ".bin")
200199

201200
self.builder.build(
@@ -388,3 +387,23 @@ def test_includes_sourcemap_if_requested(self, runtime):
388387
expected_files = {"included.js", "included.js.map"}
389388
output_files = set(os.listdir(self.artifacts_dir))
390389
self.assertEqual(expected_files, output_files)
390+
391+
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
392+
def test_esbuild_produces_mjs_output_files(self, runtime):
393+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild")
394+
options = {"entry_points": ["included.js"], "sourcemap": True, "out_extension": [".js=.mjs"]}
395+
396+
self.builder.build(
397+
source_dir,
398+
self.artifacts_dir,
399+
self.scratch_dir,
400+
os.path.join(source_dir, "package.json"),
401+
runtime=runtime,
402+
options=options,
403+
experimental_flags=[],
404+
executable_search_paths=[self.binpath],
405+
)
406+
407+
expected_files = {"included.mjs", "included.mjs.map"}
408+
output_files = set(os.listdir(self.artifacts_dir))
409+
self.assertEqual(expected_files, output_files)

tests/unit/workflows/nodejs_npm_esbuild/test_esbuild.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def test_builds_args_from_config(self, osutils_mock):
200200
"target": "node14",
201201
"loader": [".proto=text", ".json=js"],
202202
"external": ["aws-sdk", "axios"],
203+
"out_extension": [".js=.mjs"],
203204
"main_fields": "module,main",
204205
}
205206

@@ -219,6 +220,7 @@ def test_builds_args_from_config(self, osutils_mock):
219220
"--external:axios",
220221
"--loader:.proto=text",
221222
"--loader:.json=js",
223+
"--out-extension:.js=.mjs",
222224
],
223225
)
224226

0 commit comments

Comments
 (0)