Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts committed Jul 11, 2024
1 parent 279eda5 commit e933eb9
Show file tree
Hide file tree
Showing 5 changed files with 827 additions and 443 deletions.
16 changes: 8 additions & 8 deletions __tests__/__snapshots__/cli.ts.snap
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`cli > should error on invalid commits range 1`] = `
"[Error: Failed to parse response body: error decoding response body: missing field \`commits\` at line 1 column 110] {
"[Error: Failed to parse response body: error decoding response body: missing field \`commits\` at line 1 column 125] {
code: 'GenericFailure'
}"
`;

exports[`cli > should error without required arguments 1`] = `
"error: The following required arguments were not provided:
"error: the following required arguments were not provided:
<BASE>
<HEAD>
Usage: @lekoarts/thanks-contributors <BASE> <HEAD> [OWNER] [REPO]
For more information try '--help'"
For more information, try '--help'."
`;
exports[`cli > should show help command 1`] = `
Expand Down Expand Up @@ -48,14 +48,14 @@ Options:
-e, --excludes <EXCLUDES>...
List of members to exclude from the list. Usage: -e=member1,member2 [default:
\\"renovate-bot\\", \\"renovate[bot]\\"]
"renovate-bot", "renovate[bot]"]
-v, --verbose...
More output per occurrence
Increase logging verbosity
-q, --quiet...
Less output per occurrence
Decrease logging verbosity
-h, --help
Print help information (use \`-h\` for a summary)"
Print help (see a summary with '-h')"
`;
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

/* auto-generated by NAPI-RS */

export function run(args: Array<string>): Promise<void>
export declare function run(args: Array<string>): Promise<void>
72 changes: 68 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */

/* auto-generated by NAPI-RS */

const { existsSync, readFileSync } = require('fs')
const { join } = require('path')

Expand All @@ -11,7 +17,7 @@ function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim();
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
Expand Down Expand Up @@ -218,14 +224,72 @@ switch (platform) {
}
break
case 'arm':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'thanks-contributors.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./thanks-contributors.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@lekoarts/thanks-contributors-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'thanks-contributors.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./thanks-contributors.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@lekoarts/thanks-contributors-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'thanks-contributors.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./thanks-contributors.linux-riscv64-musl.node')
} else {
nativeBinding = require('@lekoarts/thanks-contributors-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'thanks-contributors.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./thanks-contributors.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@lekoarts/thanks-contributors-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'thanks-contributors.linux-arm-gnueabihf.node')
join(__dirname, 'thanks-contributors.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./thanks-contributors.linux-arm-gnueabihf.node')
nativeBinding = require('./thanks-contributors.linux-s390x-gnu.node')
} else {
nativeBinding = require('@lekoarts/thanks-contributors-linux-arm-gnueabihf')
nativeBinding = require('@lekoarts/thanks-contributors-linux-s390x-gnu')
}
} catch (e) {
loadError = e
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
],
"license": "MIT",
"devDependencies": {
"@napi-rs/cli": "^2.14.0",
"@types/prettier": "^2.7.2",
"execa": "^6.1.0",
"prettier": "^2.8.1",
"strip-ansi": "^7.0.1",
"vitest": "^0.26.2"
"@napi-rs/cli": "^2.18.4",
"@types/prettier": "^3.0.0",
"execa": "^9.3.0",
"prettier": "^3.3.2",
"strip-ansi": "^7.1.0",
"vitest": "^2.0.2"
},
"engines": {
"node": ">= 14"
Expand Down
Loading

0 comments on commit e933eb9

Please sign in to comment.