Package: projen
projenDefine and maintain complex project configuration through code.Documentation·Changelog·Project types·Join the communityprojensynthesizes project configuration files such aspackage.json,tsconfig.json,.gitignore, GitHub Workflows, eslint, jest, etc. from a
well-typed definition written in JavaScript.As opposed to existing templating/scaffolding tools,projenis not a one-off
generator. Synthesized files should never be manually edited (in fact, projen
enforces that). To modify your project setup, users interact with rich
strongly-typed class and executeprojento update their project configuration
files.By defining a custom project type and using projen in multiple repositories, it's
possible to update configuration files and CI/CD workflows across dozens (or
hundreds!?) of projects.Check outthis talkabout projen from its creator.Getting Startedprojendoesn't need to be installed. You will be usingnpxto runprojenwhich takes care of all required setup steps.To create a new project, run the following command and follow the instructions:$mkdirmy-project$cdmy-project$npxprojennewPROJECT-TYPE🤖 Synthesizing project......Project typesCurrently supported project types (usenpx projen newwithout a type for a
full list):Built-in:(runnpx projen new <type>)awscdk-app-java- AWS CDK app in Java.awscdk-app-py- AWS CDK app in Python.awscdk-app-ts- AWS CDK app in TypeScript.awscdk-construct- AWS CDK construct library project.cdk8s-app-py- CDK8s app in Python.cdk8s-app-ts- CDK8s app in TypeScript.cdk8s-construct- CDK8s construct library project.cdktf-construct- CDKTF construct library project.java- Java project.jsii- Multi-language jsii library project.nextjs- Next.js project using JavaScript.nextjs-ts- Next.js project using TypeScript.node- Node.js project.project- Base project.python- Python project.react- React project using JavaScript.react-ts- React project using TypeScript.typescript- TypeScript project.typescript-app- TypeScript app.External:(runnpx projen new --from <type>)projen-github-action-typescript- GitHub Action in TypeScript project.Usenpx projen new PROJECT-TYPE --helpto view a list of command line
switches that allows you to specify most project options during bootstrapping.
For example:npx projen new jsii --author-name "Jerry Berry".Thenewcommand will create a.projenrc.jsfile which looks like this forjsiiprojects:const{JsiiProject}=require('projen');constproject=newJsiiProject({authorAddress:"elad.benisrael@gmail.com",authorName:"Elad Ben-Israel",name:"foobar",repository:"https://github.com/eladn/foobar.git",});project.synth();This program instantiates the project type with minimal setup, and then callssynth()to synthesize the project files. By default, thenewcommand will
also execute this program, which will result in a fully working project.Once your project is created, you can configure your project by editing.projenrc.jsand re-runningnpx projento synthesize again.The files generated byprojenare considered an "implementation detail" andprojenprotects them from being manually edited (most files are marked
read-only, and an "anti tamper" check is configured in the CI build workflow
to ensure that files are not updated during build).For example, to setup PyPI publishing injsiiprojects, you can usepublishToPypi option:constproject=newJsiiProject({// ...publishToPypi:{distName:"mydist",module:"my_module",}});Run:npxprojenAnd you'll notice that yourpackage.jsonfile now contains apythonsection in
itsjsiiconfig and the GitHubrelease.ymlworkflow includes a PyPI
publishing step.We recommend to put this in your shell profile, so you can simply runpjevery
time you update.projenrc.js:aliaspj='npx projen'Most projects come with an assortment oftasksthat handle various
development activities, from compiling to publishing. Tasks can be and composed
together, and can be run as local commands or turned into GitHub workflows. You
can list all tasks withnpx projen --help:$npxprojen--help
projen[command]Commands:projennew[PROJECT-TYPE-NAME][OPTIONS]CreatesanewprojenprojectprojenclobberhardresetstoHEADoforiginandcleansthelocalrepoprojencompileOnlycompileprojentestRuntestsprojenbuildFullreleasebuild(test+compile)projenupgradeupgradedependencies(includingprojen)...Thebuildtask is the same task that's executed in your CI builds. It
typically compiles, lints, tests and packages your module for distribution.Shell CompletionsIf installed as a global package,projenincludes rich shell tab-completion support. To enable this in your shell, run:# Bashprojencompletion>>~/.bashrc# ZSHprojencompletion>>~/.zshrcFeaturesSome examples of features built-in to project types:Fully synthesizepackage.jsonStandard npm scripts likecompile,build,test,packageeslintJestjsii: compile, package, api compatibility checks, API.mdBump & release scripts with CHANGELOG generation based on conventional commitsAutomated PR buildsAutomated releases to npm, maven, NuGet and PyPIAutomated dependency upgradesMergify configurationLICENSE file generationgitignore + npmignore managementNode "engines" support with coupling to CI build environment and @types/nodeAnti-tamper: CI builds will fail if a synthesized file is modified manuallyDocumentationFor documentation including examples and a full API reference, visithttps://projen.io/.Ecosystemprojentakes a "batteries included" approach and aims to offer dozens of different project types out of
the box (we are just getting started). Thinkprojen new react,projen new angular,projen new java-maven,projen new awscdk-typescript,projen new cdk8s-python(nothing in projen is tied to javascript or npm!)...Adding new project types is as simple as submitting a pull request to this repo and exporting a class that
extendsprojen.Project(or one of its derivatives). Projen automatically discovers project types so your
type will immediately be available inprojen new.Projects in external modulesprojenis bundled with many project types out of the box, but it can also work
with project types and components defined in external jsii modules (the reason
we need jsii is because projen uses the jsii metadata to discover project types
& options in projen new).Say we have a module in npm calledprojen-vuejswhich includes a single project
type for vue.js:$npxprojennew--fromprojen-vuejsIf the referenced module includes multiple project types, the type is required.
Switches can also be used to specify initial values based on the project type
APIs. You can also use any package syntax supported byyarn
addlikeprojen-vuejs@1.2.3,file:/path/to/local/folder,git@github.com/awesome/projen-vuejs#1.2.3, etc.$npxprojennew--fromprojen-vuejs@^2vuejs-ts--description"my awesome vue project"Under the hood,projen newwill install theprojen-vuejsmodule from npm
(version 2.0.0 and above), discover the project types in it and bootstrap thevuejs-tsproject type. It will assign the value"my awesome vue project"to
thedescriptionfield. If you examine your.projenrc.jsfile, you'll see
thatprojen-vuejsis defined as a dev dependency:const{VueJsProject}=require('projen-vuejs');constproject=newVueJsProject({name:'my-vuejs-sample',description:"my awesome vue project",// ...devDeps:['projen-vuejs']});project.synth();RoadmapSeeVision.FAQDo I have to write my configuration in JavaScript?Not at all! JavaScript is the default, but it's also possible to write it in
Java, Python, TypeScript, or even JSON. This is made
possible by thejsiilibrary which allows us
to write APIs once and generate libraries in several languages. You can choose
a different language by passing the--projenrc-ts,--projenrc-py,--projenrc-java, or--projenrc-jsonflags when runningprojen new.Note: using a.projenrc.jsonfile to specify configuration only allows
accessing a subset of the entire API - the options which are passed to the
constructor of each project type.How does projen work with my IDE?projen has an unofficialVS Code extension. Check it out!CommunityThe projen community can be found within the #projen channel in thecdk.devcommunity Slack workspace.Virtual MeetupThursday June 30, 20221-2pm America/New_York (EDT)CFPa Google FormCFP Closes Saturday April 30, 2022Hosted onZoomContributionsContributions of all kinds are welcome! Check out ourcontributor's
guideand ourcode of conduct.For a quick start, check out a development environment:$gitclonegit@github.com:projen/projen
$cdprojen
$yarn
$yarnwatch# compile in the backgroundThanks goes to these wonderful people (emoji key):Aatman💻Abdullah Sahin💻Adam💻Adam Elmore💻Adrian Dimech💻Adrian Mace💻Alejandro Lorefice💻Alexander Forsyth💻Alexander Steppke💻Amani Kilumanga💻Amin Fazl💻Amir Szekely💻Anderson Gomes💻Andre de Camargo💻Andrew Hammond💻Angelo Di Pilla💻Ansgar Mertens💻Armando J. Ortiz Garcia💻Arun Donti💻Ash💻Balagopal Kanattil💻Bart Callant💻Beau Bouchard💻Ben Limmer💻Bilal Quadri💻Boris Petersen💻Braden Mars💻Brandon Miller💻Brian Leonard💻Calvin Combs💻Cameron Childress💻Campion Fellin💻Carlos Tasada💻Chris Gatt💻Christopher Rybicki💻Cory Hall💻Court Schuett💻Craig Burdulis💻Cristian Pallarés💻Daniel Schmidt💻Danny Steenman💻Derek Kershner💻Eduardo Rodrigues💻Elad Ben-Israel💻Eli Polonsky💻Eligio Mariño💻Eric Tucker💻Eugene Cheung💻Fons Biemans💻Fynn Flügge💻Gary Sassano💻Grady Barrett💻Greg Herlein💻Gregg💻Hasan💻Hassan Azhar💻Hassan Mahmud💻Hassan Mahmud💻Heiko Rothe💻Henri Yandell💻Henry Sachs💻Hoseung💻Ikko Ashimine💻Jack Leslie💻Jack Moseley💻Jack Stevenson💻Jacob💻Jake Pearson💻Jan Brauer💻Jeff Malins💻Jeremy Jonas💻Jesse Grabowski💻JoLo💻Job de Noo💻Jonathan Goldwasser💻Joost van der Waal💻Jordan Sinko💻Joseph Egan💻Josh Kellendonk💻Juho Majasaari💻Juho Saarinen💻Julian Michel💻Kaizen Conroy💻Kenneth Winner💻Kenneth Wußmann💻Kenny Gatdula💻Konstantin Vyatkin💻Kraig Amador💻Kunal Dabir💻Kyle Laker💻Lex Felix💻Lex Felix💻Liam Johnston💻Manuel💻Marcio Cruz de Almeida💻Mark McCulloh💻Mark McCulloh💻Mark Nielsen💻Markus Schuch💻Marnix Dessing💻Martin Muller💻Martin Zuber💻Masashi Tomooka💻Matt Gucci💻Matt Martz💻Matt Wise💻Matteo Sessa💻Matthew Bonig💻Matthew Gamble💻Max Körlinge💻Mayur Mahrotri💻Mayuresh Dharwadkar💻Mike💻Mitchell Valine💻Momo Kornher💻Mukul Bansal💻Neil Kuan💻Nick Keers💻Nick Lynch💻Nicolas Byl💻Nikhil Zadoo💻Niko Virtala💻Niraj Palecha💻Nurbanu💻Pahud Hsieh💻Patrick💻Patrick Aikens💻Patrick Florek💻Philip M. Gollucci💻Philip White💻Philipp Garbe💻Rafal Wilinski💻Rami Husein💻Rico Huijbers💻Rob Giseburt💻Robbie Mackay💻Robert💻Rodrigo Farias Rezino💻Roger Chi💻Romain Marcadier💻Roman Vasilev💻Ruben Pascal Abel💻Ryan Sonshine💻Ryosuke Iwanaga💻Samuel Tschiedel💻Saud Khanzada💻Scott McFarlane💻Scott Schreckengaust💻Sebastian Korfmann💻Shawn MacIntyre💻Suhas Gaddam💻Thomas Klinger💻Thorsten Hoeger💻Tiara💻Tobias💻Tom Howard💻Tom Keller💻Tomasz Łakomy💻Travis Martensen💻Victor Korzunin💻VinayKokate22💻Vlad Cos💻Will Dady💻Yigong Liu💻Yohta Kimura💻Yuichi Kageyama💻Yuval💻andrestone💻codeLeeek💻flyingImer💻huaxk💻john-tipper💻karlderkaefer💻kmkhr💻kt-hr💻lmarsden💻michaeltimbs💻orlandronen1💻pvbouwel💻suhussai💻t0bst4r💻tHyt-lab💻txxnano💻vVahe💻zetashift💻LicenseDistributed under theApache-2.0license.