Skip to content

Commit c580974

Browse files
authored
chore: exports (#5)
1 parent bbef8a8 commit c580974

File tree

11 files changed

+1271
-1194
lines changed

11 files changed

+1271
-1194
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules/
2+
dist/
File renamed without changes.

demo.cac.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
import cac from "cac";
2-
import tab from "./src/cac";
1+
import cac from 'cac';
2+
import tab from './src/cac';
33

4-
const cli = cac("vite");
4+
const cli = cac('vite');
55

66
cli
7-
.option("-c, --config <file>", `Use specified config file`)
8-
.option("-m, --mode <mode>", `Set env mode`)
9-
.option("-l, --logLevel <level>", `info | warn | error | silent`);
7+
.option('-c, --config <file>', `Use specified config file`)
8+
.option('-m, --mode <mode>', `Set env mode`)
9+
.option('-l, --logLevel <level>', `info | warn | error | silent`);
1010

1111
cli
12-
.command("dev", "Start dev server")
13-
.option("--host [host]", `Specify hostname`)
14-
.option("--port <port>", `Specify port`)
12+
.command('dev', 'Start dev server')
13+
.option('--host [host]', `Specify hostname`)
14+
.option('--port <port>', `Specify port`)
1515
.action((options) => {});
1616

17-
cli
18-
.command("dev build", "Build project")
19-
.action((options) => {});
17+
cli.command('dev build', 'Build project').action((options) => {});
2018

21-
cli
22-
.command("lint [...files]", "Lint project")
23-
.action((files, options) => {});
19+
cli.command('lint [...files]', 'Lint project').action((files, options) => {});
2420

2521
const completion = await tab(cli);
2622

demo.citty.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ const devCommand = defineCommand({
3131
host: { type: 'string', description: 'Specify hostname' },
3232
port: { type: 'string', description: 'Specify port' },
3333
},
34-
run(ctx) {
35-
},
34+
run(ctx) {},
3635
});
3736

3837
devCommand.subCommands = {
@@ -53,8 +52,7 @@ const lintCommand = defineCommand({
5352
args: {
5453
files: { type: 'positional', description: 'Files to lint' },
5554
},
56-
run(ctx) {
57-
},
55+
run(ctx) {},
5856
});
5957

6058
main.subCommands = {
@@ -65,7 +63,6 @@ main.subCommands = {
6563
const completion = await tab(main);
6664

6765
for (const command of completion.commands.values()) {
68-
6966
if (command.name === 'lint') {
7067
command.handler = () => {
7168
return [

package.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
"name": "tab",
33
"version": "0.0.0",
44
"description": "",
5-
"main": "index.js",
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
67
"type": "module",
78
"scripts": {
89
"test": "vitest",
910
"type-check": "tsc --noEmit",
1011
"format": "prettier --write .",
11-
"format:check": "prettier --check ."
12+
"format:check": "prettier --check .",
13+
"build": "tsup",
14+
"prepare": "pnpm build"
1215
},
16+
"files": [
17+
"dist"
18+
],
1319
"keywords": [],
1420
"author": "",
1521
"license": "ISC",
@@ -22,11 +28,29 @@
2228
"eslint-config-prettier": "^10.0.1",
2329
"eslint-plugin-prettier": "^5.2.2",
2430
"prettier": "^3.4.2",
31+
"tsup": "^8.3.6",
2532
"tsx": "^4.19.1",
2633
"vitest": "^2.1.3"
2734
},
2835
"dependencies": {
2936
"mri": "^1.2.0"
3037
},
38+
"exports": {
39+
".": {
40+
"import": "./dist/index.js",
41+
"require": "./dist/index.cjs",
42+
"types": "./dist/index.d.ts"
43+
},
44+
"./citty": {
45+
"import": "./dist/citty.js",
46+
"require": "./dist/citty.cjs",
47+
"types": "./dist/citty.d.ts"
48+
},
49+
"./cac": {
50+
"import": "./dist/cac.js",
51+
"require": "./dist/cac.cjs",
52+
"types": "./dist/cac.d.ts"
53+
}
54+
},
3155
"packageManager": "[email protected]+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
3256
}

0 commit comments

Comments
 (0)