Giter Club home page Giter Club logo

stub-cli's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @hector-js
  • ๐Ÿ‘€ Iโ€™m interested in ...tbc...
  • ๐ŸŒฑ Iโ€™m currently learning ... tbc...
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on ...tbc...
  • ๐Ÿ“ซ How to reach me ...tbc...

stub-cli's People

Contributors

christianchown avatar christianchownsan avatar dependabot[bot] avatar hector-js avatar

Stargazers

 avatar  avatar

Watchers

 avatar

stub-cli's Issues

Create config or banner in the root or under _hjs folder

Is your feature request related to a problem? Please describe.
when you create a new configuration file of banner file, it does not know where the file is going to be created. it could be under _hjs folder or in the root of the project.

Describe the solution you'd like
Scenario 1: I want to create a configuration file in an existing project
Given an existing project
When hjs config --logs is executed
Then the terminal should ask you Where do you want to create config file?
And display two options to choose:
* under _hjs folder
* root project
When under _hjs folder is selected
Then .hjs.config.json file is created under _hjs folder
When root project is selected
Then .hjs.config.json file is created in the root of the project

Scenario 2: I want to create a banner file in an existing project
Given an existing project
When hjs config --banner is executed
Then the terminal should ask you Where do you want to create a banner file?
And display two options to choose:
* under _hjs folder
* root project
When under _hjs folder is selected
Then .hjs.banner.js file is created under _hjs folder
When root project is selected
Then .hjs.banner.js file is created in the root of the project

Scenario 3: I want to create a banner file and config file in an existing project
Given an existing project
When hjs config --banner --logs is executed
Then the terminal should ask you Where do you want to create a banner file?
And display two options to choose:
* under _hjs folder
* root project
When under _hjs folder is selected
Then .hjs.banner.js file is created under _hjs folder
When root project is selected
Then .hjs.banner.js file is created in the root of the project
When the terminal should ask you Where do you want to create config file?
And display two options to choose:
* under _hjs folder
* root project
When under _hjs folder is selected
Then .hjs.config.json file is created under _hjs folder
When root project is selected
Then .hjs.config.json file is created in the root of the project

Scenario 4: I want to create a banner file when create new project
Given a new project
When hjs new --banner is executed
Then the terminal should ask you Where do you want to create a banner file?
And display two options to choose:
* under _hjs folder
* root project
When under _hjs folder is selected
Then .hjs.banner.js file is created under _hjs folder
When root project is selected
Then .hjs.banner.js file is created in the root of the project

No delays option

Is your feature request related to a problem? Please describe.
Being able to start the application with no delays

Describe the solution you'd like
Execute the application like hjs start --no_delays

Update hjs version

Describe the bug
when you execute hjs --version, it shows the same version from the last 10 versions. Basically, this parameter did not change in the last versions

Expected behavior
It expects a mechanism to update the version every time we realise a new version.

Nodemon set

Is your feature request related to a problem? Please describe.
The client must have installed nodemon in order to update the ui while any change is done

Describe the solution you'd like
As part of the project creation, nodemon should be installed and set it in the npm start comand

hjs config --banner

Is your feature request related to a problem? Please describe.
create a banner when the project is already created without any banner

Describe the solution you'd like
Scenario: project already created without .hjs.banner.js
given a user wants to add a custom banner
and the project already exists
and there is no .hjs.banner.js file
when the user execute hjs config --banner
then it should create a hjs.banner.js in the root

