-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from knovator/setup
Project & API Setup
- Loading branch information
Showing
49 changed files
with
5,473 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"], | ||
"rules": { | ||
"subject-case": [ | ||
2, | ||
"always", | ||
["sentence-case", "start-case", "pascal-case", "upper-case", "lower-case"] | ||
], | ||
"type-enum": [ | ||
2, | ||
"always", | ||
[ | ||
"build", | ||
"chore", | ||
"ci", | ||
"docs", | ||
"feat", | ||
"fix", | ||
"perf", | ||
"refactor", | ||
"revert", | ||
"style", | ||
"test", | ||
"sample" | ||
] | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
|
||
# OSX | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'airbnb-typescript', | ||
'plugin:import/typescript', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'plugin:prettier/recommended', | ||
'plugin:promise/recommended', | ||
], | ||
ignorePatterns: ['.eslintrc.js', '*.json', 'jest.config.js'], | ||
plugins: ['import', 'promise', '@typescript-eslint', 'prettier'], | ||
parser: '@typescript-eslint/parser', | ||
settings: { | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts', '.tsx'], | ||
}, | ||
}, | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
'@typescript-eslint/space-before-blocks': 'off', | ||
'@typescript-eslint/lines-between-class-members': 'off', | ||
'react/jsx-wrap-multilines': 'off', | ||
'react/jsx-filename-extension': 'off', | ||
'multiline-comment-style': ['error', 'starred-block'], | ||
'promise/catch-or-return': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-unused-expressions': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'react/jsx-closing-bracket-location': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': ['off'], | ||
'mocha/no-mocha-arrows': 'off', | ||
'@typescript-eslint/default-param-last': 'off', | ||
'no-return-await': 'off', | ||
'no-await-in-loop': 'off', | ||
'no-continue': 'off', | ||
'no-console': 'warn', | ||
'no-prototype-builtins': 'off', | ||
'import/no-cycle': 'off', | ||
'class-methods-use-this': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/no-explicit-any': 1, | ||
'no-restricted-syntax': 'off', | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'no-underscore-dangle': 'off', | ||
'import/prefer-default-export': 'off', | ||
// A temporary hack related to IDE not resolving correct package.json | ||
'import/no-extraneous-dependencies': 'off', | ||
'react/jsx-one-expression-per-line': 'off', | ||
'react/jsx-no-bind': 'off', | ||
'lines-between-class-members': 'off', | ||
'max-classes-per-file': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'max-len': ['warn', { code: 140 }], | ||
'@typescript-eslint/return-await': 'off', | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
patterns: ['@impler/shared/*', '@impler/dal/*', '!import2/good'], | ||
}, | ||
], | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['if', 'for'] }, | ||
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] }, | ||
{ blankLine: 'always', prev: '*', next: 'return' }, | ||
], | ||
'id-length': ['error', { min: 2, exceptions: ['i', 'e', 'a', 'b', '_', 't'], properties: 'never' }], | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
|
||
{ selector: 'enumMember', format: ['UPPER_CASE'] }, | ||
{ selector: 'enum', format: ['PascalCase'], suffix: ['Enum'] }, | ||
{ selector: 'class', format: ['PascalCase'] }, | ||
{ selector: 'variableLike', format: ['camelCase', 'UPPER_CASE', 'PascalCase'], leadingUnderscore: 'allow' }, | ||
{ | ||
selector: 'interface', | ||
format: ['PascalCase'], | ||
prefix: ['I'], | ||
}, | ||
{ | ||
selector: ['function'], | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allow', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
dist | ||
build | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
pnpm lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
auto-install-peers=true | ||
strict-peer-dependencies=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package.json is formatted by package managers, so we ignore it here | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"printWidth": 120, | ||
"trailingComma": "es5", | ||
"singleQuote": true, | ||
"semi": true, | ||
"tabWidth": 2, | ||
"quoteProps": "as-needed", | ||
"jsxSingleQuote": false, | ||
"arrowParens": "always", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"npm.packageManager": "pnpm", | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"editor.formatOnSave": true, | ||
"eslint.format.enable": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true | ||
}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# impler.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
extends: ['../../.eslintrc.js'], | ||
ignorePatterns: '*.spec.ts', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"assets": [ | ||
{ | ||
"include": ".env", | ||
"outDir": "dist/src" | ||
}, | ||
{ | ||
"include": ".env.development", | ||
"outDir": "dist/src" | ||
}, | ||
{ | ||
"include": ".env.test", | ||
"outDir": "dist/src" | ||
}, | ||
{ | ||
"include": ".env.production", | ||
"outDir": "dist/src" | ||
}, | ||
{ | ||
"include": "app/content-templates/usecases/compile-template/templates/basic.handlebars", | ||
"outDir": "dist/src" | ||
} | ||
], | ||
"plugins": [ | ||
{ | ||
"name": "@nestjs/swagger", | ||
"options": { | ||
"classValidatorShim": true, | ||
"introspectComments": true | ||
} | ||
} | ||
], | ||
"webpack": true | ||
}, | ||
"projects": { | ||
"dal": { | ||
"type": "library", | ||
"root": "../../../libs/dal", | ||
"entryFile": "index", | ||
"sourceRoot": "../../../libs/dal/src", | ||
"compilerOptions": { | ||
"tsConfigPath": "../../../libs/dal/tsconfig.build.json" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"watch": ["src", "../core/dist"], | ||
"ext": "ts", | ||
"delay": 2, | ||
"ignoreRoot": [".git"], | ||
"ignore": ["src/**/*.spec.ts"], | ||
"exec": "ts-node -r tsconfig-paths/register src/main.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "@impler/api", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "knovator", | ||
"license": "MIT", | ||
"private": false, | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "nest build", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"start": "pnpm start:dev", | ||
"start:dev": "cross-env TZ=UTC nest start --watch", | ||
"start:test": "cross-env NODE_ENV=test PORT=1336 TZ=UTC nest start --watch", | ||
"start:debug": "TZ=UTC nodemon --config nodemon-debug.json", | ||
"start:prod": "TZ=UTC node dist/main.js", | ||
"lint": "eslint src", | ||
"lint:fix": "pnpm lint -- --fix" | ||
}, | ||
"dependencies": { | ||
"@impler/dal": "workspace:^1.0.0", | ||
"@nestjs/common": "^9.1.2", | ||
"@nestjs/core": "^9.1.2", | ||
"@nestjs/platform-express": "^9.1.2", | ||
"@nestjs/swagger": "^6.1.2", | ||
"body-parser": "^1.20.0", | ||
"class-transformer": "^0.5.1", | ||
"class-validator": "^0.13.2", | ||
"compression": "^1.7.4", | ||
"dotenv": "^16.0.2", | ||
"rimraf": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/express": "^4.17.14", | ||
"@types/node": "^18.7.18", | ||
"nodemon": "^2.0.20", | ||
"ts-loader": "^9.4.1", | ||
"ts-node": "^10.9.1", | ||
"tsconfig-paths": "^4.1.0", | ||
"typescript": "^4.8.3" | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx}": [ | ||
"eslint --fix" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
NODE_ENV=local | ||
PORT=3000 | ||
API_ROOT_URL=http://localhost:3000 | ||
FRONT_BASE_URL=http://localhost:4200 | ||
|
||
MONGO_URL=mongodb://localhost:27017/impler-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
NODE_ENV=local | ||
PORT=3000 | ||
API_ROOT_URL=http://localhost:3000 | ||
FRONT_BASE_URL=http://localhost:4200 | ||
|
||
MONGO_URL=mongodb://localhost:27017/impler-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
NODE_ENV=local | ||
PORT=3000 | ||
API_ROOT_URL=http://localhost:3000 | ||
FRONT_BASE_URL=http://localhost:4200 | ||
|
||
MONGO_URL=mongodb://localhost:27017/impler-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DynamicModule, Module } from '@nestjs/common'; | ||
import { Type } from '@nestjs/common/interfaces/type.interface'; | ||
import { ForwardReference } from '@nestjs/common/interfaces/modules/forward-reference.interface'; | ||
import { SharedModule } from './app/shared/shared.module'; | ||
import { ProjectModule } from './app/project/project.module'; | ||
|
||
const modules: Array<Type | DynamicModule | Promise<DynamicModule> | ForwardReference> = [ProjectModule, SharedModule]; | ||
|
||
const providers = []; | ||
|
||
@Module({ | ||
imports: modules, | ||
controllers: [], | ||
providers, | ||
}) | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class ProjectResponseDto { | ||
@ApiProperty() | ||
name: string; | ||
@ApiProperty() | ||
code: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { ApiOperation, ApiTags } from '@nestjs/swagger'; | ||
import { ProjectResponseDto } from './dtos/projects-response.dto'; | ||
import { GetProjects } from './usecases/get-projects/get-projects.usecase'; | ||
|
||
@Controller('/project') | ||
@ApiTags('Project') | ||
export class ProjectController { | ||
constructor(private getProjectsUsecase: GetProjects) {} | ||
|
||
@Get('') | ||
@ApiOperation({ | ||
summary: 'Get projects', | ||
}) | ||
getProjects(): Promise<ProjectResponseDto[]> { | ||
return this.getProjectsUsecase.execute(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { USE_CASES } from './usecases'; | ||
import { ProjectController } from './project.controller'; | ||
import { SharedModule } from '../shared/shared.module'; | ||
|
||
@Module({ | ||
imports: [SharedModule], | ||
providers: [...USE_CASES], | ||
controllers: [ProjectController], | ||
}) | ||
export class ProjectModule {} |
Oops, something went wrong.