Skip to content

Commit aa04bc4

Browse files
Create new project: test-343-34
1 parent d2d5900 commit aa04bc4

34 files changed

+10716
-0
lines changed

.depcheckrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignores: ["eslint", "@types/eslint", "@vitest/coverage-v8", "ts-node"]
2+
skip-missing: true

.env.dist

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#LOCAL DEV
2+
#If you want to start this api locally create a .env from this
3+
4+
NEW_RELIC_APP_NAME=local
5+
NEW_RELIC_NO_CONFIG_FILE=true
6+
NEW_RELIC_ENABLED=false
7+
LOG_LEVEL=info
8+
FINGERS_CROSSED_LOG_LEVEL=info
9+
APP_ENV=dev
10+
APP_NAME=test-343-34
11+
APP_TEAM=platform
12+
GITHUB_REF=refs/heads/master
13+
GITHUB_SHA=cb1a4f5afbd920acb80e3774437990f63ec25856

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Flaconi/platform @Flaconi/ci

.github/dependabot.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: 2
2+
registries:
3+
npm-npmjs:
4+
type: npm-registry
5+
url: https://registry.npmjs.org
6+
replaces-base: true
7+
token:
8+
github-flaconi-ci:
9+
type: git
10+
url: https://github.com
11+
username: x-access-token
12+
password:
13+
updates:
14+
- package-ecosystem: npm
15+
directory: "/"
16+
schedule:
17+
interval: daily
18+
time: "08:00"
19+
timezone: Europe/Berlin
20+
open-pull-requests-limit: 10
21+
registries:
22+
- npm-npmjs
23+
ignore:
24+
- dependency-name: "node-fetch"
25+
versions: ["3.x"]
26+
groups:
27+
vi-test:
28+
patterns:
29+
- "@vitest*"
30+
- "vitest"
31+
aws-sdk:
32+
patterns:
33+
- "@aws-sdk*"
34+
- "aws-sdk*"
35+
types:
36+
patterns:
37+
- "@types*"
38+
- package-ecosystem: github-actions
39+
directory: "/"
40+
schedule:
41+
interval: weekly
42+
day: monday
43+
time: "08:00"
44+
timezone: Europe/Berlin
45+
registries:
46+
- github-flaconi-ci

.github/release-drafter.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter
2+
template: |
3+
## Changes
4+
5+
$CHANGES
6+
name-template: '$RESOLVED_VERSION 🌈'
7+
tag-template: '$RESOLVED_VERSION'
8+
categories:
9+
- title: '🚀 Features'
10+
labels:
11+
- feature
12+
- enhancement
13+
- title: '🐛 Bug Fixes'
14+
labels:
15+
- fix
16+
- bugfix
17+
- bug
18+
- title: '🧰 Maintenance'
19+
labels:
20+
- chore
21+
- dependencies
22+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
23+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
24+
version-resolver:
25+
major:
26+
labels:
27+
- 'major'
28+
minor:
29+
labels:
30+
- 'minor'
31+
patch:
32+
labels:
33+
- 'patch'
34+
default: patch

.github/workflows/auto-merge.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Dependabot auto-merge
3+
4+
on: pull_request
5+
6+
jobs:
7+
auto-merge:
8+
uses: Flaconi/github-actions/.github/workflows/auto-merge.yml@v1
9+
secrets: inherit

.github/workflows/backups.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Backup Repository
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
backup:
11+
uses: Flaconi/github-reusable-workflow/.github/workflows/backups.yml@v1
12+
with:
13+
enabled: True
14+
region: eu-central-1
15+
secrets:
16+
iam_role_arn:
17+
bucket_name:

.github/workflows/manual.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Manual deployment
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
env:
7+
description: "Environment to deploy"
8+
required: true
9+
default: "dev"
10+
type: choice
11+
options:
12+
- dev
13+
- stage
14+
- prod
15+
jobs:
16+
build:
17+
uses: Flaconi/github-actions/.github/workflows/build-node.yml@v1
18+
with:
19+
node_version: "22"
20+
secrets: inherit
21+
deploy:
22+
name: "Deploy: "
23+
needs: build
24+
uses: Flaconi/github-actions/.github/workflows/deploy-node.yml@v1
25+
secrets: inherit
26+
with:
27+
env:
28+
smoke: true
29+
node_version: "22"

.github/workflows/release-drafter.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Release Drafter
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
update_release_draft:
11+
uses: Flaconi/github-actions/.github/workflows/release-drafter.yml@v1
12+
secrets: inherit

.github/workflows/release.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Release deploy
3+
on:
4+
release:
5+
types: [published]
6+
jobs:
7+
build:
8+
uses: Flaconi/github-actions/.github/workflows/build-node.yml@v1
9+
with:
10+
node_version: "22"
11+
secrets: inherit
12+
prod:
13+
needs: build
14+
uses: Flaconi/github-actions/.github/workflows/deploy-node.yml@v1
15+
secrets: inherit
16+
with:
17+
env: prod
18+
node_version: "22"
19+
smoke: true

