Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* Added CONTRIBUTING.md file
* Added source code formatter and linter
* Configured Visual Studio Code settings
* Added git pre-commit hook
  • Loading branch information
gulyapulya committed Nov 8, 2022
1 parent 4a3a6d6 commit 8ace021
Show file tree
Hide file tree
Showing 16 changed files with 1,558 additions and 260 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package.json
package-lock.json
node_modules/
stories/
dist/
.*

14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"insertPragma": false,
"proseWrap": "preserve",
"requirePragma": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"printWidth": 100
}
12 changes: 0 additions & 12 deletions .vscode/ settings.json

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"files.eol": "\n",
"files.insertFinalNewline": true
}
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing to SSGulnur

Please use this guide while contributing to the SSGulnur project.

## Welcome

Thank you for your intention to contribute to this project! Every contribution is welcome, important and is very appreciated.

## Issues

You can work on any issue (assuming someone is not already working on it) in this project or can create a new issue if you have an idea that was not already documented. Please leave a comment letting other contributors know that you are starting to explore the issue and will be working on its solution.

## Set-up and contribution

If you are working on one of the issues, you will need to set-up SSGulnur locally.

VSCode is preferred editor, as the recommended extensions will be downloaded automatically.

1. Fork this project, to have your own copy where you would be able to freely make changes.
2. Clone the forked repo to your local machine.
3. Run npm to install the tool globally `npm install -g`.
4. Create a new branch with a descriptive name such as issue-123.
5. Work on that branch and make all required changes to complete the issue.
6. Test you work, run the tool in your terminal.
- run `npm run lint` and `npm run prettier-check` to check your code for styling issues or bugs.
7. Commit regularly.
7. When you are done, push your work and request a pull to the `main` branch.

Please follow [conventional commit messages convention](https://www.conventionalcommits.org/en/v1.0.0/).
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<p align="center">
<img width="459" alt="SSGulnur" align="center" src="https://user-images.githubusercontent.com/52351598/192425336-04087ba4-0af9-4a29-a167-b84dddbd81bb.png">
</p>
Expand All @@ -14,11 +13,11 @@ SSGulnur is a command-line tool to generate static HTML web pages from a provide
Node is required.

1. Clone this repository to your local machine
2. Navigate to the cloned directory in your terminal
3. Run npm to install globally
`npm install -g`
2. Navigate to the cloned directory in your terminal
3. Run npm to install globally
`npm install -g`

## Usage
## Usage

### ssgulnur -v | --version

Expand Down Expand Up @@ -46,33 +45,34 @@ Config:

### ssgulnur -i | --input <source>

* Supported file types are .txt and .md. For markdown, only italicized text stying is processed properly.
* Source can be a single file or a folder which can also contain sub-folders with files.
* For file names with spaces, please use quotation marks. For example: `ssgulnur -i "Example file path.txt"`.
* For each provided file an html file will be generated. By default, all html files will be placed into the `./dist` folder.
* All titles need to be the first line in the file followed by two blank lines. Otherwise, it will be considered as part of the story.
- Supported file types are .txt and .md. For markdown, only italicized text stying is processed properly.
- Source can be a single file or a folder which can also contain sub-folders with files.
- For file names with spaces, please use quotation marks. For example: `ssgulnur -i "Example file path.txt"`.
- For each provided file an html file will be generated. By default, all html files will be placed into the `./dist` folder.
- All titles need to be the first line in the file followed by two blank lines. Otherwise, it will be considered as part of the story.

#### Options

Option | Argument | Description
---------------|---------------|--------------
`-o \| --output`|`<folder>`| Allows to specify an output folder name. If exists, will be used, if not, gets created. <br>Cannot be a file. By default, `./dist`.
`-s \| --stylesheet`|`<url>`| Allows to specify a particular stylesheet to use for html styling. <br> For example, https://cdn.jsdelivr.net/npm/water.css@2/out/water.css
| Option | Argument | Description |
| -------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `-o \| --output` | `<folder>` | Allows to specify an output folder name. If exists, will be used, if not, gets created. <br>Cannot be a file. By default, `./dist`. |
| `-s \| --stylesheet` | `<url>` | Allows to specify a particular stylesheet to use for html styling. <br> For example, https://cdn.jsdelivr.net/npm/water.css@2/out/water.css |

#### Examples

* `ssgulnur -i "Example file path.txt"`
* `ssgulnur --input exampleFolderPath --output exampleOutputFolderPath`
* `ssgulnur -i exampleFolderPath -o exampleOutputFolderPath -s "https://www.exampleCSSurl.com"`

- `ssgulnur -i "Example file path.txt"`
- `ssgulnur --input exampleFolderPath --output exampleOutputFolderPath`
- `ssgulnur -i exampleFolderPath -o exampleOutputFolderPath -s "https://www.exampleCSSurl.com"`

### ssgulnur -c | --config <source>
* Allows the user to consolidate the above options inside of a JSON file, instead of using the command line to specify options.
* For file names with spaces, please use quotation marks. For example: `ssgulnur -c "Example file path.json"`.

- Allows the user to consolidate the above options inside of a JSON file, instead of using the command line to specify options.
- For file names with spaces, please use quotation marks. For example: `ssgulnur -c "Example file path.json"`.

Config File Example:

example.json

```
{
"input":"./path/to/input/files",
Expand All @@ -81,6 +81,13 @@ example.json
}
```

Stories folder is provided as a sample which you can use. It contains five Sherlock Holmes stories by Sir Arthur Conan Doyle.
Stories folder is provided as a sample which you can use. It contains five Sherlock Holmes stories by Sir Arthur Conan Doyle.
Generated static pages for the sample can be seen here: https://ssg-gulnur-sample.vercel.app

## Bugs and new features

If you notice a bug or have a suggestion for a new feature, please go to the issues tab of the project and check if similar ideas do not already exist. If there are no duplicates, please create a new issue and document it giving as many details as possible.

## Contribution

Contributions are always welcome! Please check the CONTRIBUTING.md file for more details.
Loading

0 comments on commit 8ace021

Please sign in to comment.