Skip to content

Commit

Permalink
feat: remove templates from project
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-lebleu committed Feb 16, 2024
1 parent 3ff5b66 commit 987838b
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 19 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
![Github action workflow status](https://github.com/steve-lebleu/rsgen/actions/workflows/build.yml/badge.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/konfer-be/rsgen/badge.svg?branch=master)](https://coveralls.io/github/konfer-be/rsgen?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/steve-lebleu/rsgen/badge.svg?branch=master)](https://coveralls.io/github/steve-lebleu/rsgen?branch=master)
![Known Vulnerabilities](https://snyk.io/test/github/steve-lebleu/rsgen/badge.svg)
![GitHub Release](https://img.shields.io/github/v/release/steve-lebleu/rsgen?logo=Github)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)

Naive modular resource generation for :point_right: [Typeplate](https://github.com/steve-lebleu/ts-express-typeorm) project.

## > Why ?

Obviously to improve the time passed on low value-added tasks . :clock1: :muscle:
Naive modular resource generation for :point_right: [Typeplate](https://github.com/steve-lebleu/typeplate) project.

## > How to ?

Expand All @@ -20,15 +16,15 @@ $ npm install -g rsgen

### Generate

Go to the project folder:
Go to project folder:

```bash
$ cd path-to-the-root-of-your-typeplate-project
```

Generate your resource module or core member:
Generate resource module or core member:

#### CLI short way
#### Short way

```bash
$ rsgen <name> [<target>] [<permissions>]
Expand All @@ -38,7 +34,7 @@ $ rsgen <name> [<target>] [<permissions>]
- **target** : -c (core) or -r (resource). Default: -r
- **permissions** : -p=[a,u,g]|[admin,user,ghost]. Default: admin

#### CLI interactive way
#### Interactive way

```bash
$ rsgen
Expand Down
2 changes: 0 additions & 2 deletions ROADMAP.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/file.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const write = async ({...args}) => {

const { isModule, template, patterns, lowerCase } = args;

const tpl = fs.readFileSync(`${__dirname}/../../templates/${template.name}.txt`, 'utf-8');
const tpl = fs.readFileSync(`${process.cwd()}/src/templates/${template.name}.txt`, 'utf-8');

const output = patterns.reduce( (acc, current) => {
return acc.replace(current.regex, current.value);
Expand Down
6 changes: 0 additions & 6 deletions test/01-package.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ describe('Package', () => {
expect(fs.existsSync(`${process.cwd()}/bin/rsgen.js`)).to.be.true;
});

['controller', 'model', 'repository', 'route', 'test', 'validation', 'business.service', 'data-layer.service', 'query-string.interface', 'request.interface', 'subscriber'].forEach(pattern => {
it(`should expose a template ${pattern}`, () => {
expect(fs.existsSync(`${process.cwd()}/templates/${pattern}.txt`)).to.be.true;
});
});

});

});

0 comments on commit 987838b

Please sign in to comment.