.github/workflows/test-and-deploy.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Test and Deploy
3+
on:
4+
push:
5+
branches: ["**"]
6+
tags-ignore: ["**"]
7+
jobs:
8+
build:
9+
uses: Flaconi/github-actions/.github/workflows/build-node.yml@v1
10+
with:
11+
node_version: "22"
12+
secrets: inherit
13+
dev:
14+
needs: build
15+
uses: Flaconi/github-actions/.github/workflows/deploy-node.yml@v1
16+
secrets: inherit
17+
with:
18+
env: dev
19+
node_version: "22"
20+
smoke: true
21+
stage:
22+
if: github.ref_name == 'master'
23+
needs: build
24+
uses: Flaconi/github-actions/.github/workflows/deploy-node.yml@v1
25+
secrets: inherit
26+
with:
27+
env: stage
28+
node_version: "22"
29+
smoke: true

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.idea/
2+
.build
3+
.eslintcache
4+
.serverless
5+
node_modules
6+
yarn-error.log
7+
coverage
8+
.env
9+
newrelic_agent.log
10+
.npmrc
11+
12+
.yarn/*
13+
!.yarn/cache
14+
!.yarn/patches
15+
!.yarn/plugins
16+
!.yarn/releases
17+
!.yarn/sdks
18+
!.yarn/versions
19+
.pnp*

.yarn/releases/yarn-4.6.0.cjs

+934
Large diffs are not rendered by default.

.yarnrc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.6.0.cjs

__mocks__/newrelic.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Event } from 'newrelic';
2+
3+
let events: Event[] = [];
4+
5+
const recordCustomEvent = (name: string, attributes: { [keys: string]: boolean | number | string }): void => {
6+
events.push({ name, attributes });
7+
};
8+
9+
const __getRecordedEvents = (): Event[] => {
10+
return events;
11+
};
12+
13+
const __reset = (): void => {
14+
events = [];
15+
};
16+
17+
export default { recordCustomEvent, __getRecordedEvents, __reset };

__tests__/smoke/api.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
interface EnvConfig {
2+
baseUrl: string;
3+
}
4+
5+
type ENVIRONMENT = 'dev' | 'stage' | 'prod';
6+
7+
export const config: { [env: string]: EnvConfig } = {
8+
dev: {
9+
baseUrl: 'https://api.dev.flaconi-platform.net/services/test-343-34/test',
10+
},
11+
stage: {
12+
baseUrl: 'https://api.stage.flaconi-platform.net/services/test-343-34/test',
13+
},
14+
prod: {
15+
baseUrl: 'https://api.flaconi-platform.net/services/test-343-34/test',
16+
},
17+
};
18+
19+
export const getHelloWorldResponse = (env: ENVIRONMENT): Promise<{ [key: string]: string }> => {
20+
const envConfig: EnvConfig = config[env];
21+
if (!envConfig) {
22+
throw new Error(`Unknown environment: ${env}`);
23+
}
24+
25+
return fetch(envConfig.baseUrl).then(async response => await response.json()) as Promise<{ [key: string]: string }>;
26+
};

__tests__/smoke/index.test.ts

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { describe, it, expect, vi } from 'vitest';
2+
3+
import { getHelloWorldResponse } from './api';
4+
5+
const env = process.env.ENV || 'dev';
6+
vi.setConfig({
7+
testTimeout: 10_000,
8+
});
9+
10+
function onlyOn(environment: string, fn: () => void) {
11+
if (environment === env) {
12+
return describe(environment, fn);
13+
} else {
14+
return describe.skip(environment, fn);
15+
}
16+
}
17+
18+
describe('Smoke tests', () => {
19+
onlyOn('dev', () => {
20+
it('should get a hello world response', async () => {
21+
const response = await getHelloWorldResponse('dev');
22+
expect(response).toMatchObject({
23+
boilerplate: 'test-343-34',
24+
});
25+
});
26+
});
27+
28+
onlyOn('stage', () => {
29+
it('should get a hello world response', async () => {
30+
const response = await getHelloWorldResponse('dev');
31+
expect(response).toMatchObject({
32+
boilerplate: 'test-343-34',
33+
});
34+
});
35+
});
36+
37+
onlyOn('prod', () => {
38+
it('should get a hello world response', async () => {
39+
const response = await getHelloWorldResponse('dev');
40+
expect(response).toMatchObject({
41+
boilerplate: 'test-343-34',
42+
});
43+
});
44+
});
45+
});

__tests__/unit/env.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
process.env = Object.assign(process.env, {
2+
LOG_LEVEL: process.env.LOG_LEVEL || 'info',
3+
FINGERS_CROSSED_LOG_LEVEL: 'warn',
4+
NEW_RELIC_EVENT_TYPE: 'testEvent',
5+
METRICS_TAG_ENVIRONMENT: 'test',
6+
GITHUB_REF: 'refs/tags/v1.0.0',
7+
GITHUB_SHA: '1111111',
8+
APP_ENV: 'test',
9+
APP_TEAM: 'platform',
10+
APP_NAME: 'test-343-34',
11+
});

0 commit comments

Comments
 (0)