Skip to content

Commit

Permalink
Makes the tool executable as a globally installed module and updates …
Browse files Browse the repository at this point in the history
…the Readme
  • Loading branch information
Kerruba committed Jan 20, 2020
1 parent 05201ec commit d57042b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ This CLI application has the purpose of generate Entando Bundles for the Digital

## Getting started

To install the tool globally for development
```
npm install -g ./
```

This CLI tool is able to convert npm module(s) into EntandoDeBundle custom resources. You can see the help for the tool by invoking the `--help` command

```
entando-de-bundle --help
```

To generate a bundle you can use the `generate` command. Check the details for the generate command
```
entando-de-bundle generate --help
```

## Local development of npm modules

### Setup a local registry with Nexus from scratch

As a registry you can use whatever technology you prefer. Some examples are the [NPM official registry](https://npmjs.org), [Verdaccio](https://github.com/verdaccio/verdaccio) or [Nexus](https://github.com/sonatype/nexus-public)
Expand Down Expand Up @@ -69,7 +87,7 @@ In order to be able to login and publish into a repository you need to

You can also decide to start using the provided `base-nexus-data` folder available in the `docker` folder. That contains a private npm registry (npm-internal), has role and a user already defined.

> **Note**: Make a copy of the `base-nexus-data` folder and name it `nexus-data` in the docker folder. That folder is already ignored in git and this way you can continue to work on nexus without updating the current repository. Or copy the entire docker folder somewhere
> **Note**: Make a copy of the `base-nexus-data` folder and name it `nexus-data` in the docker folder. That folder is already ignored in git and this way you can continue to work on nexus without updating the current repository. Or copy the entire docker folder somewhere. Make also sure the folder is open to UID 200, so a `chmod -R 777 nexus-data` command should do the trick
#### Docker command to include the volume

Expand Down
19 changes: 11 additions & 8 deletions index.js → bin/index.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env node

const program = require('commander');
const { generateBundle } = require('./lib/actions');
const version = require('./package.json').version;
const { generateBundle } = require('../lib/actions');
const version = require('../package.json').version;

function validateOrExit(validation) {
if (!validation) {
Expand All @@ -13,15 +15,16 @@ program.storeOptionsAsProperties(false);
program.passCommandToAction(false);

program.version(version).name('@entando/de-cli');
program.description("A tool to interact with Entando's Digital-Exchange bundles")


program
.command('generate <module>')
.description('Generates an EntandoDigitalExchangeBundle custom resource')
.option('--name <name>', 'The name to give to the EntandoDigitalExchangeBundle')
.option('--namespace <namespace>', 'The namespace where the EntandoDigitalExchangeBundle will be created')
.option('--registry <registry>', 'The registry to use for searching the module, by default uses the registry configured in your .npmrc')
.option('--dry-run', 'Print the output instead of create the custom resource automatically')
.command(`generate <module>`)
.description(`Generates an Entando's Digital-Exchange bundle k8s custom resource`)
.option(`--name <name>`, `The name to give to the EntandoDigitalExchangeBundle`)
.option(`--namespace <namespace>`, `The namespace where the EntandoDigitalExchangeBundle will be created`)
.option(`--registry <registry>`, `The registry to use for searching the module, by default uses the registry configured in your .npmrc`)
.option(`--dry-run`, `Print the output instead of create the custom resource automatically`)
.action(generateBundle);


Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "digital-exchange-node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "./lib/actions.js",
"dependencies": {
"@kubernetes/client-node": "^0.11.0",
"commander": "^4.1.0",
Expand All @@ -12,16 +12,15 @@
"prettyjson": "^1.2.1"
},
"bin": {
"entando-bundle": "./index.js"
"entando-de-bundle": "./bin/index.js"
},
"devDependencies": {
"jest": "^24.9.0"
},
"scripts": {
"test": "jest",
"start": "node index.js",
"generate": "node index.js generate",
"convert-file": "node index.js convert --file"
"start": "node ./bin/index.js",
"generate": "node ./bin/index.js generate"
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit d57042b

Please sign in to comment.