Skip to content

Refactor constants to a separate file#949

Merged
yamgent merged 3 commits into
MarkBind:masterfrom
yash-chowdhary:constants
Dec 10, 2019
Merged

Refactor constants to a separate file#949
yamgent merged 3 commits into
MarkBind:masterfrom
yash-chowdhary:constants

Conversation

@yash-chowdhary

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

• [x] Other: Refactoring constants into a separate file.

Fixes #597

What is the rationale for this request?
Currently, there are multiple occurrences of the same constant across multiple files e.g. LAYOUT_FOLDER_PATH. This PR addresses this issue by keeping all constants in a single file.

What changes did you make?
Moved all constants in functional code to a new file - src/constants.js.

Provide some example code that this change will affect:

module.exports = {
  // index.js
  ACCEPTED_COMMANDS: ['init', 'build', 'serve', 'deploy'],
  ACCEPTED_COMMANDS_ALIAS: ['i', 'b', 's', 'd'],

  // src/Page.js
  FOOTERS_FOLDER_PATH: '_markbind/footers',
  HEAD_FOLDER_PATH: '_markbind/head',
  ...
  ...
}

Proposed commit message: (wrap lines at 72 characters)
Refactor constants to a separate file

@acjh acjh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Yash, thanks for your PR.

I've left a comment about separating constants in MarkBind core library from MarkBind CLI, and a few comments about consistency.

Comment thread src/lib/markbind/src/parser.js Outdated
Comment thread src/constants.js Outdated
Comment thread src/constants.js Outdated
Comment thread index.js Outdated
Comment thread src/lib/markbind/src/constants.js Outdated
Comment thread src/lib/markbind/src/constants.js Outdated
@yamgent yamgent merged commit ef5153c into MarkBind:master Dec 10, 2019
@yamgent yamgent added this to the v2.7.1 milestone Dec 14, 2019
@tlylt tlylt mentioned this pull request Aug 3, 2022
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce replication of constants

3 participants