Skip to content

Commit 21f55e6

Browse files
committed
feat: release on JSR
1 parent f7c6541 commit 21f55e6

File tree

6 files changed

+210
-1649
lines changed

6 files changed

+210
-1649
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ jobs:
1313
permissions:
1414
contents: write
1515
id-token: write
16+
17+
release-jsr:
18+
uses: sxzz/workflows/.github/workflows/release-jsr.yml@v1
19+
permissions:
20+
contents: read
21+
id-token: write

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
dist
33
coverage
44
api-doc
5+
.eslintcache

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
## Install
6464

6565
```bash
66-
yarn add cac
66+
npm i cac
6767
```
6868

6969
## Usage
@@ -124,7 +124,7 @@ cli
124124
.command('rm <dir>', 'Remove a dir')
125125
.option('-r, --recursive', 'Remove recursively')
126126
.action((dir, options) => {
127-
console.log('remove ' + dir + (options.recursive ? ' recursively' : ''))
127+
console.log(`remove ${dir}${options.recursive ? ' recursively' : ''}`)
128128
})
129129

130130
cli.help()
@@ -280,8 +280,8 @@ try {
280280
} catch (error) {
281281
// Handle error here..
282282
// e.g.
283-
// console.error(error.stack)
284-
// process.exit(1)
283+
console.error(error.stack)
284+
process.exit(1)
285285
}
286286
```
287287

@@ -290,14 +290,12 @@ try {
290290
First you need `@types/node` to be installed as a dev dependency in your project:
291291

292292
```bash
293-
yarn add @types/node --dev
293+
npm i @types/node --dev
294294
```
295295

296296
Then everything just works out of the box:
297297

298298
```js
299-
const { cac } = require('cac')
300-
// OR ES modules
301299
import { cac } from 'cac'
302300
```
303301

@@ -438,7 +436,7 @@ Use a callback function as the command action when the command matches user inpu
438436
type ActionCallback = (
439437
// Parsed CLI args
440438
// The last arg will be an array if it's a variadic argument
441-
...args: string | string[] | number | number[]
439+
...args: string | string[] | number | number[],
442440
// Parsed CLI options
443441
options: Options
444442
) => any
@@ -482,17 +480,17 @@ Listen to commands:
482480
483481
```js
484482
// Listen to the `foo` command
485-
cli.on('command:foo', () => {
483+
cli.addEventListener('command:foo', () => {
486484
// Do something
487485
})
488486

489487
// Listen to the default command
490-
cli.on('command:!', () => {
488+
cli.addEventListener('command:!', () => {
491489
// Do something
492490
})
493491

494492
// Listen to unknown commands
495-
cli.on('command:*', () => {
493+
cli.addEventListener('command:*', () => {
496494
console.error('Invalid command: %s', cli.args.join(' '))
497495
process.exit(1)
498496
})

jsr.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@cac/cac",
3+
"version": "6.7.14",
4+
"license": "MIT",
5+
"exports": "./src/index.ts",
6+
"publish": {
7+
"include": [
8+
"src",
9+
"jsr.json",
10+
"README.md",
11+
"LICENSE"
12+
]
13+
}
14+
}

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cac",
33
"type": "module",
4-
"version": "6.0.0",
4+
"version": "6.7.14",
55
"description": "Simple yet powerful framework for building command-line apps.",
66
"author": "egoist <0x142857@gmail.com>",
77
"license": "MIT",
@@ -32,6 +32,7 @@
3232
"typecheck": "tsgo --noEmit",
3333
"format": "prettier --cache --write .",
3434
"toc": "markdown-toc -i README.md",
35+
"release": "bumpp",
3536
"prepublishOnly": "pnpm build",
3637
"docs:api": "typedoc --out api-doc --readme none --exclude \"**/__test__/**\" --theme minimal"
3738
},
@@ -42,24 +43,21 @@
4243
"@types/deno": "^2.5.0",
4344
"@types/node": "^25.3.0",
4445
"@typescript/native-preview": "7.0.0-dev.20260220.1",
46+
"bumpp": "^10.4.1",
4547
"cz-conventional-changelog": "^3.3.0",
4648
"eslint": "^10.0.0",
4749
"husky": "^9.1.7",
4850
"lint-staged": "^16.2.7",
4951
"markdown-toc": "^1.2.0",
5052
"mri": "^1.2.0",
5153
"prettier": "^3.8.1",
52-
"semantic-release": "^25.0.3",
5354
"tinyexec": "^1.0.2",
5455
"tsdown": "^0.20.3",
5556
"tsdown-preset-sxzz": "^0.3.3",
5657
"typedoc": "^0.28.17",
5758
"typescript": "^5.9.3",
5859
"vitest": "^4.0.18"
5960
},
60-
"release": {
61-
"branch": "main"
62-
},
6361
"config": {
6462
"commitizen": {
6563
"path": "./node_modules/cz-conventional-changelog"

0 commit comments

Comments
 (0)