[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: cli #31

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"scripts": {
"build": "turbo --filter=./packages/* build",
"dev": "turbo --filter=./packages/* dev --concurrency 11",
"dev": "turbo --filter=./packages/* dev --concurrency 12",
"lint": "turbo run lint --filter=./packages/*",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"test": "FORCE_COLOR=1 turbo --filter=./packages/* test --log-prefix=none --color",
Expand Down
14 changes: 14 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Navita CLI

Navita CLI is a command line interface for Navita.

Since more and more UI libraries are moving to a "copy and paste" approach, Navita CLI is a tool to help you with that.

We provide a small wrapper around [https://ui.shadcn.com/](shadcn/ui),
that adds and converts their Tailwind-based components to Navita.

This is a work in progress. Expect breaking changes, and non-working versions until we reach 1.0.0 of the CLI.

If you only want to use Navita, you don't need to install this package.

Please check out the getting started guide at https://navita.style/.
43 changes: 43 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "navita",
"version": "0.0.5",
"description": "Navita CLI",
"keywords": [
"navita",
"cli",
"shadcn"
],
"private": false,
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./src/index.ts"
}
},
"bin": "./dist/index.mjs",
"publishConfig": {
"directory": "dist",
"linkDirectory": false
},
"scripts": {
"test": "jest --passWithNoTests",
"dev": "build --dev",
"build": "build"
},
"devDependencies": {
"type-fest": "4.8.2",
"@types/node": "^20.10.0"
},
"dependencies": {
"commander": "^11.1.0",
"shadcn-ui": "^0.4.1"
},
"license": "MIT",
"author": "Eagerpatch",
"repository": {
"type": "git",
"url": "https://github.com/eagerpatch/navita.git",
"directory": "packages/cli"
}
}
24 changes: 24 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node
import { Command } from "commander";

import { getPackageInfo } from "./utils/getPackageInfo"

process.on("SIGINT", () => process.exit(0))
process.on("SIGTERM", () => process.exit(0))

async function main() {
const packageInfo = await getPackageInfo()

const program = new Command()
.name("navita")
.description("add components and dependencies to your project")
.version(
packageInfo.version || "1.0.0",
"-v, --version",
"display the version number"
)

program.parse()
}

main()
11 changes: 11 additions & 0 deletions packages/cli/src/utils/getPackageInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as fs from "fs";
import path from "path";
import type { PackageJson } from "type-fest";

export async function getPackageInfo() {
const content = await fs.promises.readFile(
path.join(__dirname, "..", "..", "package.json")
);

return JSON.parse(content.toString()) as PackageJson;
}
3 changes: 3 additions & 0 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json",
}
Loading
Loading