Skip to content

Commit 33232a1

Browse files
authored
Initial commit
1 parent c3a4133 commit 33232a1

18 files changed

+8575
-2
lines changed

.dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
node_modules
3+
coverage
4+
template
5+
templates
6+
.vscode
7+
README.md

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
end_of_line = lf
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.env.template

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# Fastify
4+
PORT=3100
5+
HOST='0.0.0.0'

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,5 @@ dist
128128
.yarn/build-state.yml
129129
.yarn/install-state.gz
130130
.pnp.*
131+
132+
build

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
@frmscoe:registry=https://npm.pkg.github.com
3+
//npm.pkg.github.com/:_authToken=${GH_TOKEN}

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Ignore artifacts:
3+
build
4+
coverage
5+
src/models

.prettierrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 140,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"trailingComma": "all",
9+
"bracketSpacing": true,
10+
"arrowParens": "always"
11+
}

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# admin-service
2-
admin-service
1+
<!-- SPDX-License-Identifier: Apache-2.0 -->

eslint.config.mjs

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
import stylistic from '@stylistic/eslint-plugin';
3+
import tsEslint from '@typescript-eslint/eslint-plugin';
4+
import tsParser from '@typescript-eslint/parser';
5+
import eslintStandard from 'eslint-config-love';
6+
import eslintPluginEslintComments from 'eslint-plugin-eslint-comments';
7+
8+
export default [
9+
{
10+
files: ['**/*.ts'],
11+
plugins: {
12+
...eslintStandard.plugins,
13+
['eslint-comments']: eslintPluginEslintComments,
14+
['@typescript-eslint']: tsEslint,
15+
['@stylistic']: stylistic,
16+
},
17+
languageOptions: {
18+
...eslintStandard.languageOptions,
19+
parser: tsParser,
20+
ecmaVersion: 2022,
21+
sourceType: 'module',
22+
parserOptions: {
23+
project: ['./tsconfig.json'],
24+
},
25+
},
26+
rules: {
27+
...eslintStandard.rules,
28+
...eslintPluginEslintComments.configs.recommended.rules,
29+
'eslint-comments/require-description': ['warn', { 'ignore': [] }],
30+
'eslint-comments/disable-enable-pair': 'warn',
31+
'no-console': 'warn',
32+
'@typescript-eslint/restrict-template-expressions': 'error',
33+
'@typescript-eslint/no-non-null-assertion': 'off',
34+
'@typescript-eslint/strict-boolean-expressions': 'off',
35+
'@typescript-eslint/no-explicit-any': 'error',
36+
'@typescript-eslint/no-floating-promises': 'off',
37+
'@typescript-eslint/no-var-requires': 'off',
38+
'@typescript-eslint/no-use-before-define': 'off',
39+
'@typescript-eslint/prefer-optional-chain': 'off',
40+
'@stylistic/indent': ['error', 2],
41+
'@stylistic/semi': ['warn', 'always'],
42+
'@stylistic/quotes': ['error', 'single'],
43+
'@stylistic/quote-props': ['warn', 'as-needed'],
44+
'@stylistic/arrow-parens': ["warn", "always"],
45+
},
46+
ignores: [
47+
'**/coverage/**',
48+
'**/build/**',
49+
'**/node_modules/**',
50+
'**/__tests__/**',
51+
'**/jest.config.ts',
52+
'**/cluster-setup.ts',
53+
],
54+
}
55+
];

jest.config.ts

