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

Feat: use cookiecutter #4

Merged
merged 12 commits into from
Nov 10, 2020
Merged

Feat: use cookiecutter #4

merged 12 commits into from
Nov 10, 2020

Conversation

erezrokah
Copy link
Contributor

@erezrokah erezrokah commented Nov 8, 2020

You can test this branch by running cookiecutter gh:netlify/node-template --checkout feat/use_cookiecutter once you install cookiecutter.

We can further automate using https://cli.github.com/manual/gh_repo_create

TODO:

  • Add contributing guide for the parent repo (not the generated template)

@erezrokah erezrokah added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Nov 8, 2020
@@ -35,4 +35,4 @@ jobs:
- name: Tests
run: npm run test:ci
- name: Codecov test coverage
run: bash scripts/coverage.sh "${{ matrix.os }}" "${{ matrix.node-version }}"
run: npm run test:report:coverage "${{ matrix.os }}" "${{ matrix.node-version }}"
Copy link
Contributor

@ehmicky ehmicky Nov 9, 2020

Choose a reason for hiding this comment

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

Good call 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved by ff887c8

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use the new test coverage setup?
See netlify/cli#1542

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, going to update this soon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 6f25f9f

@ehmicky
Copy link
Contributor

ehmicky commented Nov 9, 2020

This is a good idea @erezrokah!
I did not know cookiecutter. How does it compare with yo?

I have been re-inventing the wheel in build-plugin-template implementing what this type of tool is actually doing in using a npm run init task. Would it be useful to use such tool there as well?

@erezrokah
Copy link
Contributor Author

I did not know cookiecutter. How does it compare with yo?

I'm not familiar with yo but it seems like the barrier to write a template is higher:
https://yeoman.io/authoring/index.html

I have been re-inventing the wheel in build-plugin-template implementing what this type of tool is actually doing in using a npm run init task. Would it be useful to use such tool there as well?

Yes, I completely missed that when I used build-plugin-template.
Only downside is that plugin authors would need to install a new tool

@erezrokah erezrokah marked this pull request as ready for review November 9, 2020 14:18
@erezrokah erezrokah force-pushed the feat/use_cookiecutter branch from 78c5941 to ebc3d11 Compare November 9, 2020 14:23
@ehmicky
Copy link
Contributor

ehmicky commented Nov 9, 2020

Only downside is that plugin authors would need to install a new tool

Would a Node.js based templating generator be better in this case? So people can just npx it.
I did not realize cookiecutter would need to be installed separately.

@erezrokah
Copy link
Contributor Author

Would a Node.js based templating generator be better in this case? So people can just npx it.

If we can find a good one yes.

@ehmicky
Copy link
Contributor

ehmicky commented Nov 9, 2020

What do you think of hygen?

@erezrokah
Copy link
Contributor Author

What do you think of hygen?

Seems like it works best for specific files (e.g. we would need a template for README.md and another for package.json, and less at the repo level. Also it requires custom syntax (markdown and ejs).

All we need is a utility that wraps strings replacements in a CLI. cookiecutter does that very well and it is very easy to reason about (just add a template variable in any file, making it very easy to take a specific file and make it a generic file).

@ehmicky
Copy link
Contributor

ehmicky commented Nov 10, 2020

Yes, that's definitely a simpler approach, better for our use case.
However, I do think having to install/update this dependency using pip for non-Python developers (like myself) is not optimal. Also, the version of cookiecutter would be left unspecified (unless we add a requirements.txt), which might break things on major releases of cookiecutter.
That being said, there does not seem to be a perfect solution, so let's go with it if you think this is best 👍

@erezrokah erezrokah force-pushed the feat/use_cookiecutter branch from 5f36e1d to bea4b0f Compare November 10, 2020 17:54
@erezrokah erezrokah merged commit ca68a42 into master Nov 10, 2020
@erezrokah erezrokah deleted the feat/use_cookiecutter branch November 10, 2020 17:55
@ehmicky
Copy link
Contributor

ehmicky commented Nov 10, 2020

Should we add an issue to this in build-plugin-template too?

@erezrokah
Copy link
Contributor Author

should we add an issue to this in build-plugin-template too?

See netlify/build-plugin-template#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants