Merge pull request #21733 from taras/tm/do-not-change-cwd
Use openapitools.json from @backstage/repo-tools package
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/repo-tools': patch
|
||||
---
|
||||
|
||||
Execute `openapi-generator-cli` from `@backstage/repo-tools` directory to force it to use our openapitools.json config file.
|
||||
@@ -87,7 +87,8 @@
|
||||
"files": [
|
||||
"bin",
|
||||
"dist/**/*.js",
|
||||
"templates"
|
||||
"templates",
|
||||
"openapitools.json"
|
||||
],
|
||||
"nodemonConfig": {
|
||||
"watch": "./src",
|
||||
|
||||
@@ -36,10 +36,9 @@ async function generate(spec: string, outputDirectory: string) {
|
||||
);
|
||||
|
||||
await exec(
|
||||
// The actual main.js file for the binary isn't executable but yarn does _something_ to make it executable.
|
||||
// TODO (sennyeya@): Make this use the actual binary
|
||||
`yarn openapi-generator-cli`,
|
||||
'node',
|
||||
[
|
||||
resolvePackagePath('@openapitools/openapi-generator-cli', 'main.js'),
|
||||
'generate',
|
||||
'-i',
|
||||
resolvedOpenapiPath,
|
||||
@@ -52,20 +51,14 @@ async function generate(spec: string, outputDirectory: string) {
|
||||
'@backstage/repo-tools',
|
||||
'templates/typescript-backstage.yaml',
|
||||
),
|
||||
'-t',
|
||||
resolvePackagePath(
|
||||
'@backstage/repo-tools',
|
||||
'templates/typescript-backstage',
|
||||
),
|
||||
'--generator-key',
|
||||
'v3.0',
|
||||
],
|
||||
{
|
||||
maxBuffer: Number.MAX_VALUE,
|
||||
cwd: cliPaths.ownDir,
|
||||
cwd: resolvePackagePath('@backstage/repo-tools'),
|
||||
env: {
|
||||
...process.env,
|
||||
// PWD: outputDirectory,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -74,8 +67,9 @@ async function generate(spec: string, outputDirectory: string) {
|
||||
`yarn backstage-cli package lint --fix ${resolvedOutputDirectory}`,
|
||||
);
|
||||
|
||||
if (cliPaths.resolveTargetRoot('node_modules/.bin/prettier')) {
|
||||
await exec(`yarn prettier --write ${resolvedOutputDirectory}`);
|
||||
const prettier = cliPaths.resolveTargetRoot('node_modules/.bin/prettier');
|
||||
if (prettier) {
|
||||
await exec(`${prettier} --write ${resolvedOutputDirectory}`);
|
||||
}
|
||||
|
||||
fs.removeSync(resolve(resolvedOutputDirectory, '.openapi-generator-ignore'));
|
||||
|
||||
@@ -18,4 +18,4 @@ files:
|
||||
destinationFilename: apis/index.ts
|
||||
pluginId.mustache:
|
||||
templateType: SupportingFiles
|
||||
destinationFilename: pluginId.ts
|
||||
destinationFilename: pluginId.ts
|
||||
|
||||
Reference in New Issue
Block a user