Scaffolding tools for creating and maintaining projects based on Twitter Open Source standards and best practices. The project has 3 parts -
- Cookiecutter template to generate Twitter OSS policy files e.g. LICENSE, CONTRIBUTING, etc.
- Script to add License headers to all source files in a project
- Lint a repository for common missing files (repolinter)
A cookiecutter template to generate necessary files for a Twitter Open Source project.
Install cookiecutter command line: pip install cookiecutter
pip is the package manager for Python.
Note: cookiecutter can be installed with both pip and pip3.
Run cookiecutter against this repository.
cookiecutter https://github.com/twitter/repo-scaffolding
or
cookiecutter gh:twitter/repo-scaffolding
or
You can also run it locally after cloning this repository:
cookiecutter /path/to/directory/
See documentation for more usage instructions.
See cookiecutter.json for all the variables required as input. Here is the list of places they are used
author_full_name: 1 time inREADME.mdin theAuthorssection.author_email: 1 time inREADME.mdin theAuthorssectionproject_slug: 1 time inREADME.mdand also for the name of the parent directorygithub_repo_url: 2 times inREADME.mdand 4 times inCONTRIBUTING.mdfor the GitHub repo linksshort_description: 1 time inREADME.mdproject_homepage: 1 time inREADME.mddocumentation_homepage: 1 time inREADME.mdmailing_list: 1 time inREADME.mdrelease_year: 1 time inLICENSEand 1 time inREADME.md
- Make sure to update the
TODOsections inREADME.mdandCONTRIBUTING.mdafter generating the files
All source files must have a license header at the top. If you need to add headers to a lot of files, we recommend using the google/addlicense tool.
Download the latest release for your operating system,
and place the binary someone in your shell path (like /usr/local/bin/).
Alternately, follow the instructions for running with Docker.
First, check to see which files addlicense would add headers to:
$ cd <path_to_source_dir>
$ addlicense -check .
If that looks right, add the appropriate Twitter headers:
$ addlicense -c "Twitter, Inc." -l "Apache-2.0" -s=only .
If you have third-party source in a vendor or node_modules directory, you
can ignore those with the -ignore flag to addlicense.
Lint all the necessary files in the project. - Project Homepage
- To run against a directory, use
npx repolinter /my/code/dir - To run against a git repository, use the --git option:
npx repolinter --git https://my.git.code/awesome - Note, if you are running a version of npm < 5.2.0, run
npm install npxfirst.
- TwitterOSS <opensource [at] twitter [dot] com>
Follow @TwitterOSS on Twitter for updates.