This project is part of my personal portfolio, so, I'll be happy if you could provide me any feedback about the project, code, structure or anything that you can report that could make me a better developer!
Email-me: [email protected]
Connect with me at LinkedIn.
- Creating a standard development framework
- Creating separate files within existing code structures
- Automatically update
Download the library and configure it in the path/environment variables of your operating system
Linux:
mv ~/Downloads/cleanv /usr/local/cleanv/
nano ~/.bashrc
# paste the line below at the end of the file
PATH=$PATH:/usr/local/cleanv
# give general permissions on the folder
sudo chmod 777 /usr/local/cleanv
# reload bash info
source ~/.bashrc
# add autocomplete in bash
cleanv completion bash > /tmp/completion
source /tmp/completion
Windows:
-
https://github.com/booscaaa/cleanv/releases/latest/download/cleanv.exe
-
Put the executable in the C:/cleanv folder and set the path in the environment variables
The initial struct of vue app code like this:
This command will generate the complete structure for developing a new program on the web.
Positioned in the root of the project with vue.js run the command:
cleanv template -s payment001 -m payment -r findPayment
This command will generate the structure of a new api call within a ready-made structure. Importing and injecting dependencies if necessary.
Positioned in the root of the project with vue.js run the command:
cleanv repository -s payment001 -m payment -n findTickets
Caution!!! Using the -d flag will delete the corresponding files.
cleanv repository -s screen_name -m module_name -n findSomething1 -d
This command updates the sdk binary automatically;
cleanv update
cleanv template -s payment001 -m payment -r findPayment
- module
- payment
- payment001
- di
- di.js
- axios.js
- controller
- paymentController001.js
- data
- repository
- findPaymentRepository.js
- domain
- model
- payment001.js
- usecase
- findPaymentUseCase.js
- view
- payment001.vue
//Repository
const findPaymentRepository = (axios) => async () => {
try {
const response = await axios.get('/rest/TODO')
return response //TODO
} catch (error) {
throw error
}
}
export default findPaymentRepository
//Usecase
const findPaymentUseCase = (repository) => async () => {
try {
//TODO
return await repository()
} catch (error) {
throw error
}
}
export default findPaymentUseCase
//Model
class Payment001 {
constructor() {}
}
export default Payment001
//Dependencie Injection
import axiosInstance from './axios'
import findPaymentRepository from '../data/repository/findPaymentRepository'
import findPaymentUseCase from '../domain/usecase/findPaymentUseCase'
import Payment001Controller from '../controller/payment001Controller'
const instance = axiosInstance
const findPaymentRepositoryImpl = findPaymentRepository(instance)
const findPaymentUseCaseImpl = findPaymentUseCase(findPaymentRepositoryImpl)
const payment001Controller = (context) =>
new Payment001Controller(
context,
findPaymentUseCaseImpl,
)
export { payment001Controller }
//Axios instance for Dependencie Injection
import axios from 'axios'
const axiosInstace = axios.create({
baseURL: process.env.VUE_APP_API_BASE_URL,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Access: 'application/json',
},
})
export default axiosInstace
//Controller
class Payment001Controller {
constructor(
context,
findPaymentUseCase,
) {
this.context = context
this.findPaymentUseCase = findPaymentUseCase
}
async mounted() {
try {
//TODO
} catch (error) {
//HANDLER ERROR
}
}
}
export default Payment001Controller
//Vue Screen
<template>
<div>
<!-- your code here -->
</div>
</template>
<script>
import { payment001Controller } from "../di/di";
export default {
data: (context) => ({
controller: payment001Controller(context),
}),
mounted() {
this.controller.mounted();
},
};
</script>
cleanv repository -s payment001 -m payment -n findTickets
- module
- payment
- payment001
- di
- di.js
- axios.js
- controller
- paymentController001.js
- data
- repository
- findPaymentRepository.js
- findTicketsRepository.js
- domain
- model
- payment001.js
- usecase
- findPaymentUseCase.js
- findTicketsUseCase.js
- view
- payment001.vue
//Repository
const findTicketsRepository = (axios) => async () => {
try {
const response = await axios.get('/rest/TODO')
return response //TODO
} catch (error) {
throw error
}
}
export default findTicketsRepository
//Usecase
const findTicketsUseCase = (repository) => async () => {
try {
//TODO
return await repository()
} catch (error) {
throw error
}
}
export default findTicketsUseCase
//Dependencie Injection
import axiosInstance from './axios'
import findTicketsRepository from '../data/repository/findTicketsRepository'
import findTicketsUseCase from '../domain/usecase/findTicketsUseCase'
import findPaymentRepository from '../data/repository/findPaymentRepository'
import findPaymentUseCase from '../domain/usecase/findPaymentUseCase'
import Payment001Controller from '../controller/payment001Controller'
const instance = axiosInstance
const findTicketsRepositoryImpl = findTicketsRepository(instance)
const findTicketsUseCaseImpl = findTicketsUseCase(findTicketsRepositoryImpl)
const findPaymentRepositoryImpl = findPaymentRepository(instance)
const findPaymentUseCaseImpl = findPaymentUseCase(findPaymentRepositoryImpl)
const payment001Controller = (context) =>
new Payment001Controller(
context,
findTicketsUseCaseImpl,
findPaymentUseCaseImpl,
)
export { payment001Controller }
//Controller
class Payment001Controller {
constructor(
context,
findTicketsUseCase
findPaymentUseCase,
) {
this.context = context
this.findTicketsUseCase = findTicketsUseCase
this.findPaymentUseCase = findPaymentUseCase
}
async mounted() {
try {
//TODO
} catch (error) {
//HANDLER ERROR
}
}
}
export default Payment001Controller
You can send how many PR's do you want, I'll be glad to analyze and accept them! And if you have any question about the project...
Email-me: [email protected]
Connect with me at LinkedIn
Thank you!
This project is licensed under the MIT License - see the LICENSE.md file for details