-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters