update to diff instead of check
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/repo-tools': minor
|
||||
---
|
||||
|
||||
Adds 2 new commands `repo schema openapi check` and `package schema openapi check`. `repo schema openapi check` is intended to power a new breaking changes check on pull requests and the package level command allows plugin developers to quickly see new API breaking changes.They're intended to be used in complement with the existing `repo schema openapi verify` command to validate your OpenAPI spec against a variety of things.
|
||||
Adds 2 new commands `repo schema openapi diff` and `package schema openapi diff`. `repo schema openapi diff` is intended to power a new breaking changes check on pull requests and the package level command allows plugin developers to quickly see new API breaking changes. They're intended to be used in complement with the existing `repo schema openapi verify` command to validate your OpenAPI spec against a variety of things.
|
||||
|
||||
@@ -80,12 +80,12 @@ function registerPackageCommand(program: Command) {
|
||||
);
|
||||
|
||||
openApiCommand
|
||||
.command('check')
|
||||
.command('diff')
|
||||
.option('--ignore', 'Ignore linting failures and only log the results.')
|
||||
.option('--json', 'Output the results as JSON')
|
||||
.option('--since <ref>', 'Check the API against a specific ref')
|
||||
.option('--since <ref>', 'Diff the API against a specific ref')
|
||||
.action(
|
||||
lazy(() => import('./package/schema/openapi/check').then(m => m.command)),
|
||||
lazy(() => import('./package/schema/openapi/diff').then(m => m.command)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -144,17 +144,17 @@ function registerRepoCommand(program: Command) {
|
||||
);
|
||||
|
||||
openApiCommand
|
||||
.command('check')
|
||||
.command('diff')
|
||||
.description(
|
||||
'Check the repository against a specific ref, will run all package `check:api` scripts.',
|
||||
'Diff the repository against a specific ref, will run all package `diff` scripts.',
|
||||
)
|
||||
.option(
|
||||
'--since <ref>',
|
||||
'Check the API against a specific ref',
|
||||
'Diff the API against a specific ref',
|
||||
'origin/master',
|
||||
)
|
||||
.action(
|
||||
lazy(() => import('./repo/schema/openapi/check').then(m => m.command)),
|
||||
lazy(() => import('./repo/schema/openapi/diff').then(m => m.command)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+4
-8
@@ -54,9 +54,7 @@ export async function command(opts: OptionValues) {
|
||||
);
|
||||
}
|
||||
|
||||
const checkablePackages = packages.filter(
|
||||
e => e.packageJson.scripts?.['check:api'],
|
||||
);
|
||||
const checkablePackages = packages.filter(e => e.packageJson.scripts?.diff);
|
||||
|
||||
try {
|
||||
const outputs = {
|
||||
@@ -70,7 +68,7 @@ export async function command(opts: OptionValues) {
|
||||
const sinceCommands = since ? ['--since', since] : [];
|
||||
const { stdout } = await exec(
|
||||
'yarn',
|
||||
['check:api', '--ignore', '--json', ...sinceCommands],
|
||||
['diff', '--ignore', '--json', ...sinceCommands],
|
||||
{
|
||||
cwd: pkg.dir,
|
||||
},
|
||||
@@ -81,12 +79,10 @@ export async function command(opts: OptionValues) {
|
||||
outputs.noop.push(...(result.noop ?? []));
|
||||
}
|
||||
|
||||
for (const pkg of packages.filter(
|
||||
e => !e.packageJson.scripts?.['check:api'],
|
||||
)) {
|
||||
for (const pkg of packages.filter(e => !e.packageJson.scripts?.diff)) {
|
||||
outputs.warning?.push({
|
||||
apiName: `${pkg.dir}/`,
|
||||
warning: 'No check:api script found in package.json',
|
||||
warning: 'No diff script found in package.json',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"check:api": "backstage-repo-tools package schema openapi check",
|
||||
"clean": "backstage-cli package clean",
|
||||
"diff": "backstage-repo-tools package schema openapi diff",
|
||||
"fuzz": "backstage-repo-tools package schema openapi fuzz --exclude-checks response_schema_conformance",
|
||||
"generate": "backstage-repo-tools package schema openapi generate --server --client-package packages/catalog-client",
|
||||
"lint": "backstage-cli package lint",
|
||||
|
||||
Reference in New Issue
Block a user