Skip to content

Commit

Permalink
added contribution.md file and updated readme.md file
Browse files Browse the repository at this point in the history
added prettier

updated the contribution file with formatter

added the esLint

added the esLint and recommendation
  • Loading branch information
anshul137 committed Nov 2, 2022
1 parent 3087bb1 commit 0d6c081
Show file tree
Hide file tree
Showing 13 changed files with 3,508 additions and 84 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
"env": {
"node": true,
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
}
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ignore artifacts:
build
coverage
dist
.vscode
contributing.md
readme.md
readme.txt
package.json
package-lock.json
.prettierrc.json
Empty file added .prettierrc.json
Empty file.
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"reccomendatoin": {
"extensions": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}

}
93 changes: 93 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Contributing to Static site Generator (ag-ssg)

👍🎉 First off, thanks for taking the time to contribute! 🎉👍

The following is a set of guidelines for contributing to `ag-ssg` and its packages.
These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document via Pull request/discussions.

## What should I know before I get started?

Static site generator which converts the.txt or .md file to static .html page. In this version of project we need to create the command line tool which will help to process the .txt or .md file to .html files.

## Requirements

- This tool is built using the [Node.js](https://nodejs.org/en/)

# Getting started

- Clone the repository into your local drive

```
git clone <repository url> <project_name>
```

- Install all the dependencies

```
cd <project_name>
npm install
```

- Run the npm link module

```
npm link
```

- Build and run the project

```
node app.js - command line arguments
For example
node app.js - i "test.txt" .
if the file is in particular folder we have to provide the path like this node app.js -i "./textfile/Silver Blaze.txt"
if you want to convert the whole folder text file to html use this command node app.js -i textfile
```

## How Can I Contribute?

### Reporting issue/Bugs

This section guides you through submitting a issue/bug,Following these guidelines helps me and the community to understand your report 📝 in better way.

Before creating bug reports, please check the [issue list](https://github.com/anshul137/ag-ssg/issues) as you might find out that you don't need to create one.
`if issue is not in the list`
When you are creating a new `issue`, please follow these guidelines
Explain the problem and include additional details to so that i can reproduce the problem:

- **Use a clear and descriptive title** for the issue to identify the problem.
- **Describe the exact steps which reproduce the problem** in as many details as possible.
- **Provide specific examples to demonstrate the steps**.
- **Include screenshots and animated GIFs** which show the problem.

### Your Code Contribution

You can start by looking through these [issue list](https://github.com/anshul137/ag-ssg/issues) and start working on it by commenting relevant information on how you are going to solve the issue.

### Pull Requests

Please follow these steps to have your contribution considered

1. Follow all instructions mentioned above and Follow the same `coding style guide`.
2. Create the new `branch` name it according to the which `issue` you are working on. for example if you are working on `issue #14` name your branch as `issue-14`.
3. Fix the issue, and test it locally on your end.
4. After you submit your pull request, wait for the code maintainer to review it.

While the prerequisites above must be satisfied prior to having your pull request reviewed,the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.

## Style Guide

Must use [prettier](https://prettier.io/) to format the `.js` files.

To run [prettier](https://prettier.io/) using the `npm` command line on your entire project's source code use this cmd
```
npm run format
```

Must use [esLint](https://eslint.org/)

To run the [esLint](https://eslint.org/) using the `npm` command line on your entire project's source code use this cmd

```
npm run esLint
```
53 changes: 14 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,7 @@ In this release version user can do the following
1. User can use the command line tool to specify the particular .txt file to convert it into .html file type.
2. User can specify the folder which contains multiple .txt files to convert all of them into a separate .html file type.

## Requirements

- This tool is built using the [Node.js](https://nodejs.org/en/)

# Getting started

- Clone the repository into your local drive

```
git clone <repository url> <project_name>
```

- Install all the dependencies

```
cd <project_name>
npm install
```

- Run the npm link module

```
npm link
```

- Build and run the project
- Build and run the project

```
node app.js - command line arguments
Expand Down Expand Up @@ -72,26 +47,26 @@ Another extra file is called "config.json" and can be used to test `--config` co

In addition to the above feature i have implemented these feature in my site.

- Improve the look and feel of your generated HTML pages using a default stylesheet that you design.
- Improve the look and feel of your generated HTML pages using a default stylesheet that you design.

- if the user specifies a folder for the input, automatically generate an index.html file, which has relative links to each of the generated HTML files.
- if the user specifies a folder for the input, automatically generate an index.html file, which has relative links to each of the generated HTML files.

## Markdown Support

- Initial support for the parsing of `.md` files has been added and the tool will now appropriately handle the `# header1` and `## header2` syntax features when a `.md` file is used for data input.
- Add support for a `horizontal` rule in Markdown. The Markdown `---` should get converted to an `<hr>` tag.
- Initial support for the parsing of `.md` files has been added and the tool will now appropriately handle the `# header1` and `## header2` syntax features when a `.md` file is used for data input.
- Add support for a `horizontal` rule in Markdown. The Markdown `---` should get converted to an `<hr>` tag.

## Language Support

- Add an option `-l,-- lang` flag, which indicates the language to use when generating the lang attribute on the root `html` element.
- For example `--lang fr` means the new generated documents will be in French.
- To use this feature in this app you can use this command `node app.js -l fr -i "./textfile"`. With this you can create the new `html` file in French
- Add an option `-l,-- lang` flag, which indicates the language to use when generating the lang attribute on the root `html` element.
- For example `--lang fr` means the new generated documents will be in French.
- To use this feature in this app you can use this command `node app.js -l fr -i "./textfile"`. With this you can create the new `html` file in French

## Configuration Support

- Use option `-c, --config <config-file>` flat, which indicates that the config functionality will be user.
- Config Supports following fields:
- `output` - the output folder (`./dist` by default)
- `input` - the input folder/file (`./test.md` by default)
- `lang` - the specified language (`en-CA` by default)
- To use this feature in the app you can use this command `node app.js --config config.json`
- Use option `-c, --config <config-file>` flat, which indicates that the config functionality will be user.
- Config Supports following fields:
- `output` - the output folder (`./dist` by default)
- `input` - the input folder/file (`./test.md` by default)
- `lang` - the specified language (`en-CA` by default)
- To use this feature in the app you can use this command `node app.js --config config.json`
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ program
.option('-c, --config <item>', 'get the config');

program.parse(process.argv);

if (program.version) {
console.log('Name of the package: ' + ' ag-ssg');
console.log('Version details: ' + json.version);
Expand All @@ -32,6 +33,7 @@ if (program.opts().help) {
'Need to install all the dependencies such as npm install , npm links , Build and run the project\n'
);
}

if (program.opts().input) {
console.log('input:' + program.opts().input);
ssg_(`${program.opts().input}`);
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"input": "test.md",
"output": "./output",
"lang": "uk"
}
}
30 changes: 22 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Main Page</title><link rel="stylesheet" href="../style.css"></head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Main Page</title>
<link rel="stylesheet" href="../style.css" />
</head>
<body>
<a href="Silver Blaze.html"> Silver Blaze.html </a>
<br><a href="The Adventure of the Six Napoleans.html"> The Adventure of the Six Napoleans.html </a>
<br><a href="The Adventure of the Speckled Band.html"> The Adventure of the Speckled Band.html </a>
<br><a href="The Naval Treaty.html"> The Naval Treaty.html </a>
<br><a href="The Red Headed League.html"> The Red Headed League.html </a>
<br>
</body></html>
<br /><a href="The Adventure of the Six Napoleans.html">
The Adventure of the Six Napoleans.html
</a>
<br /><a href="The Adventure of the Speckled Band.html">
The Adventure of the Speckled Band.html
</a>
<br /><a href="The Naval Treaty.html"> The Naval Treaty.html </a> <br /><a
href="The Red Headed League.html"
>
The Red Headed League.html
</a>
<br />
</body>
</html>
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const config = {
};

import readline from 'readline';
import path, {parse} from 'path';
import path from 'path';
import fs from 'fs';
export function ssg_(file, language = 'en-CA', configPath = null) {
let extension, filename, dir;
Expand All @@ -29,7 +29,7 @@ export function ssg_(file, language = 'en-CA', configPath = null) {
file = config.input;
language = config.lang;
} else {
extension = path.extname(file);
//extension = path.extname(file);
filename = path.basename(file);
dir = './dist';
}
Expand Down
Loading

0 comments on commit 0d6c081

Please sign in to comment.