Scenario: project already created with .hjs.banner.js
given a user wants to add a custom banner
and the project already exists
and there is an existing .hjs.banner.js file
when the user execute ```hjs config --banner
then the terminal should ask you if you want to overwrite the existing banner
and press y -> create new one
and press n -> dont do anything

hjs folder

Is your feature request related to a problem? Please describe.
If you want to use the mock project using your own package.json, resources and test folder are very common name.

Describe the solution you'd like
I would like to grab those folders under hjs folder being more specific for the library. hjs cli must create all the cases, project config among others commands.

E2e tests - Create e2e

Is your feature request related to a problem? Please describe.
There is no e2e tests where you can proof your application is working automatically. Also, there is no e2e in the pipeline.

Describe the solution you'd like
Create e2e folder with main tests which are going to be executed in the pipeline as well.

create new project with custom banner

Is your feature request related to a problem? Please describe.
If I want to create a new project with a specific banner, it wont be possible

Describe the solution you'd like
Using the command hjs new mock-service --banner, it will generate a file called .hjs.banner.js in the root project where you can customise your banner

Skip-install and package-manager options

Is your feature request related to a problem? Please describe.
Add package manager and install option using cli

Describe the solution you'd like
You need to be able to select the package manager and install option via npm
Package manager:

hjs new --package-manager npm

Note you can use npm or yarn
Skip-install
You can skip the installation of the dependencies

hjs new --skip-install

XML -get

Is your feature request related to a problem? Please describe.
At this moment the developer cannot create an method for xml

Describe the solution you'd like
It should be able to create a xml using --xml tag

add new features to the config file

Is your feature request related to a problem? Please describe.
given a .hjs.config.json property file already created, when the user wants to add or overwrite a new property, it should be able to do it with the command and not to overwrite the file.

Describe the solution you'd like
given the following .hjs.config.json file:

{
  "logs": "tiny",
}

when I execute the next command hjs config --port 8080, the file will be updated like:

{
  "logs":"tiny",
  "port":8080
}

config cli -- help

Describe the bug
Description for config options.

To Reproduce
Execute:

hjs config --help

You will see the following text:

Config options:

 -  hjs config --port [port]: select port
 -  hjs config --logs [port]: select logs

        Example: hjs config --port 3004 --logs tiny

Expected behavior
It should show:

Config options:

 -  hjs config --port [port]: select port
 -  hjs config --logs [logs]: select logs

        Example: hjs config --port 3004 --logs tiny

config and banner files are created in the wrong position

Describe the bug
hjs config --banner --logs tiny
When you want to create a banner file and config file under _hjs folder. It creates those files in the root

To Reproduce
Steps to reproduce the behavior:

  1. npm init -y
  2. hjs n -> n
  3. hjs config --banner --logs tiny

Expected behavior
It should create the files under _hjs folder

Technical refactor

Is your feature request related to a problem? Please describe.
There is no problem in terms of functionality. The could be refactored when the resource file is created.

Describe the solution you'd like
Instead of generating the resource based on a string, we should be using an object which is easier to work with it.

CLI -config command line

Is your feature request related to a problem? Please describe.
The developer needs to create a config file manually. It should be a way to generate the config file with cli.

Describe the solution you'd like
The developer should be able to generate a config file with all the different properties:

hjs config --ui localhost --port 8080 --logs tiny

Ids generator

Is your feature request related to a problem? Please describe.
The user wants to create a scenario adding some identifiers in the command line. At this moment this task must be done manually.

Describe the solution you'd like
Given a user wants to generate a scenario for the following endpoint /customers/{id}/product?name={param1}&lastname={param2} adding the identifiers id, param1 and param2 in the command line. When the user execute the following line of code:

hjs g g "customers/{id}/product?name={param1}&lastname={param2}" --id 1 --name mateo --lastname smith

Then the user shoud have in the resourse file the following scenario:

{
  "_get": {
    "/customers/{id}/product?name={param1}&lastname={param2}": [
      {
        "_req": {
          "_id": 1,
          "_param1": "mateo",
          "_param2": "smith"
        },
        "_res": {
          "_body": {
            "Ok": "to be defined"
          }
        }
      }
    ]
  }
}

Also, it should generate the test adding the ids.

README.md

Is your feature request related to a problem? Please describe.
The readme file is not updated at this moment, so the developer can not understand the use of this library and the aim of it.

Describe the solution you'd like
The readme file should contain the following sections:

  • Description
  • Commands
  • Giff interactive

Describe alternatives you've considered
It could add some fancy icons

Support x-www-form-urlencoded

Is your feature request related to a problem? Please describe.
Being able to generate a case supporting x-www-form-urlencoded requests

Describe the solution you'd like
If you dont specify any content-type, the library will work with json requests and reponse.
Adding the content-type as application/x-www-form-urlencoded will generated the resource file and test file based on this.

ui and path annotations

Is your feature request related to a problem? Please describe.
Ui and path annotation does not make a lot of sense when you want to open the ui or create the resource under a specific folder

Describe the solution you'd like
Change the annotation --ui for --open and --path for --package

Example:

hjs g g customers --package customer
hjs start --open

delay

Is your feature request related to a problem? Please describe.
It should be able to add the delay by command line.

Describe the solution you'd like
The cli should be like the following example:

hjs generate get authors/{id} --delay 10000

It will include 10000 milliseconds.

Include .gitignore file when git is initialized

Is your feature request related to a problem? Please describe.
When the customer creates a new project initializing git (hjs new project-name --git), it will initialize a git project. As there is no .gitignore file, all the node modules folder will be available to stage.

Describe the solution you'd like
Once hjs new project-name --git command is executed, it will generate a .gitconfig file excluding node_modules folder.

Install @hectorjs/stub-backend library in dependencies

Describe the bug
When you add hjs library via hjs new`` into your own project, the library is installing @hectorjs/stub-backend``` library into the dependencies.

