Skip to content

Commit

Permalink
Bump xo from 0.54.2 to 0.57.0 (#567)
Browse files Browse the repository at this point in the history
* Bump xo from 0.54.2 to 0.57.0

Dependabot couldn't find the original pull request head commit, 3e8d708.

* Fix latest XO errors

* Update `ava` to `6.1.2`

* Copy tsconfig.json instead of extending it

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alejandro Hernández <info@alejandrohdezma.com>
  • Loading branch information
dependabot[bot] and alejandrohdezma authored Feb 29, 2024
1 parent b728d0d commit 2e863c0
Show file tree
Hide file tree
Showing 8 changed files with 4,521 additions and 4,022 deletions.
8,443 changes: 4,467 additions & 3,976 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "scala-steward-action",
"description": "A GitHub Action to launch Scala Steward in your repository",
"scripts": {
"tsconfig": "echo '{ \"extends\": \"@tsconfig/node20/tsconfig.json\" }' > tsconfig.json",
"tsconfig": "cp node_modules/@tsconfig/node20/tsconfig.json tsconfig.json",
"build": "npm run tsconfig && npm run build-pre && npm run build-main && npm run build-post",
"build-pre": "ncc build --target es2022 src/action/pre.ts && mv dist/index.js dist/pre.js",
"build-main": "ncc build --target es2022 src/action/main.ts && mv dist/index.js dist/main.js",
Expand Down Expand Up @@ -51,15 +51,15 @@
"@types/node": "^20.4.5",
"@vercel/ncc": "^0.36.1",
"all-contributors-cli": "^6.26.1",
"ava": "^5.3.1",
"ava": "^6.1.2",
"c8": "^7.13.0",
"js-yaml": "^4.1.0",
"markdown-toc-gen": "^1.0.1",
"sinon": "^17.0.1",
"ts-node": "^10.9.1",
"ts-pattern": "^5.0.5",
"typescript": "^5.2.2",
"xo": "^0.54.2"
"xo": "^0.57.0"
},
"xo": {
"space": true,
Expand Down
40 changes: 20 additions & 20 deletions src/action/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,25 @@ async function run(): Promise<void> {
: 'scala-steward'

await coursier.launch(app, [
arg('--workspace', workspace.workspace),
arg('--repos-file', workspace.repos_md),
arg('--git-ask-pass', workspace.askpass_sh),
arg('--git-author-email', inputs.commits.author.email ?? user.email()),
arg('--git-author-name', inputs.commits.author.name ?? user.name()),
arg('--forge-login', user.login()),
arg('--env-var', nonEmpty('"SBT_OPTS=-Xmx2048m -Xss8m -XX:MaxMetaspaceSize=512m"')),
arg('--process-timeout', inputs.steward.timeout),
arg('--forge-api-host', inputs.github.apiUrl),
arg('--ignore-opts-files', inputs.steward.ignoreOptsFiles),
arg('--sign-commits', inputs.commits.sign.enabled),
arg('--git-author-signing-key', inputs.commits.sign.key),
arg('--cache-ttl', inputs.steward.cacheTtl),
arg('--max-buffer-size', inputs.steward.maxBufferSize),
arg('--scalafix-migrations', inputs.migrations.scalafix),
arg('--artifact-migrations', inputs.migrations.artifacts),
arg('--repo-config', inputs.steward.defaultConfiguration),
arg('--github-app-id', inputs.github.app && !inputs.github.app.authOnly ? inputs.github.app.id : undefined),
arg('--github-app-key-file', inputs.github.app && !inputs.github.app.authOnly ? workspace.app_pem : undefined),
argument('--workspace', workspace.workspace),
argument('--repos-file', workspace.repos_md),
argument('--git-ask-pass', workspace.askpass_sh),
argument('--git-author-email', inputs.commits.author.email ?? user.email()),
argument('--git-author-name', inputs.commits.author.name ?? user.name()),
argument('--forge-login', user.login()),
argument('--env-var', nonEmpty('"SBT_OPTS=-Xmx2048m -Xss8m -XX:MaxMetaspaceSize=512m"')),
argument('--process-timeout', inputs.steward.timeout),
argument('--forge-api-host', inputs.github.apiUrl),
argument('--ignore-opts-files', inputs.steward.ignoreOptsFiles),
argument('--sign-commits', inputs.commits.sign.enabled),
argument('--git-author-signing-key', inputs.commits.sign.key),
argument('--cache-ttl', inputs.steward.cacheTtl),
argument('--max-buffer-size', inputs.steward.maxBufferSize),
argument('--scalafix-migrations', inputs.migrations.scalafix),
argument('--artifact-migrations', inputs.migrations.artifacts),
argument('--repo-config', inputs.steward.defaultConfiguration),
argument('--github-app-id', inputs.github.app && !inputs.github.app.authOnly ? inputs.github.app.id : undefined),
argument('--github-app-key-file', inputs.github.app && !inputs.github.app.authOnly ? workspace.app_pem : undefined),
'--do-not-fork',
'--disable-sandbox',
inputs.steward.extraArgs?.value.split(' ') ?? [],
Expand Down Expand Up @@ -124,7 +124,7 @@ async function gitHubAppToken(app: GitHubAppInfo | undefined, gitHubApiUrl: stri
* @param value The argument's value, empty string, false booleans or undefined will be skipped.
* @returns the argument to add if it should be added; otherwise returns `[]`.
*/
function arg(name: string, value: NonEmptyString | boolean | undefined) {
function argument(name: string, value: NonEmptyString | boolean | undefined) {
if (value instanceof NonEmptyString) {
return [name, value.value]
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export type Logger = {

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const Logger = {
noOp: {info() {}, debug() {}, error() {}, warning() {}, startGroup() {}, endGroup() {}},
noOp: {
info() {}, debug() {}, error() {}, warning() {}, startGroup() {}, endGroup() {},
},

}
36 changes: 19 additions & 17 deletions src/modules/coursier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ export async function install(): Promise<void> {

core.debug(`Installing coursier from ${coursierUrl}`)

const binPath = path.join(os.homedir(), 'bin')
await io.mkdirP(binPath)
const binary = path.join(os.homedir(), 'bin')
await io.mkdirP(binary)

const zip = await tc.downloadTool(coursierUrl, path.join(binPath, 'cs.gz'))
const zip = await tc.downloadTool(coursierUrl, path.join(binary, 'cs.gz'))

await exec.exec('gzip', ['-d', zip], {silent: true})
await exec.exec('chmod', ['+x', path.join(binPath, 'cs')], {silent: true})
await exec.exec('chmod', ['+x', path.join(binary, 'cs')], {silent: true})

core.addPath(binPath)
core.addPath(binary)

await exec.exec(
'cs',
['install', 'scalafmt', 'scalafix', 'scala-cli', '--install-dir', binPath],
['install', 'scalafmt', 'scalafix', 'scala-cli', '--install-dir', binary],
{
silent: true,
listeners: {stdline: core.debug, errline: core.debug},
Expand Down Expand Up @@ -64,25 +64,25 @@ export async function install(): Promise<void> {
* Refer to [coursier](https://get-coursier.io/docs/cli-launch) for more information.
*
* @param app - The application to launch
* @param args - The args to pass to the application launcher.
* @param arguments_ - The args to pass to the application launcher.
*/
export async function launch(
app: string,
args: Array<string | string[]> = [],
arguments_: Array<string | string[]> = [],
): Promise<void> {
core.startGroup(`Launching ${app}`)

const launchArgs = [
const launchArguments = [
'launch',
'--contrib',
'-r',
'sonatype:snapshots',
app,
'--',
...args.flatMap((arg: string | string[]) => (typeof arg === 'string' ? [arg] : arg)),
...arguments_.flatMap((argument: string | string[]) => (typeof argument === 'string' ? [argument] : argument)),
]

const code = await exec.exec('cs', launchArgs, {
const code = await exec.exec('cs', launchArguments, {
silent: true,
ignoreReturnCode: true,
listeners: {stdline: core.info, errline: core.error},
Expand Down Expand Up @@ -110,19 +110,21 @@ export async function remove(): Promise<void> {
/**
* Executes a tool and returns its output.
*/
async function execute(tool: string, ...args: string[]): Promise<string> {
async function execute(tool: string, ...arguments_: string[]): Promise<string> {
let output = ''

const code = await exec.exec(tool, args, {
const code = await exec.exec(tool, arguments_, {
silent: true,
ignoreReturnCode: true,
listeners: {stdout(data) {
(output += data.toString())
}, errline: core.debug},
listeners: {
stdout(data) {
(output += data.toString())
}, errline: core.debug,
},
})

if (code !== 0) {
throw new Error(`There was an error while executing '${tool} ${args.join(' ')}'`)
throw new Error(`There was an error while executing '${tool} ${arguments_.join(' ')}'`)
}

return output
Expand Down
4 changes: 3 additions & 1 deletion src/modules/input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ test('`Input.githubAppInfo()` → returns GitHub App info', t => {

const file = input.githubAppInfo()

t.deepEqual(file, {authOnly: true, id: nonEmpty('123'), key: nonEmpty('42'), installation: nonEmpty('456')})
t.deepEqual(file, {
authOnly: true, id: nonEmpty('123'), key: nonEmpty('42'), installation: nonEmpty('456'),
})
})

test('`Input.githubAppInfo()` → returns undefined on missing inputs', t => {
Expand Down
4 changes: 3 additions & 1 deletion src/modules/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ export class Input {
}

if (id && key) {
return {authOnly, id, installation, key}
return {
authOnly, id, installation, key,
}
}

throw new Error('`github-app-id` and `github-app-key` inputs have to be set together. One of them is missing')
Expand Down
6 changes: 3 additions & 3 deletions src/modules/mill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export async function install(): Promise<void> {

core.debug(`Attempting to install Mill from ${millUrl}`)

const binPath = path.join(os.homedir(), 'bin')
await io.mkdirP(binPath)
const binary = path.join(os.homedir(), 'bin')
await io.mkdirP(binary)

const mill = await tc.downloadTool(millUrl, path.join(binPath, 'mill'))
const mill = await tc.downloadTool(millUrl, path.join(binary, 'mill'))

await exec.exec('chmod', ['+x', mill], {silent: true, ignoreReturnCode: true})

Expand Down

0 comments on commit 2e863c0

Please sign in to comment.