Skip to content

Commit

Permalink
Merge pull request #116 from Cyberbeni/deprecation-fix
Browse files Browse the repository at this point in the history
fix rmdir being deprecated
  • Loading branch information
Cyberbeni authored Mar 22, 2022
2 parents 82f19e5 + 3a7583b commit d9c1220
Show file tree
Hide file tree
Showing 5 changed files with 1,232 additions and 1,265 deletions.
7 changes: 4 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@
"author": "Cyberbeni",
"license": "MIT",
"dependencies": {
"@actions/cache": "^1.0.8",
"@actions/cache": "^1.0.10",
"@actions/core": "^1.6.0",
"@actions/exec": "^1.1.0",
"@actions/exec": "^1.1.1",
"os": "^0.1.2",
"semver": "^7.3.5",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/jest": "^27.0.3",
"@types/node": "^16.11.11",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.22",
"@types/semver": "^7.3.9",
"@types/uuid": "^8.3.3",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@vercel/ncc": "^0.32.0",
"eslint": "^8.3.0",
"jest": "^27.4.2",
"jest-circus": "^27.4.2",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@vercel/ncc": "^0.33.3",
"eslint": "^8.11.0",
"jest": "^27.5.1",
"jest-circus": "^27.5.1",
"ts-jest": "^27.1.3",
"typescript": "^4.6.2"
}
}
12 changes: 0 additions & 12 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,3 @@ export function logError(error: unknown): void {
core.info(`Unexpected error type: '${typeof error}'`)
}
}

export async function supportedBuildOptions(argsToTest: string[]): Promise<string[]> {
const helpText = await exec('swift', ['build', '--help'])
const validArgs: string[] = []
for (const arg of argsToTest) {
const regex = RegExp(`(${arg})\\s`)
if (regex.test(helpText)) {
validArgs.push(arg)
}
}
return validArgs
}
7 changes: 3 additions & 4 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs'
import * as os from 'os'
import * as semver from 'semver'

import { exec, getUuid, logError, supportedBuildOptions } from './helpers'
import { exec, getUuid, logError } from './helpers'

export class SwiftToolInstaller {
// Input
Expand Down Expand Up @@ -97,8 +97,7 @@ export class SwiftToolInstaller {
// They didn't make any difference when building SwiftLint
// '--disable-automatic-resolution' caused build error on Linux for realm/[email protected]:
// 'cannot update Package.resolved file because automatic resolution is disabled'
const additionalOptions = await supportedBuildOptions(['--disable-sandbox'])
await exec('swift', ['build', '--package-path', this.workingDirectory, '--configuration', 'release'].concat(additionalOptions))
await exec('swift', ['build', '--package-path', this.workingDirectory, '--configuration', 'release', '--disable-sandbox'])
})
}

Expand All @@ -110,7 +109,7 @@ export class SwiftToolInstaller {
const itemPath = `${this.productDirectory}/${itemName}`
try {
if (fs.lstatSync(itemPath).isDirectory()) {
fs.rmdirSync(itemPath, { recursive: true })
fs.rmSync(itemPath, { recursive: true })
} else {
fs.accessSync(itemPath, fs.constants.X_OK)
}
Expand Down
Loading

0 comments on commit d9c1220

Please sign in to comment.