cli: add --publish option for repo fix
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@
|
||||
"dev": "yarn workspaces foreach -A --include example-backend --include example-app --parallel -v -i run start",
|
||||
"dev:next": "yarn workspaces foreach -A --include example-backend --include example-app-next --parallel -v -i run start",
|
||||
"docker-build": "yarn tsc && yarn workspace example-backend build && yarn workspace example-backend build-image",
|
||||
"fix": "backstage-cli repo fix",
|
||||
"fix": "backstage-cli repo fix --publish",
|
||||
"postinstall": "husky || true",
|
||||
"lint": "backstage-cli repo lint --since origin/master",
|
||||
"lint:all": "backstage-cli repo lint",
|
||||
|
||||
@@ -70,6 +70,10 @@ export function registerRepoCommand(program: Command) {
|
||||
command
|
||||
.command('fix')
|
||||
.description('Automatically fix packages in the project')
|
||||
.option(
|
||||
'--publish',
|
||||
'Enable additional fixes that only apply when publishing packages',
|
||||
)
|
||||
.option(
|
||||
'--check',
|
||||
'Fail if any packages would have been changed by the command',
|
||||
|
||||
@@ -428,17 +428,18 @@ export function fixPluginPackages(
|
||||
}
|
||||
}
|
||||
|
||||
type PackageFixer = (pkg: FixablePackage, packages: FixablePackage[]) => void;
|
||||
|
||||
export async function command(opts: OptionValues): Promise<void> {
|
||||
const packages = await readFixablePackages();
|
||||
const fixRepositoryField = createRepositoryFieldFixer();
|
||||
|
||||
const fixers = [
|
||||
fixPackageExports,
|
||||
fixSideEffects,
|
||||
fixRepositoryField,
|
||||
fixPluginId,
|
||||
fixPluginPackages,
|
||||
];
|
||||
const fixers: PackageFixer[] = [fixPackageExports, fixSideEffects];
|
||||
|
||||
// Fixers that only apply to repos that publish packages
|
||||
if (opts.publish) {
|
||||
fixers.push(fixRepositoryField, fixPluginId, fixPluginPackages);
|
||||
}
|
||||
|
||||
for (const fixer of fixers) {
|
||||
for (const pkg of packages) {
|
||||
|
||||
Reference in New Issue
Block a user