OSD600 - Siteit can turn your .txt files into .html
Tags: opensource, javascript, ssg, cli
Published: 2022-09-18 00:36:12


##About Siteit

Siteit simply turns your `.txt` extension files into `.html` files. 

I programmed my static site generator (SSG) tool called Siteit using NodeJS and Javascript, trying my best to rely on as few external node modules as possible. Some may label this approach as re-inventing the wheel, but the reasoning behind not relying on too many npm dependencies was to improve my coding skills.

Honestly, I was a little nervous sharing my code publicly on GitHub, as certain planned features are yet to be implemented. 

##Finding a Partner

For some reason, I thought finding a partner to review my code would be difficult, but it was not as I was able to find two. 


First, I  connected with [Chen-Yuan](https://github.com/cychu42) through a post he created on Slack regarding seeking a peer code tester and reviewer for his tool called [staticSiteCon](https://github.com/cychu42/staticSiteCon). Since it uses NodeJS and Javascript, It was not difficult to test and review the code. 

## Testing staticSiteCon
It's worth noting that at the time of testing, the project features section of README.md was labelled "WIP" so it proved difficult to differentiate bugs from features not yet implemented. Lastly, The source code is somewhat difficult to follow.  

### Issues I Created

1. [SSG breaks when a file with an extension other than .txt is supplied](https://github.com/cychu42/staticSiteCon/issues/2)
When a text file with an extension other than .txt is supplied, the staticSiteCon crashes and throws an `ENOTDIR` error.

2. [HTML pages generated by SSG only contains <p></p>](https://github.com/cychu42/staticSiteCon/issues/3) 
The static pages that are generated by the staticSiteCon only contain `<p></p>` tags in the HTML markup.

3. [-i and --input flag with no source crashes the application](https://github.com/cychu42/staticSiteCon/issues/4)
Running the SSG tool using the `-i` or `--input` flag with no source file supplied crashes the application with an error. 

4. [Add support for programmatic generation and deletion of the ./dist directory](https://github.com/cychu42/staticSiteCon/issues/5)
The tool does not support programmatic generation and deletion of the `./dist` directory. If the directory that comes with the project is deleted, relocated, or renamed, the program throws a compiler error and crashes.

5. [Add support for outputting success/error messages to terminal](https://github.com/cychu42/staticSiteCon/issues/6)
Running tool with an invalid option does not generate an error message. Also, the tool does not generate any success messages, so there is no way to know whether HTML pages were successfully generated without having to manually check the `./dist` folder.

6. [Cannot execute the tool from terminal without prefixing node keyword](https://github.com/cychu42/staticSiteCon/issues/1)
To run the SSG tool from the terminal, I have to prefix `staticSiteCon -h` with `node` command. The terminal throws an error if I try to run the tool without adding node first.

### Issues Created By Chen-Yuan 

1. [The tool reports an issue when reading a single txt file as input](https://github.com/SerpentBytes/siteit/issues/1) (Closed)

2. [Output folder is always immediately deleted.](https://github.com/SerpentBytes/siteit/issues/2) (Closed)

3. [README.md instruction is currently missing.](https://github.com/SerpentBytes/siteit/issues/3) (Closed)

4. [The tool doesn't generate output after creation of output folder.](https://github.com/SerpentBytes/siteit/issues/4) (Closed)

5. ["siteit -i ./source_directory" command generates an error.](https://github.com/SerpentBytes/siteit/issues/6) (Closed)

6. [The tool inaccurately shows error message about invalid source files.](https://github.com/SerpentBytes/siteit/issues/5)

Later,[Tymur](https://github.com/Myrfion) connected with me via Slack DM to test his SSG tool [Izyum](https://github.com/Myrfion/izyum). This SSG is created using Typescript and NodeJS. 

## Testing Izyum
It's worth noting that at the time of testing, the project contains minor bugs, and additional features needed to be implemented. The source code is clear and neatly organized.

### Issues I Created

1. [-i and --input option with no source supplied crashes the tool #1](https://github.com/Myrfion/izyum/issues/1)
Running the tool with the -i or --input option with no source file or directory supplied crashes it.

2. [Tool crashes when input file extension is not .txt](https://github.com/Myrfion/izyum/issues/2)
The tool crashes when the -i option is used and the source file supplied is not in `.txt` format

3. [Tool requires files to be within a directory when -i flag is used](https://github.com/Myrfion/izyum/issues/3)
The tool crashes with an error if the source file provided is not within a directory.

4. [.html files generated has formatting issues #4](https://github.com/Myrfion/izyum/issues/4)
.html files generated have formatting issues.

5. [Tool is missing additional features required](https://github.com/Myrfion/izyum/issues/5)

6. [Supplying a text file + directory crashes the tool](https://github.com/Myrfion/izyum/issues/6)
Using the `--input` flag and providing a text file with a directory crashes the tool with an error 

### Open Issues Created by Tymur

1. [Tool doesn't work with filenames that have space](https://github.com/SerpentBytes/siteit/issues/7)

2. [The Resulted HTML is not valid](https://github.com/SerpentBytes/siteit/issues/8)

3. [The Resulted HTML is not valid](https://github.com/SerpentBytes/siteit/issues/8)

Closed issues authored by Tymur can be found [here](https://github.com/SerpentBytes/siteit/issues?q=is%3Aissue+author%3AMyrfion+is%3Aclosed)


The first release is will be available with full all features implemented by __Sunday, September 18th__