Skip to content

Commit

Permalink
chore: Publish Workflow and other Github enhancements (#308)
Browse files Browse the repository at this point in the history
* chore: switch standard-version to changeset

* chore: add version workflow

* chore: issue forms and pr labeler

* chore: prettier

* chore: add missing credit

* chore: adjust some commands

* chore: update contributing guidelines

* chore: prettier

* chore: adjustments

* feat: add minimal ts-linter

* fix: lint warnings

* revert eslinter
  • Loading branch information
juliusmarminge authored Aug 15, 2022
1 parent bd1819d commit ad53911
Show file tree
Hide file tree
Showing 19 changed files with 852 additions and 511 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
22 changes: 0 additions & 22 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 🐞 Bug Report
description: Create a bug report to help us improve
title: "bug: "
labels: ["unconfirmed bug"]
body:
- type: textarea
attributes:
label: Provide environment information
description: |
Run this command in your project root and paste the results:
```bash
npx envinfo --system --binaries
```
If the issue is regarding a scaffolded app, please include the version used to scaffold that app which you can find in the `package.json` under `ct3aMetadata.initVersion`.
validations:
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and consice description of the bug, as well as what you expected to happen when encountering it.
validations:
required: true
- type: textarea
attributes:
label: To reproduce
description: Describe how to reproduce your bug. Steps, code snippets, reproduction repos etc.
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: Add any other information related to the bug here, screenshots if applicable.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
16 changes: 0 additions & 16 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 🧑‍💻 Feature Request
description: Suggest an idea for this project
title: "feat: "
labels: ["enhancement"]
body:
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like to see
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Desribe alternate solutions
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: Add any other information related to the feature here. If your feature request is related to any issues or discussions, link them here.
12 changes: 12 additions & 0 deletions .github/changeset-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
// https://github.com/cloudflare/wrangler2/blob/main/.github/changeset-version.js

const { execSync } = require("node:child_process");

// This script is used by the `release.yml` workflow to update the version of the packages being released.
// The standard step is only to run `changeset version` but this does not update the package-lock.json file.
// So we also run `npm install`, which does this update.
// This is a workaround until this is handled automatically by `changeset version`.
// See https://github.com/changesets/changesets/issues/421.
execSync("npx changeset version");
execSync("npm install");
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"area: cli":
- any: ["src/**"]

"area: t3-app":
- any: ["template/**"]
9 changes: 6 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# [Short title]
Closes #<issue>

## ✅ Checklist

- [ ] I reviewed linter warnings + errors, resolved formatting, types and other issues related to my work
- [ ] The PR title follows the convention we established [conventional-commit](https://www.conventionalcommits.org/en/v1.0.0/)
- [ ] I performed a functional test on my final commit

---

_[Short summary/description of story/feature/bugfix]_
## Changelog

_[Short description of what has changed]_

---

Expand Down
24 changes: 24 additions & 0 deletions .github/version-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
// https://github.com/cloudflare/wrangler2/blob/main/.github/version-script.js

const fs = require("fs");
const { exec } = require("child_process");

try {
const package = JSON.parse(fs.readFileSync("package.json"));
exec("git rev-parse --short HEAD", (err, stdout) => {
if (err) {
console.log(err);
process.exit(1);
}
// Version has to supersede the currently available version
package.version = "5.5.0-" + stdout.trim();
fs.writeFileSync(
"package.json",
JSON.stringify(package, null, "\t") + "\n",
);
});
} catch (error) {
console.error(error);
process.exit(1);
}
2 changes: 1 addition & 1 deletion .github/workflows/PR-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
- run: pnpm lint:check
- run: pnpm lint

lint-pr:
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
39 changes: 39 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Prerelease

on:
push:
branches:
- main
jobs:
prerelease:
if: ${{ github.repository_owner == 't3-oss' }}
name: Build & Publish a beta release to NPM
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use PNPM
uses: pnpm/[email protected]
with:
version: 7.2.1

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"

- name: Install NPM Dependencies
run: pnpm install

- name: Modify package.json version
run: node .github/version-script.js

- name: Publish Beta to NPM
run: pnpm pub:beta
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
86 changes: 68 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,88 @@
# Contribution Guidelines

When contributing to `create-t3-app` whether on GitHub or in other community spaces:
When contributing to `create-t3-app`, whether on GitHub or in other community spaces:

- Be respectful, civil, and open-minded.
- Before opening a new pull request, try searching through the [issue tracker](https://github.com/nexxeln/create-t3-app/issues) for known issues or fixes.

## How to Contribute

1. [Open an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) and describe the problem.
2. [Fork this repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) to your own GitHub account, then [clone the repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) to your machine.
3. Follow the [README](https://github.com/nexxeln/create-t3-app#readme) to install the project.
4. Create a new branch and implement your changes.
### Prerequisites

> Note: We use `commitlint` to autoupdate the changelog and versioning.
>
> - Make sure you follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines when making commits.
> - Do not manually update the [changelog](./CHANGELOG.md) and version in the [package.json](./package.json).
In order to not waste your time implementing changes that has already been declined, or is generally not needed, start by [opening an issue](https://github.com/t3-oss/create-t3-app/issues/new/choose) describing the problem you would like to solve.

5. Open a pull request! All pull requests must be made to the `main` branch.
### Setup your environment

## Contributor Development Setup
_Some commands will assume you have the Github CLI installed, if you haven't, consider [installing it](https://github.com/cli/cli#installation), but you can always use the Web UI if you prefer that instead._

In order to contribute to this project, you will need to fork the repository:

```bash
gh repo fork t3-oss/create-t3-app
```

then, clone it to your local machine:

```bash
gh repo clone <your-github-name>/create-t3-app
```

This project uses [pnpm](https://pnpm.io) as its package manager. Install it if you haven't already:

```bash
# Install pnpm
npm install -g pnpm
```

# Install dependencies
Then, install the project's dependencies:

```bash
pnpm install
```

### Implement your changes

Now you're all setup and can start implementing your changes.

When you want to test your changes, run:

```bash
pnpm dev
```

# Initial build
pnpm run build
which will build and start the CLI.

# Start the package locally
pnpm start
When making commits, make sure to follow the [convential commit](https://www.conventionalcommits.org/en/v1.0.0/) guidelines, i.e. prepending the message with `feat:`, `fix:`, `chore:` etc...

### When you're done

Check that your code follows the project's style guidelines by running:

```bash
pnpm check
```

Please also make a manual, functional test of your changes.

If your change should appear in the changelog, i.e. it changes some behavior of either the CLI or the outputted application, it must be captured by `changeset` which is done by running

```bash
pnpm changeset
```

This contribution guide is inspired by the [Next.js contribution guide.](https://github.com/vercel/next.js/blob/canary/contributing.md)
and filling out the form with the appropriate information. Then, add the generated changeset to git:

```bash
git add ./changeset/*.md && git commit -m "chore: add changeset"
```

When all that's done, it's time to file a pull request to upstream:

```bash
gh pr create --web
```

and fill out the title and body appropriately. Again, make sure to follow the [convential commit](https://www.conventionalcommits.org/en/v1.0.0/) guidelines for your title.

## Credits

This documented was inspired by the contributing guidelines for [cloudflare/wrangler2](https://github.com/cloudflare/wrangler2/blob/main/CONTRIBUTING.md).
Loading

0 comments on commit ad53911

Please sign in to comment.