Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added code tasks like, prettier for fromatting, eslint for linting, v…
…scode settings for auto formatting and linting on save, pre-commit hooks for auto formatting and linting before committing:

* refactored readme and added contributing
* added prettier configuration to project
* added eslint configuration
* added vscode integration for auto formatting using prettier and linting using eslint
* added pre-commit hooks with lint-staged and husky to lint and format files automatically before committing
* updated pre-commit settings
* testing pre-commit hook
* removed console.log to test whether pre-comit hook works properly
* added updated lintstaged commands
  • Loading branch information
sdthaker committed Oct 30, 2023
1 parent b96ef38 commit 7bf78de
Show file tree
Hide file tree
Showing 19 changed files with 2,227 additions and 66 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
@@ -0,0 +1,4 @@
package.json
package-lock.json
node_modules/
examples/
15 changes: 15 additions & 0 deletions .eslintrc.cjs
@@ -0,0 +1,15 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
"extends": [
"eslint:recommended",
"prettier"
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
};
2 changes: 0 additions & 2 deletions .gitignore
@@ -1,5 +1,3 @@
node_modules

til

.DS_Store
1 change: 1 addition & 0 deletions .husky/.gitignore
@@ -0,0 +1 @@
_
3 changes: 3 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
@@ -0,0 +1,4 @@
{
"*.js": ["prettier --write", "eslint --fix"],
"*.{html, css}": ["prettier --write"]
}
4 changes: 4 additions & 0 deletions .prettierignore
@@ -0,0 +1,4 @@
package.json
package-lock.json
node_modules/
examples/
3 changes: 1 addition & 2 deletions .prettierrc
Expand Up @@ -11,6 +11,5 @@
"semi": true,
"singleAttributePerLine": true,
"singleQuote": true,
"trailingComma": "es5",
"withNodeModules": false
"trailingComma": "es5"
}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
@@ -0,0 +1,6 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,8 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"eslint.workingDirectories": [{ "mode": "auto" }]
}
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,51 @@
## Project Setup

Make sure [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) is installed on your system. Also, make sure you have latest [node](https://nodejs.org/en/download) installed on your computer.

To install this program, first clone the repository by running:

```bash
git clone https://github.com/sdthaker/Node-TILify.git
```

To make sure node & npm are installed on your system, run:

```bash
node -v
npm -v
```

Then run the following command from root directory to install the dependencies:

```bash
npm install
```

You can now run the program from the cloned repository's terminal to see how to use this tool:

```bash
node src/index.js -h
```

_Optional_ - If you'd like to spin up a node server, open a terminal inside of the cloned repository, and install the node dependencies & spin up the server by running:

```bash
npm install
npm run start
```

## Pretty Print

To pretty print the entire project, run the following command:

```bash
npm run prettier
```

## Lint

To lint the entire project and check for errors/warnings, run the following command:

```bash
npm run lint
```
17 changes: 5 additions & 12 deletions README.md
Expand Up @@ -2,7 +2,7 @@

Welcome to Node-TILify. An open source CLI software that helps you convert a text file or a directory of text file(s) into html file(s) blazingly fast 🏃‍♂️ 💨 ⚡️. The name of the project was chosen to showcase which language/framework was used to build this tool -- _`Node`.js_, what the tool is all about -- _`TIL` - Today I Learned_, & the value that it adds to your workflow -- _Ampl`ify`ing Knowledge_.

# How to use / Installation
# How to use

Make sure [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) is installed on your system. Also, make sure you have latest [node](https://nodejs.org/en/download) installed on your computer.

Expand All @@ -12,11 +12,10 @@ To install this program, first clone the repository by running:
git clone https://github.com/sdthaker/Node-TILify.git
```

To make sure node & npm are installed on your system, run:
Then run the following command from root directory to install the dependencies:

```bash
node -v
npm -v
npm install
```

You can now run the program from the cloned repository's terminal to see how to use this tool:
Expand All @@ -25,13 +24,6 @@ You can now run the program from the cloned repository's terminal to see how to
node src/index.js -h
```

_Optional_ - If you'd like to spin up a node server, open a terminal inside of the cloned repository, and install the node dependencies & spin up the server by running:

```bash
npm install
npm run start
```

# Features

- Pass in a txt file and it'll generate an html file.
Expand Down Expand Up @@ -120,6 +112,7 @@ partial output of `output/Kubernetes101.html`

<p>Kubernetes is a container orchestration system: in other words, it provides the necessary components for configuring, deploying and scaling images that are built with Docker.</p>
```

## Configuration Using TOML

Now with TOML configuration support, streamline your repetitive tasks by setting your configurations just once!
Expand All @@ -140,4 +133,4 @@ stylesheet = "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"

# Language setting
lang = "fr"
```
```

0 comments on commit 7bf78de

Please sign in to comment.