-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): detect persist config from print-config
- Loading branch information
1 parent
836b242
commit ad8bd28
Showing
16 changed files
with
294 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
import { DEFAULT_PERSIST_FORMAT } from '@code-pushup/models'; | ||
import { executeProcess } from '@code-pushup/utils'; | ||
import type { CommandContext } from '../context.js'; | ||
import { | ||
type PersistedCliFiles, | ||
persistCliOptions, | ||
persistedCliFiles, | ||
} from '../persist.js'; | ||
|
||
export async function runCollect({ | ||
bin, | ||
config, | ||
directory, | ||
silent, | ||
project, | ||
output, | ||
}: CommandContext): Promise<PersistedCliFiles> { | ||
}: CommandContext): Promise<void> { | ||
const { stdout } = await executeProcess({ | ||
command: bin, | ||
args: [ | ||
...(config ? [`--config=${config}`] : []), | ||
...persistCliOptions({ directory, project, output }), | ||
...DEFAULT_PERSIST_FORMAT.map(format => `--persist.format=${format}`), | ||
], | ||
cwd: directory, | ||
}); | ||
if (!silent) { | ||
console.info(stdout); | ||
} | ||
|
||
return persistedCliFiles({ directory, project, output }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
import { join } from 'node:path'; | ||
import { | ||
DEFAULT_PERSIST_FILENAME, | ||
DEFAULT_PERSIST_OUTPUT_DIR, | ||
} from '@code-pushup/models'; | ||
import { executeProcess } from '@code-pushup/utils'; | ||
import type { CommandContext } from '../context.js'; | ||
import { | ||
type PersistedCliFiles, | ||
persistCliOptions, | ||
persistedCliFiles, | ||
} from '../persist.js'; | ||
|
||
export async function runMergeDiffs( | ||
files: string[], | ||
{ bin, config, directory, silent, output }: CommandContext, | ||
): Promise<PersistedCliFiles<'md'>> { | ||
{ bin, config, directory, silent }: CommandContext, | ||
): Promise<string> { | ||
const outputDir = join(process.cwd(), DEFAULT_PERSIST_OUTPUT_DIR); | ||
const filename = `merged-${DEFAULT_PERSIST_FILENAME}`; | ||
|
||
const { stdout } = await executeProcess({ | ||
command: bin, | ||
args: [ | ||
'merge-diffs', | ||
...files.map(file => `--files=${file}`), | ||
...(config ? [`--config=${config}`] : []), | ||
...persistCliOptions({ directory, output }), | ||
`--persist.outputDir=${outputDir}`, | ||
`--persist.filename=${filename}`, | ||
], | ||
cwd: directory, | ||
}); | ||
if (!silent) { | ||
console.info(stdout); | ||
} | ||
|
||
return persistedCliFiles({ | ||
directory, | ||
isDiff: true, | ||
formats: ['md'], | ||
output, | ||
}); | ||
return join(outputDir, `${filename}-diff.md`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.