Skip to content

Commit d7501dd

Browse files
committed
feat: extracted from map repo
0 parents  commit d7501dd

28 files changed

+6428
-0
lines changed

.envrc.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export AWS_REGION=... # AWS region to use, e.g. eu-west-1
2+
export AWS_DEFAULT_REGION=$AWS_REGION
3+
export AWS_ACCESS_KEY_ID= ... # Your AWS Access Key ID
4+
export AWS_SECRET_ACCESS_KEY=... # Your AWS Secret Access Key

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
ecs/
3+
cdk.out/

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @coderbyheart @pudkrong
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test and Release
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
main:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: "20.x"
21+
cache: "npm"
22+
23+
- name: Install dependencies
24+
run: npm ci --no-audit
25+
26+
- name: Compile TypeScript
27+
run: npx tsc
28+
29+
- name: Check source code with eslint
30+
run: npx eslint ./
31+
32+
- name: Check if source code is properly formatted
33+
run: npx prettier -c ./
34+
35+
- name: Semantic release
36+
continue-on-error: true
37+
run: npx semantic-release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Sync repository info from package.json
2+
3+
env:
4+
GITHUB_TOKEN: ${{ secrets.UPDATE_REPO_INFO_PAT }}
5+
6+
on:
7+
push:
8+
branches:
9+
- saga
10+
paths:
11+
- "package.json"
12+
- ".github/workflows/update-repo-info.yaml"
13+
workflow_dispatch:
14+
15+
jobs:
16+
update_repo_info:
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Sync repository description
23+
run:
24+
gh repo edit --description "`cat package.json | jq -r '.description'`"
25+
26+
- name: Sync repository topics
27+
run:
28+
cat package.json | jq '.keywords[]' | xargs -I'{}' gh repo edit
29+
--add-topic {}
30+
31+
- name: Sync homepage
32+
run: gh repo edit --homepage "`cat package.json | jq -r '.homepage'`"

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file should only cover artifacts caused by the source code in this
2+
# repository, not those caused by the personal choice of editor and/or
3+
# environment of a developer.
4+
# See adr/002-clean-gitignore.md
5+
node_modules/
6+
npm-debug.log
7+
cdk.out/
8+
.envrc
9+
cdk.context.json

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx commitlint --edit $1

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npx lint-staged
2+
npx tsc

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
package-lock.json

CODE_OF_CONDUCT.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Code of conduct
2+
3+
## Our pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
[[email protected]](mailto:[email protected]?subject=hello.nrfcloud.com+Code+of+Conduct).
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement guidelines
70+
71+
Community leaders will follow these community impact guidelines in determining
72+
the consequences for any action they deem in violation of this Code of conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
94+
95+
### 3. Temporary ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of conduct is adapted from the
118+
[Contributor Covenant](https://www.contributor-covenant.org), version 2.0,
119+
available at
120+
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
<https://www.contributor-covenant.org/faq>. Translations are available at
127+
<https://www.contributor-covenant.org/translations>.

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Contributing to the project
2+
3+
This guide is intended for providing information on contributing to the
4+
hello.nrfcloud.com codebase. As a first step, see
5+
[Code of Conduct](./CODE_OF_CONDUCT.md).
6+
7+
## Finding open issues
8+
9+
First, have a look at the issues for this project and look for issues that are
10+
labeled with `good first issue` or `help wanted`. These issues are good starting
11+
points for contributing to the project. Some of them require in-depth knowledge
12+
about the technology in use.

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Nordic Semiconductor ASA | nordicsemi.no
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Amazon Location Service Map resources
2+
3+
[![GitHub Actions](https://github.com/hello-nrfcloud/aws-map/workflows/Test%20and%20Release/badge.svg)](https://github.com/hello-nrfcloud/aws-map/actions/workflows/test-and-release.yaml)
4+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
5+
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
6+
[![@commitlint/config-conventional](https://img.shields.io/badge/%40commitlint-config--conventional-brightgreen)](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
7+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier/)
8+
[![ESLint: TypeScript](https://img.shields.io/badge/ESLint-TypeScript-blue.svg)](https://github.com/typescript-eslint/typescript-eslint)
9+
10+
Contains the resources to serve maps to public web applications using
11+
[Amazon Location Service Maps](https://docs.aws.amazon.com/location/latest/developerguide/map-concepts.html)
12+
developed using [AWS CDK](https://aws.amazon.com/cdk) in
13+
[TypeScript](https://www.typescriptlang.org/).
14+
15+
## Installation in your AWS account
16+
17+
### Setup
18+
19+
Provide your AWS credentials, for example using the `.envrc` (see
20+
[the example](.envrc.example)).
21+
22+
### Install the dependencies
23+
24+
```bash
25+
npm ci
26+
```
27+
28+
### Deploy
29+
30+
```bash
31+
# Configure the stack name
32+
# export MAP_STACK_NAME=...
33+
npx cdk bootstrap # if this is the first time you use CDK in this account
34+
npx cdk deploy --all
35+
```
36+
37+
## Using with a map
38+
39+
Store the `mapName` output in the parameter registry.
40+
41+
Store the `mapRegion` output in the parameter registry.
42+
43+
Display the API key using
44+
45+
```bash
46+
aws location describe-key --key-name apiKey | jq '.Key'
47+
```
48+
49+
Store the API key in the parameter registry as `mapApiKey`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ADR 001: Use saga as the name for the main branch
2+
3+
Historically, Git and other software use terms such as `master/slave`,
4+
`whitelist/blacklist`, which are based on racial concepts. Their continued use
5+
maintains the racial stereotypes they depict. Better alternatives in meaning and
6+
technical correctness exist, like `leader/follower`, `blocklist/allowlist`.
7+
8+
In the Nordic mythology, a `saga` is a long, continuous recollection of stories
9+
about the history of humans, legends, and Gods. The term `saga` reflects very
10+
well what happens in a Git repository. Changes happen in branches (some teams
11+
tie them to _User Stories_, which are sometimes directly or loosely coupled to
12+
the main branch). Once the changes are finalized, they get added to the main
13+
branch, or get appended in the case of a rebase. The mental model of a big book
14+
of stories fits this process very well.
15+
16+
Therefore, the main branch in this project is named `saga`. `master` must not be
17+
used.

adr/002-clean-gitignore.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ADR 002: Clean `.gitignore` file
2+
3+
A `.gitignore` file in a project must only cover the artifacts caused by the
4+
contained source code and not those caused by the personal choice of editor or
5+
the environment of a developer.
6+
7+
This is explained in detail
8+
[here](https://github.com/coderbyheart/first-principles/issues/30).

adr/003-use-of-typescript.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ADR 003: use of TypeScript
2+
3+
This project is developed using [TypeScript](https://www.typescriptlang.org/) (a
4+
typed superset of JavaScript).
5+
6+
JavaScript is the most popular language according to the
7+
[2019 Stack Overflow survey](https://insights.stackoverflow.com/survey/2019#technology)
8+
and it is therefore likely that many developers using the project will be
9+
familiar with the language concepts and how to use and run it.
10+
11+
Virtually all cloud providers provide their SDKs in JavaScript or TypeScript
12+
which this project can integrate natively.

adr/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Architecture decision records
2+
3+
This folder contains the architecture decision records (ADRs) for this project.
4+
5+
To know more about ADRs, see
6+
[Documenting architecture decisions](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions)
7+
and the video on
8+
[Communicating and documenting architectural decisions](https://www.youtube.com/watch?v=rwfXkSjFhzc).

cdk.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"app": "npx tsx --no-warnings cdk/map.ts"
3+
}

0 commit comments

Comments
 (0)