+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
/*
3+
* For a detailed explanation regarding each configuration property and type check, visit:
4+
* https://jestjs.io/docs/en/configuration.html
5+
*/
6+
7+
import type { Config } from '@jest/types';
8+
9+
// Sync object
10+
const config: Config.InitialOptions = {
11+
// All imported modules in your tests should be mocked automatically
12+
// automock: false,
13+
14+
// Stop running tests after `n` failures
15+
bail: 1,
16+
17+
// The directory where Jest should store its cached dependency information
18+
// cacheDirectory: "/private/var/folders/fv/vk9htm4s40xd4pb2lm_3tbym0000gn/T/jest_dx",
19+
20+
// Automatically clear mock calls and instances between every test
21+
clearMocks: true,
22+
23+
// Indicates whether the coverage information should be collected while executing the test
24+
collectCoverage: true,
25+
26+
// An array of glob patterns indicating a set of files for which coverage information should be collected
27+
// collectCoverageFrom: ['src/app.controller.ts'],
28+
collectCoverageFrom: ['src/logic.service.ts'],
29+
30+
// The directory where Jest should output its coverage files
31+
coverageDirectory: '<rootDir>/coverage/',
32+
33+
// An array of regexp pattern strings used to skip coverage collection
34+
coveragePathIgnorePatterns: [
35+
'/node_modules/',
36+
'./src/interfaces',
37+
'./src/models',
38+
'./__tests__',
39+
'interfaces',
40+
'.module.ts',
41+
'.mock.ts',
42+
'./src/index.ts',
43+
'./src/clients/arangodb.ts',
44+
'./src/clients/index.ts',
45+
'./src/clients/redis.ts',
46+
'./router.ts',
47+
'./jest.config.ts',
48+
],
49+
50+
// Indicates which provider should be used to instrument code for coverage
51+
coverageProvider: 'v8',
52+
53+
// A list of reporter names that Jest uses when writing coverage reports
54+
// coverageReporters: [
55+
// "json",
56+
// "text",
57+
// "lcov",
58+
// "clover"
59+
// ],
60+
61+
// An object that configures minimum threshold enforcement for coverage results
62+
coverageThreshold: {
63+
global: {
64+
branches: 95, //until elastic apm can be properly mocked
65+
functions: 95,
66+
lines: 95,
67+
statements: 95,
68+
},
69+
},
70+
71+
// A path to a custom dependency extractor
72+
// dependencyExtractor: undefined,
73+
74+
// Make calling deprecated APIs throw helpful error messages
75+
errorOnDeprecated: false,
76+
77+
// Force coverage collection from ignored files using an array of glob patterns
78+
// forceCoverageMatch: [],
79+
80+
// A path to a module which exports an async function that is triggered once before all test suites
81+
// globalSetup: undefined,
82+
83+
// A path to a module which exports an async function that is triggered once after all test suites
84+
// globalTeardown: undefined,
85+
86+
// A set of global variables that need to be available in all test environments
87+
// globals: {},
88+
89+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
90+
// maxWorkers: "50%",
91+
92+
// An array of directory names to be searched recursively up from the requiring module's location
93+
// moduleDirectories: [
94+
// "node_modles"
95+
// ],
96+
97+
// An array of file extensions your modules use
98+
// moduleFileExtensions: [
99+
// "js",
100+
// "json",
101+
// "jsx",
102+
// "ts",
103+
// "tsx",
104+
// "node"
105+
// ],
106+
107+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
108+
moduleNameMapper: {
109+
'^ioredis$': '<rootDir>/__tests__/__mocks__/ioredis.js',
110+
'^arangojs$': '<rootDir>/__tests__/__mocks__/arango.js',
111+
},
112+
113+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
114+
// modulePathIgnorePatterns: [],
115+
116+
// Activates notifications for test results
117+
notify: false,
118+
119+
// An enum that specifies notification mode. Requires { notify: true }
120+
// notifyMode: "failure-change",
121+
122+
// A preset that is used as a base for Jest's configuration
123+
preset: 'ts-jest',
124+
125+
// Run tests from one or more projects
126+
// projects: undefined,
127+
128+
// Use this configuration option to add custom reporters to Jest
129+
// reporters: undefined,
130+
131+
// Automatically reset mock state between every test
132+
resetMocks: true,
133+
134+
// Reset the module registry before running each individual test
135+
// resetModules: false,
136+
137+
// A path to a custom resolver
138+
// resolver: undefined,
139+
140+
// Automatically restore mock state between every test
141+
// restoreMocks: false,
142+
143+
// The root directory that Jest should scan for tests and modules within
144+
// rootDir: ".",
145+
146+
// A list of paths to directories that Jest should use to search for files in
147+
roots: ['<rootDir>/__tests__/'],
148+
149+
// Allows you to use a custom runner instead of Jest's default test runner
150+
// runner: "jest-runner",
151+
152+
// The paths to modules that run some code to configure or set up the testing environment before each test
153+
setupFiles: ['dotenv/config', './cluster-setup.ts'],
154+
155+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
156+
// setupFilesAfterEnv: [],
157+
158+
// The number of seconds after which a test is considered as slow and reported as such in the results.
159+
// slowTestThreshold: 5,
160+
161+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
162+
// snapshotSerializers: [],
163+
164+
// The test environment that will be used for testing
165+
testEnvironment: 'node',
166+
167+
// Options that will be passed to the testEnvironment
168+
// testEnvironmentOptions: {},
169+
170+
// Adds a location field to test results
171+
// testLocationInResults: false,
172+
173+
// The glob patterns Jest uses to detect test files
174+
testMatch: ['**/*.test.ts'],
175+
176+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
177+
testPathIgnorePatterns: ['/node_modules/'],
178+
179+
// The regexp pattern or array of patterns that Jest uses to detect test files
180+
// testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(ts|js)$',
181+
182+
// This option allows the use of a custom results processor
183+
// testResultsProcessor: undefined,
184+
185+
// This option allows use of a custom test runner
186+
// testRunner: "jasmine2",
187+
188+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
189+
// testURL: "http://localhost",
190+
191+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
192+
// timers: "real",
193+
194+
// A map from regular expressions to paths to transformers
195+
transform: {
196+
'^.+\\.ts$': 'ts-jest',
197+
},
198+
199+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
200+
// transformIgnorePatterns: [
201+
// "/node_modules/",
202+
// "\\.pnp\\.[^\\/]+$"
203+
// ],
204+
205+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
206+
// unmockedModulePathPatterns: undefined,
207+
208+
// Indicates whether each individual test should be reported during the run
209+
verbose: true,
210+
211+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
212+
// watchPathIgnorePatterns: [],
213+
214+
// Whether to use watchman for file crawling
215+
// watchman: true,
216+
};
217+
218+
export default config;

0 commit comments

Comments
 (0)