feat: initial commit

This commit is contained in:
Joao P Dubas 2023-09-14 00:40:54 +00:00
commit 895305f1a3
19 changed files with 22389 additions and 0 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
.git
.github
.yarn
node_modules

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Swap the comments on the following lines if you don't wish to use zero-installs
# Documentation here: https://yarnpkg.com/features/zero-installs
# !.yarn/cache
# .pnp.*

15512
.pnp.cjs generated Executable file

File diff suppressed because one or more lines are too long

2047
.pnp.loader.mjs generated Normal file

File diff suppressed because it is too large Load Diff

2
.tool-versions Normal file
View File

@ -0,0 +1,2 @@
nodejs 20.6.0
yarn 1.22.19

874
.yarn/releases/yarn-3.6.3.cjs vendored Executable file

File diff suppressed because one or more lines are too long

1
.yarnrc.yml Normal file
View File

@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-3.6.3.cjs

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM node:20.6.0-slim
WORKDIR /opt/app
RUN apt-get update \
&& apt-get -y install make \
&& yarn set version 3.6.3
COPY ./Makefile ./
COPY ./package.json ./
COPY ./yarn.lock ./
RUN make install
COPY . .
ENTRYPOINT ["sleep"]
CMD ["infinity"]

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
.DEFAULT_GOAL := help
.PHONY: asdf_install
asdf_install:
@asdf_install
.PHONY: yarn_setup
yarn_setup:
@yarn set version 3.6.3
@yarn init -2
@yarn add typescript jest @types/jest ts-node ts-jest
.PHONY: typescript_init
typescript_init:
@yarn run tsc --init
@yarn run ts-jest config:init
.PHONY: setup
setup: asdf_install yarn_setup typescript_init ## initial setup to start the project
.PHONY: install
install: ## install project dependencies
@yarn install
.PHONY: test
test: ## execute tests
@yarn run jest
.PHONY: help
help: ## show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

3
README.md Normal file
View File

@ -0,0 +1,3 @@
[![Build Status](https://drone.dubas.dev/api/badges/joao.dubas/clean-architecture/status.svg?ref=refs/heads/main)](https://drone.dubas.dev/joao.dubas/clean-architecture)
# clean-architecture

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
---
services:
app:
image: 'joaodubas/clean-architecture:${CLEAN_ARCH_TAG:-dev}'
build: .
hostname: local
entrypoint: sleep
command: infinity

5
jest.config.js Normal file
View File

@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};

11
package.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "clean-architecture",
"packageManager": "yarn@3.6.3",
"dependencies": {
"@types/jest": "^29.5.4",
"jest": "^29.6.4",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
}
}

6
src/Circle.ts Normal file
View File

@ -0,0 +1,6 @@
export default class Circle {
constructor (readonly radius: number) {}
getArea(): number {
return 2 * Math.PI * this.radius;
}
}

6
test/Circle.test.ts Normal file
View File

@ -0,0 +1,6 @@
import Circle from "../src/Circle"
test("should calculate the area of circle", function () {
const circle = new Circle(2);
expect(circle.getArea()).toBe(12.566370614359172);
});

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs", /* Specify what module code is generated. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"strict": true, /* Enable all strict type-checking options. */
"esModuleInterop": true
},
"include": ["src", "test"]
}

3825
yarn.lock Normal file

File diff suppressed because it is too large Load Diff