schematics
schematics copied to clipboard
feat: gitignore file as template within npm publish content
PR Checklist
Please check if your PR fulfills the following requirements:
- [ X ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
Previously it was not possible to publish the gitignore file as npm has a black list files which will not be part of distribution. Now with renamed to be .template.gitignore and renaming action added to the application factory will allow the gitignore file to be part of the template.
This PR not only allows gitignore files but any file that the npm black list can be just renamed to .template.nameofile and the renaming action will recursively replace all names when creating the application template through the schematics but uploaded as the template name.
- [ ] Bugfix
- [ X ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
Currently blacklisted files of npm like .gitignore cannot be published through the schematics. Currently this is solved through the nest-cli project by creating a sample .gitignore file through cli.
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
- [ ] Yes
- [ X ] No
Other information
Yep, We can drop the change and also remove the function createGitIgnoreFile in line https://github.com/nestjs/nest-cli/blob/4a948c935b5b077598b54803f1eef2f4c8cbf24b/actions/new.action.ts#L59 as gitignore will be available through the template itself.
If we don't want to remove the createGitIgnore function the above change needs to stay as this pull request will be useless. the above change was introduced to fix the problem. The problem was that the function would override any content of the gitignore file provided through the template.