Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude *.md files from being copied over on build #1010

Merged
merged 7 commits into from
Feb 16, 2020

Conversation

yash-chowdhary
Copy link
Contributor

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [x] Bug fix

Fixes #825

What is the rationale for this request?
Prevents .md files in the _markbind/layouts directory from being copied over on building the _site. Copies over the rest of the file types.
.md do not need to be copied because they are supposed to be rendered by MarkBind.

What changes did you make? (Give an overview)
Filtered out the .md files from the list of files to be copied.

Provide some example code that this change will affect:

const filteredFiles = files.filter(file => _.includes(file, '.') && !_.includes(file, '.md'));
const copyAll = Promise.all(filteredFiles.map(file =>
    fs.copyAsync(file, layoutsDestPath + file.substring(siteLayoutPath.length))));
return copyAll.then(() => Promise.resolve());

Testing instructions:
npm run test
Test sites have been updated to reflect .md files not being copied over

Proposed commit message: (wrap lines at 72 characters)

Exclude .md files from being copied over on build

expect(fs.existsSync(path.resolve('inner/_site/markbind/layouts/default/footer.md'))).toEqual(false);
expect(fs.existsSync(path.resolve('inner/_site/markbind/layouts/default/head.md'))).toEqual(false);
expect(fs.existsSync(path.resolve('inner/_site/markbind/layouts/default/header.md'))).toEqual(false);
expect(fs.existsSync(path.resolve('inner/_site/markbind/layouts/default/navigation.md'))).toEqual(false);
Copy link
Member

Choose a reason for hiding this comment

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

I believe that these four lines can just be removed, since const expectedNumBuilt = 16; should already provide some assurance that these files cannot exist.

src/Site.js Outdated
fs.copyAsync(siteLayoutPath, layoutsDestPath)
.then(resolve)
.catch(reject);
glob(`${siteLayoutPath}/**/*`, (err, res) => {
Copy link
Member

Choose a reason for hiding this comment

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

We actually already have walk-sync which we use to walk through the files and directories. We can use that instead of using a brand new package.

@yash-chowdhary
Copy link
Contributor Author

Ready for review

@yamgent
Copy link
Member

yamgent commented Feb 15, 2020

@yash-chowdhary will need you to resolve the conflicts first, apologies for the delay.

@yash-chowdhary
Copy link
Contributor Author

Done 👍

@yamgent yamgent added this to the v2.10.1 milestone Feb 16, 2020
@yamgent yamgent merged commit 3a91923 into MarkBind:master Feb 16, 2020
Tejas2805 added a commit to Tejas2805/markbind that referenced this pull request Feb 27, 2020
* 'master' of https://github.com/MarkBind/markbind:
  Update tests
  Allow using 'none' footer attribute in frontmatter (MarkBind#1002)
  Support line numbers for code blocks (MarkBind#991)
  2.11.0
  Update test files due to changes in PR MarkBind#982
  Update vue-strap version to v2.0.1-markbind.36
  Make highlighting bold (MarkBind#1045)
  Support markdown for header attr in dropdown (MarkBind#1029)
  Add '_site' to the ignored folders in site.json (MarkBind#1046)
  Use path.join instead of string interpolation (MarkBind#1052)
  Implement box markdown header attributes parsing (MarkBind#1025)
  Make the position of top navbar fixed (MarkBind#982)
  Exclude *.md files from being copied over on build (MarkBind#1010)

# Conflicts:
#	docs/css/main.css
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.

Layouts should not have *.md files copied on build
2 participants