[![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-37-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/projen/projen)
![Build](https://github.com/projen/projen/workflows/Build/badge.svg)
![Release](https://github.com/projen/projen/workflows/Release/badge.svg)
# projen
![projen logo](/logo/projen.svg)
Define and maintain complex project configuration through code.
> JOIN THE [#TemplatesAreEvil](https://twitter.com/search?q=%23TemplatesAreEvil) MOVEMENT!
*projen* synthesizes project configuration files such as `package.json`,
`tsconfig.json`, `.gitignore`, GitHub Workflows, eslint, jest, etc from a
well-typed definition written in JavaScript.
Check out [this talk](https://youtu.be/SOWMPzXtTCw) about projen.
As opposed to existing templating/scaffolding tools, *projen* is 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 execute `projen` to update their project configuration
files.
## Getting Started
To create a new project, run the following command and follow the instructions:
```console
$ mkdir my-project
$ cd my-project
$ git init
$ npx projen new PROJECT-TYPE
ð¤ Synthesizing project...
...
```
Currently supported project types (use `npx projen new` without a type for a
list):
<!-- <macro exec="node ./scripts/readme-projects.js"> -->
* [awscdk-app-ts](https://github.com/projen/projen/blob/master/API.md#projen-awscdktypescriptapp) - AWS CDK app in TypeScript.
* [awscdk-construct](https://github.com/projen/projen/blob/master/API.md#projen-awscdkconstructlibrary) - AWS CDK construct library project.
* [cdk8s-construct](https://github.com/projen/projen/blob/master/API.md#projen-constructlibrarycdk8s) - CDK8s construct library project.
* [java](https://github.com/projen/projen/blob/master/API.md#projen-java.javaproject) - Java project.
* [jsii](https://github.com/projen/projen/blob/master/API.md#projen-jsiiproject) - Multi-language jsii library project.
* [nextjs](https://github.com/projen/projen/blob/master/API.md#projen-web.nextjsproject) - Next.js project without TypeScript.
* [nextjs-ts](https://github.com/projen/projen/blob/master/API.md#projen-web.nextjstypescriptproject) - Next.js project with TypeScript.
* [node](https://github.com/projen/projen/blob/master/API.md#projen-nodeproject) - Node.js project.
* [project](https://github.com/projen/projen/blob/master/API.md#projen-project) - Base project.
* [python](https://github.com/projen/projen/blob/master/API.md#projen-python.pythonproject) - Python project.
* [react](https://github.com/projen/projen/blob/master/API.md#projen-web.reactproject) - React project without TypeScript.
* [react-ts](https://github.com/projen/projen/blob/master/API.md#projen-web.reacttypescriptproject) - React project with TypeScript.
* [typescript](https://github.com/projen/projen/blob/master/API.md#projen-typescriptproject) - TypeScript project.
* [typescript-app](https://github.com/projen/projen/blob/master/API.md#projen-typescriptappproject) - TypeScript app.
<!-- </macro> -->
> Use `npx projen new PROJECT-TYPE --help` to 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"`.
The `new` command will create a `.projenrc.js` file which looks like this for
`jsii` projects:
```js
const { JsiiProject } = require('projen');
const project = new JsiiProject({
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 calls
`synth()` to synthesize the project files. By default, the `new` command 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.js` and re-running `npx projen` to synthesize again.
> The files generated by *projen* are considered an "implementation detail" and
> *projen* protects 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 in `jsii` projects, you can use
[`python option`](https://github.com/eladb/projen/blob/master/API.md#projen-jsiipythontarget):
```js
const project = new JsiiProject({
// ...
python: {
distName: "mydist",
module: "my_module",
}
});
```
Run:
```shell
npx projen
```
And you'll notice that your `package.json` file now contains a `python` section in
it's `jsii` config and the GitHub `release.yml` workflow includes a PyPI
publishing step.
We recommend to put this in your shell profile, so you can simply run `pj` every
time you update `.projenrc.js`:
```bash
alias pj='npx projen'
```
Most projects support a `start` command which displays a menu of workflow
activities:
```shell
$ yarn start
? Scripts: (Use arrow keys)
BUILD
⯠compile Only compile
watch Watch & compile in the background
build Full release build (test+compile)
TEST
test Run tests
test:watch Run jest in watch mode
eslint Runs eslint against the codebase
...
```
The `build` command is the same command that's executed in your CI builds. It
typically compiles, lints, tests and packages your module for distribution.
## Features
Some examples for features built-in to project types:
* Fully synthesize `package.json`
* Standard npm scripts like `compile`, `build`, `test`, `package`
* eslint
* Jest
* jsii: compile, package, api compatibility checks, API.md
* Bump & release scripts with CHANGELOG generation based on Conventional Commits
* Automated PR builds
* Automated releases to npm, maven, NuGet and PyPI
* Mergify configuration
* LICENSE file generation
* gitignore + npmignore management
* Node "engines" support with coupling to CI build environment and @types/node
* Anti-tamper: CI builds will fail if a synthesized file is modified manually
## API Reference
See [API Reference](./API.md) for API details.
In addition, several projen components and project types are explained with examples in [/docs](./docs) (currently a work in progress!).
## Ecosystem
*projen* takes a "batteries included" approach and aims to offer dozens of different project types out of
the box (we are just getting started). Think `projen 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
extends `projen.Project` (or one of it's derivatives). Projen automatically discovers project types so your
type will immediately be available in `projen new`.
### Projects in external modules
*projen* is 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 called `projen-vuejs` which includes a single project
type for vue.js:
```bash
$ npx projen new --from projen-vuejs
```
If the referenced module includes multiple project types, the type is required.
Switches can also be used to specify initial value
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共23个文件
py:10个
txt:4个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:projen-0.17.13.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
projen-0.17.13.tar.gz (23个子文件)
projen-0.17.13
MANIFEST.in 23B
PKG-INFO 24KB
pyproject.toml 106B
src
projen
py.typed 1B
_jsii
bin
projen 223B
__init__.py 303B
projen@0.17.13.jsii.tgz 3.41MB
tasks
__init__.py 38KB
deps
__init__.py 12KB
python
__init__.py 100KB
vscode
__init__.py 25KB
__init__.py 1.4MB
java
__init__.py 79KB
web
__init__.py 409KB
github
__init__.py 28KB
projen.egg-info
PKG-INFO 24KB
requires.txt 39B
SOURCES.txt 557B
top_level.txt 7B
dependency_links.txt 1B
setup.cfg 38B
setup.py 2KB
README.md 20KB
共 23 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功