auri
Advanced tools
Comparing version 0.9.4 to 0.9.5
# auri | ||
## 0.9.5 | ||
### Patch changes | ||
- Test update ([#85](https://github.com/pilcrowOnPaper/auri/pull/85)) | ||
## 0.9.4 | ||
@@ -4,0 +10,0 @@ |
@@ -20,2 +20,3 @@ import { publish } from "./scripts/publish.js"; | ||
await addChangeset(type); | ||
process.exit(); | ||
} | ||
@@ -28,2 +29,3 @@ if (args[0] === "prepare") { | ||
await prepareRelease(branch); | ||
process.exit(); | ||
} | ||
@@ -36,3 +38,4 @@ if (args[0] === "publish") { | ||
await publish(branch); | ||
process.exit(); | ||
} | ||
process.exit(); | ||
throw new Error(`Unknown command: ${args[0]}`); |
@@ -25,2 +25,3 @@ import fs from "fs/promises"; | ||
} | ||
await initGit(); | ||
const currentVersion = parseVersion(packageMeta.version); | ||
@@ -50,5 +51,6 @@ if (currentVersion.next !== null) { | ||
recursive: true, | ||
force: true | ||
// force: true | ||
}); | ||
commitChanges("main"); | ||
execute("git checkout main"); // reset branch | ||
let releaseRequestBody = ""; | ||
@@ -129,2 +131,3 @@ for (const changeset of changesets) { | ||
commitChanges("main"); | ||
execute("git checkout main"); // reset branch | ||
let releaseRequestBody = ""; | ||
@@ -158,3 +161,3 @@ if (minorChangesets.length > 0) { | ||
if (majorVersion !== currentVersion.major || currentVersion.next !== null) { | ||
// stable => next release | ||
// stable/next => next release | ||
return await prepareNextMajorVersion(majorVersion, packageMeta); | ||
@@ -173,2 +176,3 @@ } | ||
} | ||
await initGit(); | ||
const minorChangesets = []; | ||
@@ -236,2 +240,3 @@ const patchChangesets = []; | ||
commitChanges(`v${majorVersion}`); | ||
execute(`git checkout v${majorVersion}`); // reset branch | ||
let releaseRequestBody = ""; | ||
@@ -268,2 +273,3 @@ if (minorChangesets.length > 0) { | ||
} | ||
await initGit(); | ||
let nextVersion; | ||
@@ -327,2 +333,3 @@ if (currentVersion.major === majorVersion && currentVersion.next !== null) { | ||
commitChanges(`v${majorVersion}`); | ||
execute(`git checkout v${majorVersion}`); // reset branch | ||
let releaseRequestBody = ""; | ||
@@ -388,7 +395,9 @@ for (const changeset of changesets) { | ||
} | ||
async function commitChanges(branch) { | ||
async function initGit() { | ||
const user = await getGitUser(); | ||
execute("npx prettier -w CHANGELOG.md package.json"); | ||
execute(`git config --global user.name "${user.name}"`); | ||
execute(`git config --global user.email "${user.email}"`); | ||
} | ||
function commitChanges(branch) { | ||
execute("npx prettier -w CHANGELOG.md package.json"); | ||
execute(`git checkout -b ${branch}.auri`); | ||
@@ -398,3 +407,2 @@ execute("git add ."); | ||
execute("git push -f -u origin HEAD"); | ||
execute(`git checkout ${branch}`); | ||
} |
@@ -11,3 +11,4 @@ import fs from "fs/promises"; | ||
} | ||
if (packageMeta.version.includes(".next-")) { | ||
console.log(packageMeta); | ||
if (packageMeta.version.includes("-next.")) { | ||
execute("npm install && npm run build && npm publish --access public --tag next"); | ||
@@ -14,0 +15,0 @@ const body = await getLatestChangelogBody(); |
{ | ||
"name": "auri", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "Organize package changes and releases", | ||
@@ -5,0 +5,0 @@ "main": "/dist/index.js", |
# Auri | ||
Organize package changes and releases. | ||
Organize package changes and releases in monolith repositories. | ||
@@ -18,1 +18,89 @@ ``` | ||
``` | ||
## Prerequisites | ||
Auri is intentionally opinionated and intended for certain repositories: | ||
- Single monolith repository | ||
- Uses prettier | ||
- Package be built and published with: `npm run build && npm publish` | ||
- The package's `package.json` is in the repository root | ||
- No monorepos | ||
- No pre-releases for patch/minor versions | ||
## Setup | ||
Install Auri via NPM and update your repository. | ||
### 1. Generate access tokens | ||
You'll will need an NPM automation access token (classic) and a GitHub token with the following permissions: | ||
- `repo` | ||
- `user:email` | ||
### 2. Create GitHub workflow | ||
Create a GitHub workflow that runs on every push. The NPM token should be named `NODE_AUTH_TOKEN` and the GitHub token as `AURI_GITHUB_TOKEN`. | ||
```yaml | ||
# .github/workflows/publish.yaml | ||
name: "Publish package" | ||
on: [push] | ||
env: | ||
AURI_GITHUB_TOKEN: ${{secrets.AURI_GITHUB_TOKEN}} | ||
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | ||
jobs: | ||
publish-package: | ||
name: Publish package with Auri | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup actions | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
registry-url: "https://registry.npmjs.org/" | ||
cache: "npm" | ||
- name: Prepare release | ||
run: npm run auri prepare ${{ github.ref_name }} | ||
- name: Publish package | ||
run: npm run auri publish ${{ github.ref_name }} | ||
``` | ||
## Instructions | ||
### Basics | ||
When you create a new pull request, run `pnpm auri add` to create a new changeset. Use `add patch` for patch changes and `add minor` for minor changes. | ||
``` | ||
npx auri patch | ||
``` | ||
This will create a new markdown file inside the `.changesets` directory. Write a concise summary of your changes. A single PR may include multiple (or zero) changesets. Each changeset might look something like this: | ||
``` | ||
Fix: Stop deleting operating system at midnight | ||
``` | ||
When you merge this to `main` or `master` branch, Auri will detect your changes and create a new "Release request" as a pull request. When you merge this request, your `package.json` and `CHANGELOG.md` will be updated, and new version of your package will be published to NPM. | ||
### Versioned branches | ||
Auri works by creating dedicated branches for each major version. For example, `main` will be for v3, `v2` for v2, and `v4` for experimental v4. This means you can maintain multiple major versions at once. Versioned branches be in the format of `v<integer>`. | ||
### Next versions | ||
Whenever you create a versioned branch for a major version once above the version in `main`, it will publish packages with a "next" tag. These versions are your betas/alphas/prereleases and looks like `3.0.0-beta.16`. When working with "next", all your changesets must use `next`: | ||
``` | ||
npx auri next | ||
``` | ||
Once you merge the branch into `main`, Auri will automatically release a stable version. If you want to keep working on the previous version, make sure you create a versioned branch for it before merging. |
43743
835
106