Skip to content

Commit 6d7444e

Browse files
initial
1 parent 6959de1 commit 6d7444e

20 files changed

+4671
-88
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
echo ${GITHUB_TOKEN} | gh auth login --with-token
4+
export TARGET_BRANCH=$(gh api graphql -f repositoryOwner="${CF_REPO_OWNER}" -f repositoryName="${CF_REPO_NAME}" -f branchName="${CF_BRANCH}" -f query='
5+
query getTargetBranch($repositoryOwner: String!, $repositoryName: String!, $branchName: String!) {
6+
organization(login: $repositoryOwner) {
7+
repository(name: $repositoryName) {
8+
defaultBranchRef {
9+
name
10+
}
11+
pullRequests(first: 1, headRefName: $branchName) {
12+
edges {
13+
node {
14+
baseRefName
15+
}
16+
}
17+
}
18+
}
19+
}
20+
}
21+
' | jq -r '.data.organization.repository | .pullRequests.edges[0].node.baseRefName // .defaultBranchRef.name')
22+
echo "Target Branch: ${TARGET_BRANCH}"
23+
export TARGET_VERSION=$(git show origin/${TARGET_BRANCH}:service.yaml | yq -r ".version" -)
24+
echo "Target Version: ${TARGET_VERSION}"
25+
export PACKAGE_VERSION=$(if [ -f VERSION ]; then cat VERSION; else yq -r ".version" service.yaml; fi;)
26+
echo "Package Version: ${PACKAGE_VERSION}"
27+
semver-cli greater ${PACKAGE_VERSION} ${TARGET_VERSION}
28+

.deploy/registries.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
csdp-report-image:
2+
image:
3+
repository: quay.io/codefresh/csdp-report-image

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git
2+
**/dist
3+
**/node_modules
4+
**/example
5+
**/tests

.eslintrc.js

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
sourceType: 'module',
6+
},
7+
plugins: [
8+
'@typescript-eslint/eslint-plugin',
9+
'unicorn',
10+
'unused-imports',
11+
],
12+
extends: [
13+
'plugin:@typescript-eslint/recommended',
14+
'plugin:import/errors',
15+
'plugin:import/warnings',
16+
'plugin:import/typescript',
17+
],
18+
root: true,
19+
env: {
20+
node: true,
21+
jest: true,
22+
},
23+
ignorePatterns: ['.eslintrc.js', '*.d.ts'],
24+
rules: {
25+
'unicorn/better-regex': 'error',
26+
'unicorn/catch-error-name': 'error',
27+
'unicorn/consistent-function-scoping': 'error',
28+
'unicorn/custom-error-definition': 'off',
29+
'unicorn/empty-brace-spaces': 'error',
30+
'unicorn/error-message': 'error',
31+
'unicorn/escape-case': 'error',
32+
'unicorn/expiring-todo-comments': 'error',
33+
'unicorn/explicit-length-check': 'error',
34+
'unicorn/import-index': 'off',
35+
'unicorn/new-for-builtins': 'error',
36+
'unicorn/no-array-push-push': 'error',
37+
'unicorn/no-console-spaces': 'error',
38+
'unicorn/no-hex-escape': 'error',
39+
'unicorn/no-instanceof-array': 'error',
40+
'unicorn/no-keyword-prefix': 'off',
41+
'unicorn/no-lonely-if': 'error',
42+
'no-nested-ternary': 'off',
43+
'unicorn/no-nested-ternary': 'error',
44+
'unicorn/no-new-array': 'error',
45+
'unicorn/no-new-buffer': 'error',
46+
'unicorn/no-object-as-default-parameter': 'error',
47+
'unicorn/no-this-assignment': 'error',
48+
'unicorn/no-unreadable-array-destructuring': 'error',
49+
'unicorn/no-unsafe-regex': 'off',
50+
'unicorn/no-unused-properties': 'off',
51+
'unicorn/no-useless-undefined': 'error',
52+
'unicorn/no-zero-fractions': 'error',
53+
'unicorn/number-literal-case': 'error',
54+
'unicorn/numeric-separators-style': 'off',
55+
'unicorn/prefer-add-event-listener': 'error',
56+
'unicorn/prefer-array-find': 'error',
57+
'unicorn/prefer-array-flat-map': 'error',
58+
'unicorn/prefer-array-index-of': 'error',
59+
'unicorn/prefer-array-some': 'error',
60+
'unicorn/prefer-date-now': 'error',
61+
'unicorn/prefer-default-parameters': 'error',
62+
'unicorn/prefer-dom-node-append': 'error',
63+
'unicorn/prefer-dom-node-dataset': 'error',
64+
'unicorn/prefer-dom-node-remove': 'error',
65+
'unicorn/prefer-dom-node-text-content': 'error',
66+
'unicorn/prefer-includes': 'error',
67+
'unicorn/prefer-keyboard-event-key': 'error',
68+
'unicorn/prefer-math-trunc': 'error',
69+
'unicorn/prefer-modern-dom-apis': 'error',
70+
'unicorn/prefer-negative-index': 'error',
71+
'unicorn/prefer-number-properties': 'error',
72+
'unicorn/prefer-optional-catch-binding': 'error',
73+
'unicorn/prefer-query-selector': 'error',
74+
'unicorn/prefer-reflect-apply': 'error',
75+
'unicorn/prefer-regexp-test': 'error',
76+
'unicorn/prefer-set-has': 'error',
77+
'unicorn/prefer-spread': 'error',
78+
'unicorn/prefer-string-replace-all': 'off',
79+
'unicorn/prefer-string-slice': 'error',
80+
'unicorn/prefer-string-starts-ends-with': 'error',
81+
'unicorn/prefer-string-trim-start-end': 'error',
82+
'unicorn/prefer-ternary': 'off',
83+
'unicorn/prefer-type-error': 'error',
84+
'unicorn/string-content': 'off',
85+
'unicorn/throw-new-error': 'error',
86+
'@typescript-eslint/no-namespace': 'off',
87+
'unicorn/filename-case': [
88+
'error',
89+
{
90+
'case': 'kebabCase',
91+
},
92+
],
93+
'import/order': ['error', {
94+
'newlines-between': 'always',
95+
'groups': [
96+
'external',
97+
'internal',
98+
],
99+
}],
100+
'unused-imports/no-unused-imports': 'error',
101+
'@typescript-eslint/naming-convention': [
102+
'error',
103+
{
104+
'selector': 'default',
105+
'format': ['camelCase'],
106+
'leadingUnderscore': 'allow',
107+
},
108+
{
109+
'selector': 'variable',
110+
'format': ['camelCase', 'UPPER_CASE', 'PascalCase'],
111+
},
112+
{
113+
'selector': 'enumMember',
114+
'format': ['camelCase', 'UPPER_CASE'],
115+
},
116+
{
117+
'selector': 'objectLiteralProperty',
118+
'format': ['camelCase', 'UPPER_CASE'],
119+
'leadingUnderscore': 'allow',
120+
},
121+
{
122+
'selector': 'parameter',
123+
'format': ['camelCase'],
124+
'leadingUnderscore': 'allow',
125+
},
126+
{
127+
'selector': 'memberLike',
128+
'modifiers': ['private'],
129+
'format': ['camelCase'],
130+
'leadingUnderscore': 'allow',
131+
},
132+
{
133+
'selector': 'typeLike',
134+
'format': ['PascalCase'],
135+
},
136+
],
137+
'max-lines': ['error', 400],
138+
'@typescript-eslint/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
139+
'array-bracket-spacing': ['error', 'always'],
140+
'comma-spacing': ['error', { 'before': false, 'after': true }],
141+
'key-spacing': ['error', { 'afterColon': true }],
142+
'object-curly-spacing': ['error', 'always'],
143+
'@typescript-eslint/keyword-spacing': ['error'],
144+
'@typescript-eslint/interface-name-prefix': 'off',
145+
'@typescript-eslint/explicit-function-return-type': 'off',
146+
'@typescript-eslint/explicit-module-boundary-types': 'off',
147+
'@typescript-eslint/no-explicit-any': 'off',
148+
'@typescript-eslint/type-annotation-spacing': 'error',
149+
'@typescript-eslint/semi': ['error', 'never'],
150+
'@typescript-eslint/member-ordering': 'error',
151+
'@typescript-eslint/no-unnecessary-condition': ['error'],
152+
},
153+
overrides: [
154+
{
155+
files: ['*.decorator.ts'],
156+
rules: {
157+
'camelcase': 'off',
158+
'@typescript-eslint/naming-convention': [
159+
'error',
160+
{
161+
'selector': 'default',
162+
'format': ['camelCase'],
163+
},
164+
{
165+
'selector': 'variable',
166+
'format': ['PascalCase', 'camelCase', 'UPPER_CASE'],
167+
},
168+
{
169+
'selector': 'parameter',
170+
'format': ['camelCase'],
171+
'leadingUnderscore': 'allow',
172+
},
173+
{
174+
'selector': 'memberLike',
175+
'modifiers': ['private'],
176+
'format': ['camelCase'],
177+
'leadingUnderscore': 'allow',
178+
},
179+
{
180+
'selector': 'typeLike',
181+
'format': ['PascalCase'],
182+
},
183+
],
184+
},
185+
},
186+
{
187+
files: ['config.*', 'index.ts'],
188+
rules: {
189+
'no-process-env': 'off',
190+
},
191+
},
192+
],
193+
};

