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

Added Feature: Build all .abell files from source #12

Merged
merged 11 commits into from
May 18, 2020

Conversation

akash-joshi
Copy link
Contributor

@akash-joshi akash-joshi commented May 17, 2020

Fixes #8

Allows building of all .abell files in the source folder.

Copy link
Member

@saurabhdaware saurabhdaware left a comment

Choose a reason for hiding this comment

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

Hi Akash, This looks great! Thank you so much🐨🎉 I just request some changes in the comments. Also if there is any way to roll back the prettier changes? That would make the PR a little less bloated. It's fine if it is too complicated we can leave it like this.

EDIT: I guess prettier changes are fine, Just changing the ones mentioned below would work.

src/action.js Outdated
if (programInfo.logs == 'minimum') console.log(`${boldGreen('>>>')} Files built.. ✨`);
}
// GENERATE OTHER HTML FILES FROM ABELL
abellFiles.map((file) => {
Copy link
Member

Choose a reason for hiding this comment

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

I guess you meant to do .forEach here. .map is supposed to be use when you want to return something.

Also, if it is a plain array then I will suggest for (const file of abellFiles) {} instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this ✅

Copy link
Member

Choose a reason for hiding this comment

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

Can you check this once again? I guess this isn't resolved

src/action.js Show resolved Hide resolved
src/helpers.js Outdated
const files = inputFiles || fs.readdirSync(base);
let result = inputResult || [];

files.map(function(file) {
Copy link
Member

Choose a reason for hiding this comment

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

This too can be done with for (const file of files) {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this ✅

src/helpers.js Outdated
Comment on lines 81 to 84
throw new Error(
`Something went wrong while fetching new configurations.
Save again to refresh the dev server.`
); // eslint-disable-line
Copy link
Member

Choose a reason for hiding this comment

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

This will add an extra line break in terminal too I guess, since it is using ` for strings. Writing it in single line is fine since it is just an error message and not an important code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This won't add a new line unless a \n is added there. I split that line because eslint was complaining of the line being too long. Do you have any suggestions for that ?

Copy link
Member

@saurabhdaware saurabhdaware May 17, 2020

Choose a reason for hiding this comment

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

image
It actually does. In JavaScript when you use '`' for strings, it keeps the line breaks and additional spaces. This is one of the reasons why I had // eslint-disable-line their to disable the eslint error. And in case of strings it's fine if it crosses the line length limit because the workaround of adding \n to satisfy eslint is more unreadable than having long horizontal line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this ✅

src/helpers.js Outdated

// Returns all .abell files in src folder except for [$slug]
const getAbellFiles = (sourcePath, extension) => {
const absolutePaths = recFindByExt(sourcePath, extension.split('.')[1]);
Copy link
Member

Choose a reason for hiding this comment

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

The right way to find an extension would be using path.extname(sourcePath) in nodejs. This code can break when you have a file something like abell.config.js where index 1 would have 'config' instead of 'js'

Copy link
Contributor Author

@akash-joshi akash-joshi May 18, 2020

Choose a reason for hiding this comment

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

I agree with path.extname there. But I would still have to split on . after getting the extension, because the function I added expects an extension without a .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But actually, this extension is passed from programInfo, so wouldn't we explicitly want to get those files if we're passing .abell.config.js as an extension ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nvm, I refactored the code so extension is passed with a . in it, and the function handles the . correctly. So no splitting or path.extname needed.

Copy link
Member

Choose a reason for hiding this comment

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

Nvm, I refactored the code so extension is passed with a . in it, and the function handles the . correctly. So no splitting or path.extname needed.

This sounds a lot better! thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is refactored

@akash-joshi
Copy link
Contributor Author

Hey @saurabhdaware please check out the latest commit. Hopefully it follows your coding style.

@saurabhdaware
Copy link
Member

Hey @saurabhdaware please check out the latest commit. Hopefully it follows your coding style.

Hi, Akash looking great! I guess two of the changes are not resolved yet, it can you check them out? Thanks

@saurabhdaware saurabhdaware self-requested a review May 18, 2020 06:32
Copy link
Member

@saurabhdaware saurabhdaware left a comment

Choose a reason for hiding this comment

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

Perfect! Thank you so much @akash-joshi

@saurabhdaware saurabhdaware merged commit 2c6dcf1 into abelljs:master May 18, 2020
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.

Build all .abell files from src
2 participants