-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Simplify built-in quickstarts to a simple hello world #849
Changes from 29 commits
0163474
d53c02d
927d438
48fc9b6
b65bb11
c539824
d562ff8
97210ec
2a3f7d5
022b827
777fbef
a9323d4
b8cfc19
840e662
72208d9
0c6abaa
68e72c9
1caa66d
667e265
80c68f3
e75f808
012168e
1b5757f
7648247
5b91fc4
6c5a656
a9ab5a4
89f2e40
8340bb5
dd1d16f
14cb8f5
58a4f3a
f02109e
a153a30
f13ef65
348ef5b
aeaf413
d61e3e8
e685a94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,13 +77,34 @@ def do_cli(ctx, location, runtime, output_dir, name, no_input): | |
LOG.debug("Init command") | ||
click.secho("[+] Initializing project structure...", fg="green") | ||
|
||
no_build_msg = """ | ||
Project generated: {output_dir}/{name} | ||
|
||
Steps you can take next within the project folder | ||
=================================================== | ||
[*] Invoke Function: sam local invoke HelloWorldFunction --event event.json | ||
[*] Start API Gateway locally: sam local start-api | ||
""".format(output_dir=output_dir, name=name) | ||
|
||
build_msg = """ | ||
Project generated: {output_dir}/{name} | ||
|
||
Steps you can take next within the project folder | ||
=================================================== | ||
[*] Install dependencies | ||
[*] Invoke Function: sam local invoke HelloWorldFunction --event event.json | ||
[*] Start API Gateway locally: sam local start-api | ||
""".format(output_dir=output_dir, name=name) | ||
|
||
no_build_step_required = ( | ||
"python", "python3.7", "python3.6", "python2.7", "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "ruby2.5") | ||
next_step_msg = no_build_msg if runtime in no_build_step_required else build_msg | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if a custom template takes in a the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you mean by a custom template takes in 'a in the --runtime arg' -- This is a quick workaround until sam build fully supports all runtimes so the message will remain consistent and this will be deleted, though the workaround is flawed in the sense of as no_build_step_required = (
"python", "python3.7", "python3.6", "python2.7", "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "ruby2.5")
next_step_msg = no_build_msg if runtime in no_build_step_required else build_msg
What would you suggest instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I was getting two PRs mixed up, where I thought we were passing runtime to cookiecutter examples that are passed to |
||
|
||
try: | ||
generate_project(location, runtime, output_dir, name, no_input) | ||
# Custom templates can implement their own visual cues so let's not repeat the message | ||
if not location: | ||
click.secho( | ||
"[SUCCESS] - Read {name}/README.md for further instructions on how to proceed" | ||
.format(name=name), bold=True) | ||
click.secho(next_step_msg, bold=True) | ||
click.secho("Read {name}/README.md for further instructions\n".format(name=name), bold=True) | ||
click.secho("[*] Project initialization is now complete", fg="green") | ||
except GenerateProjectFailedError as e: | ||
raise UserException(str(e)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,9 @@ | |
"python2.7": os.path.join(_templates, "cookiecutter-aws-sam-hello-python"), | ||
"python": os.path.join(_templates, "cookiecutter-aws-sam-hello-python"), | ||
"ruby2.5": os.path.join(_templates, "cookiecutter-aws-sam-hello-ruby"), | ||
"nodejs6.10": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"), | ||
"nodejs6.10": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs-legacy"), | ||
"nodejs8.10": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"), | ||
"nodejs4.3": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"), | ||
"nodejs4.3": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs-legacy"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove 4.3 support since Lambda does not support creating or updating functions with runtimes of nodejs4.3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
"nodejs": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"), | ||
"dotnetcore2.0": os.path.join(_templates, "cookiecutter-aws-sam-hello-dotnet"), | ||
"dotnetcore2.1": os.path.join(_templates, "cookiecutter-aws-sam-hello-dotnet"), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
|
||
# Created by https://www.gitignore.io/api/osx,linux,python,windows | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### OSX ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
.pytest_cache/ | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule.* | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
|
||
# End of https://www.gitignore.io/api/osx,linux,python,windows |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
software and associated documentation files (the "Software"), to deal in the Software | ||
without restriction, including without limitation the rights to use, copy, modify, | ||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Cookiecutter legacy NodeJS Hello-world for SAM based Serverless App | ||
|
||
A cookiecutter template to create a legacy NodeJS Hello world boilerplate using [Serverless Application Model (SAM)](https://github.com/awslabs/serverless-application-model). | ||
|
||
## Requirements | ||
|
||
* [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli) | ||
|
||
## Usage | ||
|
||
Generate a boilerplate template in your current project directory using the following syntax: | ||
|
||
* **NodeJS 8**: `sam init --runtime nodejs6.10` | ||
* **NodeJS 6**: `sam init --runtime nodejs4.3` | ||
|
||
> **NOTE**: ``--name`` allows you to specify a different project folder name (`sam-app` is the default) | ||
|
||
# Credits | ||
|
||
* This project has been generated with [Cookiecutter](https://github.com/audreyr/cookiecutter) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"project_name": "Name of the project", | ||
"runtime": "nodejs8.10" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[install] | ||
prefix= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lambda has moved nodejs4.3 to depreciated, meaning creating and updating functions is no longer allows/supported. Can we match that expectation here and remove creation of Nodejs.4.3 functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, done!