Skip to content

Commit

Permalink
set artifactId and package using env variables (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiGuranIonos authored Mar 10, 2023
1 parent 045b56c commit 61fa5a1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.7

- allow setting `artifactId` and `packageName` from env variables `IONOSSDK_PACKAGE` and `IONOSSDK_ARTIFACTID`

## 1.2.6

- add `artifactId` optional flag to env cmd also
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ OPTIONS
-d, --debug show debug information
-h, --help show CLI help
-n, --name=name (required) sdk to build
-p, --package=packageName sdk package name
-i, --artifactId=artifactId artifact id
-p, --package=packageName sdk package name, can be set also from env var IONOSSDK_PACKAGE
-i, --artifactId=artifactId artifact id, can be set from also env var IONOSSDK_ARTIFACTID
-o, --output-dir=output-dir output dir
-s, --spec=spec [default: none.json] api spec
-v, --version=version [default: 0.0.0] sdk version
Expand All @@ -86,8 +86,8 @@ OPTIONS
-d, --debug show debug information
-h, --help show CLI help
-n, --name=name (required) sdk to build
-p, --package=packageName sdk package name
-i, --artifactId=artifactId artifact id
-p, --package=packageName sdk package name, can be set also from env var IONOSSDK_PACKAGE
-i, --artifactId=artifactId artifact id, can be set also from env var IONOSSDK_ARTIFACTID
-o, --output-dir=output-dir output dir
-s, --spec=spec (required) api spec
-v, --version=version (required) sdk version
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ionos-cloud/ionossdk",
"description": "Ionos Cloud SDK tool",
"version": "1.2.6",
"version": "1.2.7",
"author": "Florin Mihalache",
"bin": {
"ionossdk": "./bin/run"
Expand Down
4 changes: 2 additions & 2 deletions src/commands/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default class Env extends BaseCommand {
spec: flags.string({char: 's', description: 'api spec', required: false, default: 'none.json'}),
version: flags.string({char: 'v', description: 'sdk version', required: false, default: '0.0.0'}),
name: flags.string({char: 'n', description: 'sdk to build', required: true}),
package: flags.string({char: 'p', description: 'sdk package name', required: false}),
artifactId: flags.string({char: 'i', description: 'artifact id', required: false}),
package: flags.string({char: 'p', description: 'sdk package name, can be set from env var IONOSSDK_PACKAGE', required: false, env: 'IONOSSDK_PACKAGE'}),
artifactId: flags.string({char: 'i', description: 'artifact id, can be set from env variable IONOSSDK_ARTIFACTID', required: false, env: 'IONOSSDK_ARTIFACTID'}),
'assets-dir': flags.string({char: 'a', description: 'sdk assets directory (templates, scripts etc)', required: true}),
'output-dir': flags.string({char: 'o', description: 'output dir', required: false, default: ''}),
}
Expand Down
7 changes: 3 additions & 4 deletions src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import {FileCache} from '../services/file-cache'

export default class Generate extends BaseCommand {
static description = 'Generates an Ionos Cloud SDK'
//

static flags = {
...BaseCommand.flags,
spec: flags.string({char: 's', description: 'api spec', required: true}),
version: flags.string({char: 'v', description: 'sdk version', required: true}),
name: flags.string({char: 'n', description: 'sdk to build', required: true}),
package: flags.string({char: 'p', description: 'sdk package name', required: false}),
artifactId: flags.string({char: 'i', description: 'artifact id', required: false}),
package: flags.string({char: 'p', description: 'sdk package name, can be set from env var IONOSSDK_PACKAGE', required: false, env: 'IONOSSDK_PACKAGE'}),
artifactId: flags.string({char: 'i', description: 'artifact id, can be set from env variable IONOSSDK_ARTIFACTID', required: false, env: 'IONOSSDK_ARTIFACTID'}),
'assets-dir': flags.string({char: 'a', description: 'sdk assets directory (templates, scripts etc)'}),
'output-dir': flags.string({char: 'o', description: 'output dir'}),
build: flags.boolean({char: 'b', description: 'also build the sdk with the build.sh script', default: true}),
Expand All @@ -24,9 +25,7 @@ export default class Generate extends BaseCommand {
static args = [ ...BaseCommand.args ]

async run() {

const genConfig = new GenConfig()

genConfig.version = this.flags.version
genConfig.outputDir = this.flags['output-dir'] || '.'
genConfig.assetsDir = this.flags['assets-dir'] || '.'
Expand Down

0 comments on commit 61fa5a1

Please sign in to comment.