Skip to content

Commit

Permalink
fix: default specs filename on sdk generation; publish showcase specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrednic-1A committed May 22, 2024
1 parent d90fbaa commit 79c67a7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/@ama-sdk/create/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ npm create @ama-sdk typescript <project-name> -- --package-manager=yarn [...opti

- `--spec-path`: Path to the swagger/open-api specification used to generate the SDK
- `--spec-package-name`: The npm package name where the spec file can be fetched
- `--spec-package-path`: The path inside the package where to find the spec file
- `--spec-package-path`: The path inside the package where to find the spec file. Defaults to _openapi.yml_
- `--spec-package-version`: The version to target for the npm package where the spec file can be fetched
- `--spec-package-registry`: The npm registry where the spec file can be fetched

Expand Down
10 changes: 8 additions & 2 deletions packages/@ama-sdk/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-console */

import { execSync, spawnSync } from 'node:child_process';
import { dirname, join, parse, relative, resolve } from 'node:path';
import { dirname, extname, join, parse, relative, resolve } from 'node:path';
import * as minimist from 'minimist';

const packageManagerEnv = process.env.npm_config_user_agent?.split('/')[0];
Expand Down Expand Up @@ -65,6 +65,11 @@ if (argv['spec-path'] && argv['spec-package-name']) {
process.exit(-4);
}

if (argv['spec-package-name'] && !argv['spec-package-path']) {
console.error('--spec-package-name cannot be used without --spec-package-path');
process.exit(-5);
}

const commonSchematicArgs = [
argv.debug !== undefined ? `--debug=${argv.debug as string}` : '--debug=false', // schematics enable debug mode per default when using schematics with relative path
...(name ? ['--name', name] : []),
Expand All @@ -88,7 +93,8 @@ const run = () => {
];
const coreSchematicArgs = [
...commonSchematicArgs,
'--spec-path', argv['spec-package-name'] ? './openapi.yml' : isSpecRelativePath ? relative(resolveTargetDirectory, resolve(process.cwd(), argv['spec-path'])) : argv['spec-path']
'--spec-path',
argv['spec-package-name'] ? `./openapi${extname(argv['spec-package-path'])}` : isSpecRelativePath ? relative(resolveTargetDirectory, resolve(process.cwd(), argv['spec-path'])) : argv['spec-path']
];

const runner = process.platform === 'win32' ? `${packageManager}.cmd` : packageManager;
Expand Down
1 change: 0 additions & 1 deletion packages/@ama-sdk/showcase-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "@ama-sdk/showcase-sdk",
"private": true,
"version": "0.0.0-placeholder",
"description": "showcase-sdk - SDK",
"source": "src/index.ts",
Expand Down
5 changes: 4 additions & 1 deletion packages/@ama-sdk/showcase-sdk/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Showcase SDK

### Based on Swagger spec 1.0.17
>Note:
This package is intended for **testing purposes only**. It is not suitable for production use.

### Based on openapi specs 3.0.2

The SDK contains 2 different parts:

Expand Down

0 comments on commit 79c67a7

Please sign in to comment.