Skip to content

Commit

Permalink
docs: update document
Browse files Browse the repository at this point in the history
  • Loading branch information
johnitvn committed Nov 24, 2024
1 parent a7e2e3d commit ec0eca8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This project is mainly used internally within ebizbase projects but we have deci
### npm packages
| Name | Description|
| ---------- | ---------- |
| [nx-devkit][nx-devkit-readme] | The NX plugin to build, push and analyze image |
| [nx-devkit][nx-devkit-readme] | It contains many utility functions for interactive with nx workspace and projects |

### nx plugins
| Name | Description|
Expand Down
48 changes: 43 additions & 5 deletions packages/nx-devkit/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
# nx-devkit

This library was generated with [Nx](https://nx.dev).
It contains many utility functions for interactive with nx workspace and projects

## Building

Run `nx build nx-devkit` to build the library.
## Installation

## Running unit tests
To install the package, run:

Run `nx test nx-devkit` to execute the unit tests via [Jest](https://jestjs.io).
```bash
npm install @ebizbase/nx-devkit
```

## Usage

Here is an example of how to use the `DockerUtils`:

```typescript
import { DockerUtils } from '@ebizbase/nx-devkit';

const dockerService = new DockerUtils();

// Check docker installed and docker daemon is running
if (!dockerService.checkDockerInstalled(context.isVerbose)) {
logger.error('Docker is not installed or docker daemon is not running');
return { success: false };
}

// Determine using build or buildx for building Docker image
const isBuildxInstalled = dockerService.checkBuildxInstalled(context.isVerbose);
if (!isBuildxInstalled) {
logger.warn(
'Buildx is not installed falling back to docker build. Docker buildx is not installed so performance may be degraded'
);
}
const buildCommand = isBuildxInstalled ? ['docker', 'buildx', 'build'] : ['docker', 'build'];
```


Here is an example of how to use the `DockerUtils`:

```typescript
import { ProjectUtils } from '@ebizbase/nx-devkit';
const executor: PromiseExecutor<DockerExecutorSchema> = async (options, context) => {
const projectUtils = new ProjectUtils(context);
const projectRoot: projectUtils.getProjectRoot();
const projectName: projectUtils.getProjectName();
};
```
2 changes: 1 addition & 1 deletion packages/nx-devkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@ebizbase/nx-devkit",
"version": "1.0.0",
"private": false,
"description": "The nx devkit utils",
"description": "It contains many utility functions for interactive with nx workspace and projects",
"bugs": "https://github.com/ebizbase/dev-infras/issues",
"repository": {
"type": "git",
Expand Down

0 comments on commit ec0eca8

Please sign in to comment.