To Reproduce

  1. Navigate to your root project (where packange.json is placed)
  2. Create a new mock via cli .
  • hjs n
  • Create new project? [Yn] -> type n
  1. Go to your package.json
  2. @hectorjs/stub-backend is in dependencies section

Expected behavior
As this library is just for testing, it should be under devDependencies.

install hectorjs/stub-cli dependency when new project

Describe the bug
When you generate a new project or set hjs library, @hectorjs/stub-cli is not install as devdependency.

To Reproduce
When the
Expected behavior
A clear and concise description of what you expected to happen.

Yarn compatibility

Is your feature request related to a problem? Please describe.
I am using yarn in my project and I cannot use this cli if npm package manager is not installed

Describe the solution you'd like
Make compatible with yarn. When you execute ```hjs new my-name-proyect``, it will ask you for the package manager.

npm run _test fail if you dont have install mocha and chai

Describe the bug
Mocha and chai are missing as dependencies for the library.

To Reproduce
Steps to reproduce the behavior:

  1. hjs new new-project
  2. cd new-project
  3. hjs test or npm run _test
  4. It displays an error: env: mocha: No such file or directory

Expected behavior
Mocha and chai should be part of the main dependencies for the cli. So it should not have any error.

Add ability to customise the generated test files

Is your feature request related to a problem? Please describe.
Currently, the generated test files are named ${rootFile}-${METHOD}.test.js and have a fixed output for each of assert / body-req / cookies / describe / headers / it / libraries / method

Describe the solution you'd like
To be able to supply a template for customisation for generate
// hjs g g customers --template template.json

\\ template.json

{
  "dataname": "{rootFile}.{method}.json",
  "filename": "{rootFile}.{method}.spec.ts",
  "assert": "      .end((err, res) => {",
  "noErrors": "          expect(err).toBeTruthy();",
  "status": " ... ",
  "body": " ... ",
  "bodyG": " ... ",
  "bodyGXml": " ... ",
  "emptyBody": " ... ",
  "endAssert": " ... ",
  "bodyReq": " ... ",
  "bodyReqXml": " ... ",
  "cookies": " ... ",
  "describe": " ... ",
  "headers": " ... ",
  "it": " ... ",
  "libraries": " ... ",
  "method": " ... "
}

retry different responses

Is your feature request related to a problem? Please describe.
hector-js/stub-backend#39
There is a new functionality to retry multiple responses for the same request.

Describe the solution you'd like
We need to have an option to add the number or retries and provide fake responses and a test as a template. Also, we need to integrate it with the template for the test (which is a new feature)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.