Skip to content

Commit

Permalink
Generate .gitignore on init command (#2248)
Browse files Browse the repository at this point in the history
Generate .gitignore on init command

Currently, when users initialize a site from scratch, we do not
generate .gitignore automatically.

This may cause unnecessary hassle for users using git as they
need to manually create a .gitignore, or add to a pre-existing
.gitignore, all the build files created by markbind.

Generating a .gitignore including common log and build files
from markbind allows users to use our .gitignore without
having to manually find which generated files are unnecessary.

Skipping .gitignore when --convert flag is used prevents
accidentally overwriting a pre-existing .gitignore file.
  • Loading branch information
lhw-1 authored Apr 9, 2023
1 parent edb108c commit fc027af
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/userGuide/gitignoreFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Some common files to ignore in a MarkBind project are:
* build output
* dependencies such as `node_modules`

The following is a sample `.gitignore` file for typical MarkBind projects:
The following is the auto-generated `.gitignore` file for MarkBind projects when `markbind init` is called:

``` {heading=".gitignore"}
# Logs
Expand All @@ -45,3 +45,11 @@ _site/
.idea/*
*.iml
```

<box type="info">

A pre-existing `.gitignore` file will not be overwritten if you are using the `markbind init --convert` command.

The auto-generation only adds this `.gitignore` if it detects that there is none in your root directory.

</box>
1 change: 1 addition & 0 deletions docs/userGuide/siteJsonFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Here is a typical `site.json` file:
"*.json",
"*.md",
".git/*",
".gitignore",
"node_modules/*"
],
"plugins" : [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
_markbind/logs/

# Dependency directories
node_modules/

# Production
_site/

# Env
.env
.env.local

# IDE configs
.vscode/
.idea/*
*.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
_markbind/logs/

# Dependency directories
node_modules/

# Production
_site/

# Env
.env
.env.local

# IDE configs
.vscode/
.idea/*
*.iml
23 changes: 23 additions & 0 deletions packages/core/template/default/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
_markbind/logs/

# Dependency directories
node_modules/

# Production
_site/

# Env
.env
.env.local

# IDE configs
.vscode/
.idea/*
*.iml
1 change: 1 addition & 0 deletions packages/core/template/default/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"*.md",
"*.njk",
".git/*",
".gitignore",
"node_modules/*"
],
"pagesExclude": ["node_modules/*"],
Expand Down

0 comments on commit fc027af

Please sign in to comment.