Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/all-eels-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cadamsdev/lazy-changesets": feat
---

Added publish command
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- `bun test -t "test name"` - Run tests matching pattern

### Development
- `bun dev` - Run the CLI directly using tsx
- `bun changeset` - Run the CLI directly using tsx

## Code Style Guidelines

Expand Down
13 changes: 13 additions & 0 deletions PUBLISH_FEATURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
There should be a new command for "publish". This command should...
1. Go through all the package.json files.
2. Grab the version
3. Create and push git tags in the format package-name@version. Skip this step if the tag already exists on the remote
4. Publish the packages to npm in each package directory run npm install or pnpm install or bun install depending on what package manager the user is using. Skip publishing to npm if the package.json contains "private": true
5. Create GitHub Release - Check the last commit get all the changeset files that were deleted under .changesets/*.md. Create a GitHub release for each package using the tag that was created in step 3. The markdown in the GitHub release should be formatted like this

# @scope/package-name

## 0.1.0

### 🚀 feat
- Description
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"changeset": "./dist/changeset"
},
"scripts": {
"dev": "bun src/index.ts",
"changeset": "bun src/index.ts",
"build": "bun build --compile --outfile=dist/changeset src/index.ts",
"test": "vitest"
},
Expand Down
19 changes: 19 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { humanId } from 'human-id';
import pc from 'picocolors';
import { ChangesetConfig, readConfig } from './config.js';
import { version } from './version.js';
import { publish } from './publish.js';

async function findPackages(config: ChangesetConfig): Promise<Map<string, string>> {
const packageJsonPaths = globSync({
Expand Down Expand Up @@ -243,6 +244,24 @@ async function createChangeset(args: { empty?: boolean }) {
process.exit(0);
},
},
publish: {
meta: {
name: 'publish',
description: 'Publish packages to npm and create GitHub releases',
},
args: {
'dry-run': {
type: 'boolean',
description: 'Show what would be published without actually publishing',
required: false,
default: false,
},
},
run: async ({ args }) => {
await publish({ dryRun: args['dry-run'] });
process.exit(0);
},
},
},
args: {
empty: {
Expand Down
Loading