Skip to content

Conversation

@lhw-1
Copy link
Contributor

@lhw-1 lhw-1 commented Mar 30, 2023

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Breaking Change Overview:

A .gitignore file is now added by the markbind init command by default.

Default rules for the .gitignore file:

# 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

This file is only generated when initializing a new MarkBind site from scratch, and not when converting a set of pre-existing documents into a MarkBind site using markbind init --convert. As such, this does not require any additional actions from the user.

Overview of changes:

Resolves #1782, and is a breaking change.

TODOs as listed by the original issue:

  • Generating a .gitignore when markbind init is called
  • Skip .gitignore generation for the --convert flag
  • Update UG docs on this behavior
  • Add tests as necessary

Anything you'd like to highlight/discuss:

This adds a .gitignore to the default template (only).

The proposed implementation is to skip the .gitignore generation when markbind init is called with --convert flag, but in the future, there may be a need for another action (e.g. merge / overwrite). In this case, please refer to the discussions in #1782 for the rationale on why merging / overwriting may not be a good idea. Also refer to the implementation here if needed.

The original issue suggests a potential extension to generate a package.json as well.

Testing instructions:

Pull this PR and call markbind init. Check that .gitignore is generated when calling markbind init, but not when using the --convert flag.

Proposed commit message: (wrap lines at 72 characters)

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.

Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

@lhw-1 lhw-1 marked this pull request as draft March 30, 2023 01:01
@lhw-1 lhw-1 changed the title [WIP] Generate .gitignore on init command Generate .gitignore on init command Apr 3, 2023
@lhw-1 lhw-1 marked this pull request as ready for review April 3, 2023 13:22
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lhw-1 , just one clarification!

@tlylt tlylt added the breakingChange 💥 Feature will behave significantly different, or is made obsolete label Apr 6, 2023
@tlylt
Copy link
Contributor

tlylt commented Apr 6, 2023

Would be good to add a note in https://markbind-master.netlify.app/userguide/gitignorefile to explain this new behavior

@tlylt tlylt marked this pull request as draft April 6, 2023 06:19
@lhw-1
Copy link
Contributor Author

lhw-1 commented Apr 6, 2023

Would be good to add a note in https://markbind-master.netlify.app/userguide/gitignorefile to explain this new behavior

Added, and also updated the site.json page as well.

@lhw-1 lhw-1 marked this pull request as ready for review April 6, 2023 14:02
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just documentation nits!

Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @lhw-1 !

@lhw-1 lhw-1 added this to the v5.0.0 milestone Apr 8, 2023
@lhw-1 lhw-1 merged commit fc027af into MarkBind:master Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breakingChange 💥 Feature will behave significantly different, or is made obsolete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate sensible .gitignore when running markbind init

3 participants