Skip to content

Commit

Permalink
Remove release preset (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored Dec 16, 2022
1 parent c8b6d8d commit f6ef551
Show file tree
Hide file tree
Showing 19 changed files with 738 additions and 2,607 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)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "sumup-oss/foundry" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "minor",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/hip-poems-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup/foundry': major
---

Removed the `release` preset and the `semantic-release` config. We recommend [`changesets`](https://github.com/changesets/changesets) as a more flexible alternative.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ on: [push]
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 18]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js v16
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: ${{ matrix.node }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -37,8 +40,11 @@ jobs:
uses: codecov/codecov-action@v1.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish to NPM
- name: Create release PR or publish to npm
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/canary') && matrix.node == 18
uses: changesets/action@master
with:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release
16 changes: 0 additions & 16 deletions .releaserc.js

This file was deleted.

1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Foundry uses [`semantic-release`](https://github.com/semantic-release/semantic-release) to automatically publish [GitHub release notes](https://github.com/sumup-oss/foundry/releases) for each version.
63 changes: 50 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ If you feel another member of the community violated our CoC or you are experien

1. Check existing issues and verify that your issue is not already submitted. If a similar issue already exists, we highly recommend to add your report to that issue.
2. Open issue
3. Be as detailed as possible - include the `node` version, what you did, what you expected to happen, and what actually happened.
3. Be as detailed as possible - include the Node version, what you did, what you expected to happen, and what actually happened.

### Submitting a PR

_Before you get started, make sure you have [Node](https://nodejs.org/en/) v16+ and the [Yarn CLI](https://yarnpkg.com/en/docs/install) installed on your computer._

1. Find an existing issue to work on or follow `Submitting an issue` to create one that you're also going to fix. Make sure to notify that you're working on a fix for the issue you picked.
2. Branch out from latest `main`.
3. Code, add, commit and push your changes in your branch.
4. Make sure that tests and linter(s) pass locally for you.
5. Submit a PR.
6. Collaborate with the codeowners/reviewers to merge this to `main`.

### Development

Expand All @@ -29,19 +40,45 @@ For development and local testing we recommend the following.

Refer to the [Yarn docs](https://classic.yarnpkg.com/en/docs/cli/link#search) to learn more about linking local dependencies.

### Submitting a PR
## Release process

_Before you get started, make sure you have [Node](https://nodejs.org/en/) v16+ and the [Yarn CLI](https://yarnpkg.com/en/docs/install) installed on your computer._
Foundry follows semantic versioning. In short, this means we use patch versions for bugfixes, minor versions for new features, and major versions for breaking changes.

1. Find an existing issue to work on or follow `Submitting an issue` to create one that you're also going to fix. Make sure to notify that you're working on a fix for the issue you picked.
2. Branch out from latest `main`.
3. Code, add, commit and push your changes in your branch.
4. Make sure that tests and linter(s) pass locally for you.
5. Submit a PR.
6. Collaborate with the codeowners/reviewers to merge this to `main`.
### Changesets

Foundry uses [changesets](https://github.com/atlassian/changesets) to do versioning. A changeset is a piece of information about changes made in a branch or commit. It holds three bits of information:

- What needs to be released
- What version the packages should be released at (using a [semver bump type](https://semver.org/))
- A changelog entry for the released packages

Refer to the [official documentation](https://github.com/atlassian/changesets/blob/main/docs/adding-a-changeset.md#i-am-in-a-multi-package-repository-a-mono-repo) for more information.

### Release branches

We have a couple of special branches that are used for stable releases and [pre-releases](#pre-releases).

- **`main`** - The code in the `main` branch is stable and production-tested. When a PR is merged to `main` that contains a new changeset, `changesets` opens a PR and keeps it up to date with the latest changes. When the PR is merged, a new version is automatically published to NPM and the changesets since the last release are added to `CHANGELOG.md` files in GitHub.
- **`canary`** - This is a branch you can use to publish a prerelease version if you need to deploy the changes somewhere to test them. `canary` is a throw-away branch that can be recreated from `main` at any time. **Hint**: If you only need to test your changes locally, you can use `yarn add ./path-to-foundry` to link the development version.
- **`next`** — This branch is used to develop the next major version in parallel. It is the only branch that can contain breaking changes.

To install the most recent version from a release channel in your project, run:

```sh
yarn add @sumup/foundry@<release-channel>
```

#### Pre-releases

Pre-releases can be done for either the `next` or the `canary` release channels.

To publish a pre-release version, check out on the branch for your release channel and run the `changesets pre enter` command:

```sh
git checkout next # or `canary`
yarn changeset pre enter next # or `canary`
```

## Common commands
This will generate a `pre.json` file in the `.changeset` directory.

- Continuously transpile the code: `yarn dev`
- Continuously run the tests: `yarn test`
- Run the linter: `yarn lint`
Push it to the branch, then verify and merge the `changesets` "Version Packages" PR for your release channel. `changesets` will publish the pre-release version in CI.
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![NPM version](https://img.shields.io/npm/v/@sumup/foundry)](https://www.npmjs.com/package/@sumup/foundry) [![Code coverage](https://img.shields.io/codecov/c/github/sumup-oss/foundry)](https://codecov.io/gh/sumup-oss/foundry) [![License](https://img.shields.io/github/license/sumup-oss/foundry)](https://github.com/sumup-oss/foundry/blob/main/LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)

A toolkit that makes it a breeze to set up and maintain JavaScript + TypeScript applications. Foundry has presets for [🔍 linting](#-lint), [🚀 releasing](#-release), and [🤖 continuous integration (CI)](#-continuous-integration-ci), and currently supports [Next.js](https://nextjs.org), [React](https://reactjs.org), [Emotion](https://emotion.sh/), [Jest](https://jestjs.io/), [Testing Library](https://testing-library.com/), [Cypress](https://www.cypress.io/), [Playwright](https://playwright.dev/) and [Node](https://nodejs.org/en/).
A toolkit that makes it a breeze to set up and maintain JavaScript + TypeScript applications. Foundry has presets for [🔍 linting](#-lint) and [🤖 continuous integration (CI)](#-continuous-integration-ci), and currently supports [Next.js](https://nextjs.org), [React](https://reactjs.org), [Emotion](https://emotion.sh/), [Jest](https://jestjs.io/), [Testing Library](https://testing-library.com/), [Cypress](https://www.cypress.io/), [Playwright](https://playwright.dev/) and [Node](https://nodejs.org/en/).

</div>

Expand All @@ -16,7 +16,6 @@ A toolkit that makes it a breeze to set up and maintain JavaScript + TypeScript
- [Configuration](#configuration)
- [Presets](#presets)
- [🔍 Lint](#-lint)
- [🚀 Release](#-release)
- [🤖 Continuous Integration (CI)](#-continuous-integration-ci)
- [Running a tool](#running-a-tool)
- [Why?](#why)
Expand Down Expand Up @@ -57,7 +56,7 @@ Alternatively, you can pass your answers to the `init` command directly as flags

```sh
-p, --presets A preset configures a group of tools that solve a common
problem [array] [choices: "lint", "release", "ci"]
problem [array] [choices: "lint", "ci"]
-o, --openSource Whether the project is open-source [boolean]
--publish Whether to publish to NPM [boolean]
-c, --configDir The directory to write configs to [string] [default: "."]
Expand Down Expand Up @@ -124,16 +123,6 @@ The preset includes the following tools:
- **[lint-staged](https://www.npmjs.com/package/lint-staged)** is a tool for running linters on files staged for your next commit in git. Together with Husky (see below) it prevents problematic code from being committed.
- **[Husky](https://github.com/typicode/husky)** makes setting up git hooks very easy. Whenever someone installs your project, Husky will automatically set up git hooks as part of its `postinstall` script.

### 🚀 Release

Automatically generate release notes and (optionally) publish to NPM. The preset adds the following script to your `package.json`:

- `release`: release and publish a new version

The preset includes the following tools:

- **[semantic-release](https://www.npmjs.com/package/semantic-release)** automates the whole package release workflow including determining the next version number, generating the release notes, and publishing the package.

### 🤖 Continuous Integration (CI)

Validate the code on every push using the [🔍 linting](#-lint) preset (if configured). The supported CI providers are:
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sumup/foundry",
"version": "0.0.0-semantically-released",
"version": "5.1.0",
"description": "A toolkit for JavaScript + TypeScript applications by SumUp.",
"main": "index.js",
"repository": "https://github.com/sumup-oss/foundry",
Expand All @@ -23,7 +23,7 @@
"check:security": "audit-ci --critical",
"check:licenses": "license-checker --production --summary --failOn=GPLv3",
"prerelease": "yarn build",
"release": "cd ./dist && semantic-release"
"release": "changeset publish"
},
"engines": {
"node": "^14.17 || >=16"
Expand All @@ -39,10 +39,6 @@
"@babel/core": "^7.20.2",
"@babel/eslint-parser": "^7.19.1",
"@emotion/eslint-plugin": "^11.10.0",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/github": "^8.0.6",
"@semantic-release/npm": "^9.0.1",
"@semantic-release/release-notes-generator": "^10.0.3",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.45.0",
"chalk": "^4.0.0",
Expand Down Expand Up @@ -77,10 +73,11 @@
"lodash": "^4.17.11",
"prettier": "^2.8.0",
"read-pkg-up": "^7.0.1",
"semantic-release": "^19.0.5",
"yargs": "^17.6.2"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.7",
"@changesets/cli": "^2.25.2",
"@types/cross-spawn": "^6.0.2",
"@types/dedent": "^0.7.0",
"@types/inquirer": "^8.2.1",
Expand Down
14 changes: 0 additions & 14 deletions src/cli/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ export async function init({ $0, _, ...args }: InitParams): Promise<void> {
])) as { presets: Preset[] };

const prompts = {
[Prompt.PUBLISH]: {
type: 'confirm',
name: 'publish',
message: 'Would you like to publish your package to NPM?',
default: DEFAULT_OPTIONS.publish,
when: (): boolean => typeof args.publish === 'undefined',
},
[Prompt.OPEN_SOURCE]: {
type: 'confirm',
name: 'openSource',
Expand Down Expand Up @@ -182,13 +175,6 @@ export async function init({ $0, _, ...args }: InitParams): Promise<void> {
ctx.packageJson.license = 'Apache-2.0';
},
},
{
title: 'Add Foundry config',
enabled: () => options.presets.includes(Preset.RELEASE),
task: (ctx): void => {
ctx.packageJson.foundry = { publish: options.publish };
},
},
...scripts.map(({ name, command }) => ({
title: `Add "${name}" script`,
task: (
Expand Down
2 changes: 0 additions & 2 deletions src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import * as eslint from './eslint';
import * as husky from './husky';
import * as lintStaged from './lint-staged';
import * as prettier from './prettier';
import * as semanticRelease from './semantic-release';
import * as ci from './ci';

export const tools: { [key in Tool]?: ToolOptions } = {
[Tool.ESLINT]: eslint,
[Tool.HUSKY]: husky,
[Tool.LINT_STAGED]: lintStaged,
[Tool.PRETTIER]: prettier,
[Tool.SEMANTIC_RELEASE]: semanticRelease,
[Tool.CI]: ci,
};
58 changes: 0 additions & 58 deletions src/configs/semantic-release/__snapshots__/config.spec.ts.snap

This file was deleted.

46 changes: 0 additions & 46 deletions src/configs/semantic-release/config.spec.ts

This file was deleted.

Loading

0 comments on commit f6ef551

Please sign in to comment.