osscameroon / js-generator

Generates JavaScript from HTML
https://osscameroon.github.io/js-generator/
MIT License
19 stars 14 forks source link

Steps for the Whole Project to follow #12

Open FanJups opened 2 years ago

FanJups commented 2 years ago

Goals:

There are 3 environments : Web, APIs to consume and dependency.

  1. Web

    feature 1 (html code -> js code): there are 2 inputs, one for html code and the other for generated js code, the users will be able to copy and paste on the html input but only copy from the js input (In process)

    feature 2 (html file -> js code): upload an html file and generate a js code (copy only)

    feature 3 (html code -> js file): generate a js file based on the html code as input (copy and paste)

    feature 4 (html file -> js file): upload an html file and generating a js file (In process)

  2. APis

    There will be 4 APIs related to the 4 web features.

  3. Dependency

    There are 2 ways to read Html files, from CLI or directly from a defined folder. Whether we are using CLI or not, the html file could be inside the default "src/main/resources/htmlFilesInput/" folder or defined folder choosen by the user.

    Generated js file could be inside the default "src/main/resources/jsFilesOutput/" folder or defined folder choosen by the user.

    The following features should respect the these previous rules.

    feature 1 : html code -> js code (In process) There is already a method called convert to do that

The dependency will provide methods that are called by APIs

 feature 2 : html file -> js code

    WEB : (html file -> js code)

    CLI

     * (CLI -> the default "src/main/resources/htmlFilesInput/" folder) html file ->js code

    * (CLI -> defined folder) html file -> js code

    NO CLI

     * (the default "src/main/resources/htmlFilesInput/" folder) html file ->js code

    * (defined folder) html file -> js code

 feature 3 : html code -> js file

    WEB : (html code -> js file)

     * html code -> (the default "src/main/resources/jsFilesOutput/" folder) js file

    * html code -> (the defined folder) js file default - defined

 feature 4 : html file -> js file 

    WEB : html file -> js file 

    CLI:

    * (CLI -> the default "src/main/resources/htmlFilesInput/" folder) html file -> (the default "src/main/resources/jsFilesOutput/" folder) js file (Already done) default - default

    * (CLI -> the default "src/main/resources/htmlFilesInput/" folder) html file -> (the defined folder) js file default - defined

    * (CLI -> defined folder) html file -> (the defined folder) js file  defined - defined

    * (CLI -> defined folder) html file -> (the default "src/main/resources/jsFilesOutput/" folder) js file defined - default

    NO CLI:

     * (the default "src/main/resources/htmlFilesInput/" folder) html file -> (the default "src/main/resources/jsFilesOutput/" folder) js file (Already done) default - default

    * (the default "src/main/resources/htmlFilesInput/" folder) html file -> (the defined folder) js file default - defined

    * (defined folder) html file -> (the defined folder) js file  defined - defined

    * (defined folder) html file -> (the default "src/main/resources/jsFilesOutput/" folder) js file defined - default
  1. CLI Tool (should work without internet)
  2. Desktop app (should work without internet)

(The following steps should be corrected) 6 steps:

  1. A method returning a String Object containing Js from a String Object containing Html as parameter.

  2. A method generating a Js file from Html file as parameter : 2.1) Library environment (CLI : A method generating a Js file from Html file as argument) && 2.2) Web environment

  3. We'll add all the required tests, javadocs , refactor the code as much as possible. In order to better understand the Jsoup library, there are links in the README file.

  4. Publish on Maven Central in order to get our own Maven / Gradle dependency. @elroykanye, you shared some interesting links, we'll look at it on step 5 https://github.com/osscameroon/js-generator/pull/11

  5. Building the API with Spring Boot, we will have 2 main endpoints related to 1. & 2. We will build the frontend with Angular or whatever...

We are at step 3

FanJups commented 2 years ago

I just created a project to manage tasks

elroykanye commented 2 years ago

Hello, sorry for delayed response. Thanks for this. I will follow :)

FanJups commented 2 years ago

Suggest to use "var" or "let" #52

FanJups commented 2 years ago

Future project : translate hand written html code into Js

FanJups commented 2 years ago

These steps need to be updated but to make it simple, these are the basics.

To know more about the "WHY" of this project: https://github.com/osscameroon/js-generator/issues/91

The user has choice to copy and paste html code or submit file as input then get a Js code or file as output. It will be also possible to get both Js code or file if the user wants to do so. I mean, if the user choose the Js code as output, it would be possible to get also the file. If the user choose the Js file as output, it would be possible to get also the content.

First, we ask the user if the html input contains only HTML 5 tags or not (there are some custom tags) then we'll raise exception if custom tags are used or not. To be more precise, we'll throw exception if the user informed us that there are only HTML 5 tags but custom tags are also present. On the other hand, we do nothing if the user informed us that there are custom tags.

Secondly, we will ask if the user wants to use LET or VAR or CONST

We will think about how to implement it for each sub project: Maven & Gradle Library, REST APIs, Web & Desktop Apps and Command Line Interface tool.