Skip to content

Commit

Permalink
Merge pull request #6 from Innovix-Matrix-Systems/IMS-18
Browse files Browse the repository at this point in the history
Ims 18: enable contributor in readme
  • Loading branch information
AHS12 authored Oct 22, 2024
2 parents 213b8ab + 450de68 commit d645a16
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/contributor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Generate contributor list

on:
push:
branches:
- main

jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
permissions:
contents: write
pull-requests: write
steps:
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@ For reference, check out the `xsecurity` command implemented in [src/commands/xs

## Custom Module Creation Command

This project includes a custom script to generate a NestJS module along with additional folder structures for better organization.
This project includes a custom script to generate a new NestJS module with a well-organized folder structure.

### What this command does:

- Creates a new module using the NestJS CLI.
- Generates the associated controller and service.
- Adds additional folders (`dto`, `types`, `repositories`, `helpers`) inside the module folder for organizing your code.
- Adds additional folders (`dto`, `repositories`,) inside the module folder for organizing your code.
- Creates a `types.d.ts` file for type definitions.

### How to Use:

Expand All @@ -293,6 +294,10 @@ This project includes a custom script to generate a NestJS module along with add

- [@AHS12](https://www.github.com/AHS12)

## Contributors
<!-- readme: contributors -start -->
<!-- readme: contributors -end -->

## License

This project is brought to you by Innovix Matrix System and is released as open-source software under the [MIT license](https://opensource.org/licenses/MIT).
Expand Down
11 changes: 0 additions & 11 deletions src/commands/create-module.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@ import * as path from 'path';

@Injectable()
export class CreateModuleCommand {

@Command({
command: 'create:module <moduleName>',
describe: 'Create a new module with a predefined structure',
})

async run(

@Positional({
name: 'moduleName',
describe: 'The name of the module',
type: 'string',
})
moduleName: string,
): Promise<void> {

if (!moduleName) {
console.error('Please provide a module name.');
process.exit(1);
Expand Down Expand Up @@ -49,35 +45,28 @@ export class CreateModuleCommand {

// Utility function to run shell commands
runCommand(command: string): void {

try {
execSync(command, { stdio: 'inherit' });

} catch (error) {
console.error(`Error executing command: ${command}`, error);
}
}

// Utility function to create a directory if it doesn't exist
createDir(dirPath: string): void {

if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, { recursive: true });
console.log(`Created directory: ${dirPath}`);

} else {
console.log(`Directory already exists: ${dirPath}`);
}
}

// Utility function to create a file with content
createFile(filePath: string, content: string): void {

if (!fs.existsSync(filePath)) {

fs.writeFileSync(filePath, content);
console.log(`Created file: ${filePath}`);

} else {
console.log(`File already exists: ${filePath}`);
}
Expand Down

0 comments on commit d645a16

Please sign in to comment.