Skip to content

Commit da52eed

Browse files
committed
update readme
1 parent 946bdf2 commit da52eed

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

Diff for: README.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
1-
# Hydra-JS CLI
1+
# @hydra-js/cli
22

3-
## Development
3+
Command-line Toolkit for Hydra.js
44

5-
### Prerequisites
5+
## Getting started
6+
7+
### Usage
8+
9+
**Install**
10+
```bash
11+
npm i -g @hydra-js/cli
12+
```
13+
14+
**Create a new App**
15+
```bash
16+
hydra create [-f|--force] <namespace>
17+
```
18+
19+
**Run**
20+
```bash
21+
cd <namespace>
22+
hydra serve
23+
```
24+
25+
### Development Setup
26+
27+
**Prerequisites**
628

729
- Node.js (v14 or later)
830
- npm (v7 or later)
931

10-
### Setup
32+
### Setting up locally
1133

1234
```bash
1335
git clone [email protected]:hydra-js/cli.git hydra-cli
@@ -17,10 +39,10 @@ npm install
1739

1840
### Running locally
1941

20-
To run the CLI tool locally without installing it globally, use:
42+
To run the CLI tool locally without installing it, use:
2143

2244
```bash
23-
node index.js init [appName]
45+
node index.js create [-f|--force] <namespace>
2446
```
2547

2648
### Running locally with `npm link`
@@ -39,7 +61,7 @@ npm link
3961
2. Now you can run the `hydra` command from anywhere on your system:
4062

4163
```bash
42-
hydra init [appName]
64+
hydra create [-f|--force] <namespace>
4365
```
4466

4567
This allows you to test changes to the CLI tool without needing to reinstall it each time you make modifications.

Diff for: index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ const subdirectory = 'packages/server-nodejs';
1616
program.name('hydra').description(pkg.description).version(pkg.version);
1717

1818
program
19-
.command('init [appName]')
19+
.command('create [namespace]')
2020
.description(
2121
'Initialize a Hydra App'
2222
)
23-
.action(async (appName = 'my-hydra-app') => {
24-
const tempRepoPath = path.join(process.cwd(), appName, '__tmp');
25-
const appPath = path.join(process.cwd(), appName);
23+
.action(async (namespace = 'my-hydra-app') => {
24+
const tempRepoPath = path.join(process.cwd(), namespace, '__tmp');
25+
const appPath = path.join(process.cwd(), namespace);
2626

2727
if (fs.existsSync(appPath)) {
28-
console.error(`Error: Directory ${appName} already exists.`);
28+
console.error(`Error: Directory ${namespace} already exists.`);
2929
process.exit(1);
3030
}
3131

@@ -42,7 +42,7 @@ program
4242
);
4343
}
4444

45-
console.log(`Copying ${subdirectory} to ${appName}...`);
45+
console.log(`Copying ${subdirectory} to ${namespace}...`);
4646
await fs.copy(sourcePath, appPath);
4747
console.log('Subdirectory copied successfully.');
4848

@@ -52,7 +52,7 @@ program
5252
await fs.remove(tempRepoPath);
5353
console.log('Cleanup completed.');
5454

55-
console.log(`Project ${appName} generated successfully.`);
55+
console.log(`Project ${namespace} generated successfully.`);
5656
} catch (err) {
5757
console.error('Failed to generate project:', err);
5858
await fs.remove(tempRepoPath);

0 commit comments

Comments
 (0)