Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nodejs 20 #124

Merged
merged 4 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Get Version from Git Tag
id: tag_name
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6]
python: [3.8]
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python }}
Expand All @@ -65,10 +65,10 @@ jobs:
uses: actions/download-artifact@v3
with:
name: package-npm
- name: Download Python 3.6 Artifacts
- name: Download Python 3.8 Artifacts
uses: actions/download-artifact@v3
with:
name: dist-py3.6
name: dist-py3.8
path: dist/
- name: List Artifacts
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
python: [ 3.8, 3.9 ]
node: [ 18 ]
python: [ "3.8", "3.9", "3.10", "3.11"]
node: [ 20 ]
env:
SAM_CLI_TELEMETRY: "0"
AWS_REGION: "us-east-1"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- --indent=4
- --no-sort-keys
- id: check-merge-conflict
- id: check-yaml
# - id: check-yaml # have jinja yml templates so skipping this
- repo: https://github.com/pycqa/flake8
rev: "5.0.4"
hooks:
Expand Down
1,184 changes: 701 additions & 483 deletions Pipfile.lock

Large diffs are not rendered by default.

6,821 changes: 4,328 additions & 2,493 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:debug": "npx --node-arg=--inspect jest --runInBand"
},
"engines": {
"node": ">=14.0.0",
"node": ">=20.0.0",
"npm": ">=6.9.0"
},
"repository": {
Expand Down
15 changes: 10 additions & 5 deletions python/rpdk/typescript/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def validate_no(value):
class TypescriptLanguagePlugin(LanguagePlugin):
MODULE_NAME = __name__
NAME = "typescript"
RUNTIME = "nodejs18.x"
RUNTIME = "nodejs20.x"
ENTRY_POINT = "dist/handlers.entrypoint"
TEST_ENTRY_POINT = "dist/handlers.testEntrypoint"
CODE_URI = "./"
Expand Down Expand Up @@ -156,20 +156,25 @@ def _copy_resource(path, resource_name=None):
lib_name=SUPPORT_LIB_NAME,
)

_render_template(
project.root / "Makefile",
)

# CloudFormation/SAM template for handler lambda
handler_params = {
"Handler": project.entrypoint,
"Runtime": project.runtime,
"CodeUri": self.CODE_URI,
}
handler_function = {
"TestEntrypoint": {**handler_params, "Handler": project.test_entrypoint},
test_handler_params = {
**handler_params,
"Handler": project.test_entrypoint,
}
handler_function[MAIN_HANDLER_FUNCTION] = handler_params
_render_template(
project.root / "template.yml",
resource_type=project.type_name,
functions=handler_function,
handler_params=handler_params,
test_handler_params=test_handler_params,
)

LOG.debug("Init complete")
Expand Down
3 changes: 3 additions & 0 deletions python/rpdk/typescript/templates/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build-TypeFunction:
npx npm ci
npx npm run build
2 changes: 1 addition & 1 deletion python/rpdk/typescript/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"class-transformer": "0.3.1"
},
"devDependencies": {
"@types/node": "^14.0.0",
"@types/node": "^20.0.0",
"typescript": "^4.1.2"
},
"optionalDependencies": {
Expand Down
25 changes: 25 additions & 0 deletions python/rpdk/typescript/templates/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template for the {{ resource_type }} resource type

Globals:
Function:
Timeout: 180 # docker start-up times can be long for SAM CLI
MemorySize: 256

Resources:
TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
{% for key, value in test_handler_params.items() %}
{{ key }}: {{ value }}
{% endfor %}

TypeFunction:
Type: AWS::Serverless::Function
Properties:
{% for key, value in handler_params.items() %}
{{ key }}: {{ value }}
{% endfor %}
Metadata:
BuildMethod: makefile
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def find_version(*file_paths):
# package_data -> use MANIFEST.in instead
include_package_data=True,
zip_safe=True,
python_requires=">=3.6",
python_requires=">=3.8",
install_requires=[
"cloudformation-cli>=0.1.14",
"zipfile38>=0.0.3,<0.2",
Expand All @@ -60,9 +60,10 @@ def find_version(*file_paths):
"Topic :: Software Development :: Code Generators",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
keywords="Amazon Web Services AWS CloudFormation",
)
2 changes: 2 additions & 0 deletions tests/plugin/codegen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def test_initialize(project_no_docker_use_docker_values):
f"{os.path.join('example_inputs', 'inputs_1_create.json')}",
f"{os.path.join('example_inputs', 'inputs_1_invalid.json')}",
f"{os.path.join('example_inputs', 'inputs_1_update.json')}",
"Makefile",
"package.json",
"README.md",
"sam-tests",
Expand All @@ -215,6 +216,7 @@ def test_initialize(project_no_docker_use_docker_values):
assert "models.ts" in readme

assert project_value.entrypoint in files["template.yml"].read_text()
assert "BuildMethod: makefile" in files["template.yml"].read_text()


def test_generate(project: Project):
Expand Down
Loading