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

Add inferred name attribute to default package.json #188

Merged
merged 3 commits into from
Nov 23, 2020

Conversation

ayushn21
Copy link
Member

This is a πŸ™‹ feature or enhancement.

βœ… I've added tests (if it's a bug, feature or enhancement)
βœ… The test suite passes locally (run script/cibuild to verify this)

Summary

When we create a new Bridgetown site, the default package.json has a name attribute of bridgetown-new-site.

I thought it would be a nicer developer experience if this name could be inferred from the path entered into the new command. So this change takes the last path component of the input path and sets that as the name in package.json.

@ayushn21 ayushn21 changed the title Add inferred name to package Add inferred name attribute to default package.json Nov 21, 2020
@ayushn21 ayushn21 force-pushed the add-inferred-name-to-package branch 2 times, most recently from d3e1a85 to 59d747a Compare November 21, 2020 22:06
@ayushn21 ayushn21 force-pushed the add-inferred-name-to-package branch from 59d747a to e0f065d Compare November 21, 2020 22:08
Copy link
Contributor

@andrewmcodes andrewmcodes left a comment

Choose a reason for hiding this comment

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

πŸ‘ I've been meaning to do this! Love it!

@@ -60,7 +60,7 @@ def site_template_source
static_template_files = dir_contents(site_template).reject do |f|
File.extname(f) == ".erb"
end
static_template_files << "/Gemfile"
static_template_files.push "/Gemfile", "/package.json"
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely prefer your solution but fun fact:

static_template_files = []
=> []
static_template_files << "/Gemfile" << "/package.json"
=> ["/Gemfile", "/package.json"]

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah nice, cheers! Didn't know that was valid syntax :)

@jaredcwhite
Copy link
Member

Thanks @ayushn21! This is a great enhancement. πŸ‘

@jaredcwhite jaredcwhite merged commit d03dc3c into bridgetownrb:main Nov 23, 2020
@ayushn21 ayushn21 deleted the add-inferred-name-to-package branch November 23, 2020 15:41
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.

3 participants