.gitignore

Lines changed: 27 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# compiled output
2+
dist
3+
node_modules
4+
15
# Logs
26
logs
37
*.log
@@ -6,99 +10,34 @@ yarn-debug.log*
610
yarn-error.log*
711
lerna-debug.log*
812

9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
22-
coverage
23-
*.lcov
24-
25-
# nyc test coverage
26-
.nyc_output
27-
28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
33-
34-
# node-waf configuration
35-
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
39-
40-
# Dependency directories
41-
node_modules/
42-
jspm_packages/
43-
44-
# TypeScript v1 declaration files
45-
typings/
13+
# OS
14+
.DS_Store
4615

47-
# TypeScript cache
48-
*.tsbuildinfo
16+
# Tests
17+
/coverage
18+
/.nyc_output
4919

50-
# Optional npm cache directory
51-
.npm
20+
# IDEs and editors
21+
.idea
22+
.project
23+
.classpath
24+
.c9/
25+
*.launch
26+
.settings/
27+
*.sublime-workspace
5228

53-
# Optional eslint cache
54-
.eslintcache
29+
# IDE - VSCode
30+
.vscode
5531

56-
# Microbundle cache
57-
.rpt2_cache/
58-
.rts2_cache_cjs/
59-
.rts2_cache_es/
60-
.rts2_cache_umd/
61-
62-
# Optional REPL history
63-
.node_repl_history
64-
65-
# Output of 'npm pack'
66-
*.tgz
67-
68-
# Yarn Integrity file
69-
.yarn-integrity
70-
71-
# dotenv environment variables file
32+
# environment variable file
7233
.env
73-
.env.test
74-
75-
# parcel-bundler cache (https://parceljs.org/)
76-
.cache
77-
78-
# Next.js build output
79-
.next
80-
81-
# Nuxt.js build / generate output
82-
.nuxt
83-
dist
84-
85-
# Gatsby files
86-
.cache/
87-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
92-
.vuepress/dist
93-
94-
# Serverless directories
95-
.serverless/
34+
*-sa.json
35+
service-account.json
9636

97-
# FuseBox cache
98-
.fusebox/
37+
.graphqlrc.yml
38+
.graphqlconfig
9939

100-
# DynamoDB Local files
101-
.dynamodb/
40+
events.csv
10241

103-
# TernJS port file
104-
.tern-port
42+
# turorepo
43+
*.turbo

CODEOWNERS

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

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM node:16.14.2-alpine as base
2+
WORKDIR /code
3+
COPY tsconfig.json .
4+
COPY tsconfig.build.json .
5+
COPY package.json .
6+
COPY yarn.lock .
7+
# Install dependencies
8+
RUN yarn --cwd /code install --frozen-lockfile
9+
10+
FROM base as build
11+
# add SRC
12+
COPY src /code/src
13+
RUN ls -ltr /code/src
14+
# Build typescript
15+
RUN yarn --cwd /code build
16+
17+
# Clean up dev dependencies
18+
RUN yarn install --production
19+
20+
FROM base
21+
COPY --from=build /code/node_modules /code/node_modules
22+
COPY --from=build /code/src /code/src
23+
WORKDIR /code
24+
CMD [ "yarn", "start" ]

0 commit comments

Comments
 (0)