Skip to content

Commit 2ad8505

Browse files
authored
Format project structure (#75)
* update project structure * fix jest environment * fix type declarations * update eslint * 2.4.0 * update github actions * update publish action * update type declarations * fix lint warnings * update readme
1 parent de62765 commit 2ad8505

File tree

104 files changed

+4834
-4010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+4834
-4010
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/npm-publish-next.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v1
12+
- uses: actions/setup-node@v2
1313
with:
14-
node-version: 16
14+
node-version: 20
1515
registry-url: https://registry.npmjs.org/
1616
- run: npm ci
1717
- run: npm run build
1818
- run: npm unpublish @themost/express@next
19-
- run: npm publish ./modules/@themost/express/ --access=public --tag next
19+
- run: npm publish . --access=public --tag next
2020
env:
2121
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/npmpublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ jobs:
2727
registry-url: https://registry.npmjs.org/
2828
- run: npm ci
2929
- run: npm run build
30-
- run: npm publish ./modules/@themost/express/ --access=public
30+
- run: npm publish . --access=public
3131
env:
3232
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.npmignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# IDE
2+
.idea
3+
.vscode
4+
.theia
5+
.DS_Store
6+
7+
# dev
8+
node_modules
9+
10+
# test
11+
spec
12+
coverage
13+
jest.config.js
14+
jest.setup.js
15+
16+
# eslint
17+
.eslintignore
18+
.eslintrc
19+
eslint.config.mjs
20+
21+
# build
22+
rollup.config.js
23+
babel.config.js
24+
jsconfig.json
25+
26+
# gitpod
27+
.gitpod.yml
28+
.gitpod.dockerfile
29+
.devcontainer
30+
31+
# github
32+
.github
33+
34+
typescript
35+
tsconfig.json
36+
37+
38+

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
![GitHub last commit](https://img.shields.io/github/last-commit/themost-framework/express)
77
![GitHub Release Date](https://img.shields.io/github/release-date/themost-framework/express)
88
[![npm](https://img.shields.io/npm/dw/@themost/data)](https://www.npmjs.com/package/@themost%2Fexpress)
9-
![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@themost/express)
109

1110
## @themost/express
12-
MOST Data ORM Extension for ExpressJS
11+
@themost-framework middleware for express.js
1312

1413
### Installation
1514

eslint.config.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import globals from 'globals';
3+
import babelParser from '@babel/eslint-parser';
4+
import path from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
import js from '@eslint/js';
7+
import { FlatCompat } from '@eslint/eslintrc';
8+
import jest from 'eslint-plugin-jest';
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all
16+
});
17+
18+
export default defineConfig([globalIgnores(['**/*.d.ts', 'dist']), {
19+
extends: compat.extends('eslint:recommended'),
20+
languageOptions: {
21+
globals: {
22+
...globals.browser,
23+
...globals.node,
24+
...globals.jquery,
25+
...jest.environments.globals.globals
26+
},
27+
parser: babelParser,
28+
},
29+
30+
rules: {
31+
'no-console': 'off',
32+
'no-invalid-this': 'warn',
33+
'no-undef': 'error',
34+
'no-unused-vars': 'warn',
35+
'no-var': ['error'],
36+
quotes: ['error', 'single'],
37+
strict: [2, 'never'],
38+
},
39+
}]);

jest.config.js

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

jest.setup.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const {TraceUtils} = require('@themost/common');
2+
const {JsonLogger} = require('@themost/json-logger');
3+
// noinspection JSCheckFunctionSignatures
4+
TraceUtils.useLogger(new JsonLogger());
5+
jest.setTimeout(15000);

jsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"experimentalDecorators": true,
5+
"paths": {
6+
"@themost/express": [
7+
"src"
8+
]
9+
}
10+
}
11+
}

modules/@themost/express/.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)