Skip to content

Commit

Permalink
CI: fix not finding the binary in another directory (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored Sep 21, 2024
1 parent ea4e4a0 commit fbfa314
Show file tree
Hide file tree
Showing 24 changed files with 216 additions and 8 deletions.
3 changes: 3 additions & 0 deletions packages/chdman-darwin-arm64/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-darwin-arm64/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman',
);
2 changes: 2 additions & 0 deletions packages/chdman-darwin-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-darwin-x64/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-darwin-x64/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman',
);
2 changes: 2 additions & 0 deletions packages/chdman-darwin-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-linux-arm/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-linux-arm/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman',
);
2 changes: 2 additions & 0 deletions packages/chdman-linux-arm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-linux-arm64/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-linux-arm64/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman',
);
2 changes: 2 additions & 0 deletions packages/chdman-linux-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-linux-ia32/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-linux-ia32/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman',
);
2 changes: 2 additions & 0 deletions packages/chdman-linux-ia32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-linux-x64/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-linux-x64/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman',
);
2 changes: 2 additions & 0 deletions packages/chdman-linux-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-win32-ia32/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-win32-ia32/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman.exe');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman.exe',
);
2 changes: 2 additions & 0 deletions packages/chdman-win32-ia32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/chdman-win32-x64/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc"]
}
23 changes: 22 additions & 1 deletion packages/chdman-win32-x64/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';

export default path.join(url.fileURLToPath(new URL('.', import.meta.url)), 'chdman.exe');
/**
* Search for a {@link fileName} in {@link filePath} or any of its parent directories.
*/
function scanUpPathForFile(filePath: string, fileName: string): string | undefined {
const fullPath = path.join(filePath, fileName);
if (fs.existsSync(fullPath)) {
return fullPath;
}

const parentPath = path.dirname(filePath);
if (parentPath !== filePath) {
return scanUpPathForFile(path.dirname(filePath), fileName);
}

return undefined;
}

export default scanUpPathForFile(
url.fileURLToPath(new URL('.', import.meta.url)),
'chdman.exe',
);
2 changes: 2 additions & 0 deletions packages/chdman-win32-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"scripts": {
"build": "tsc --build --verbose",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepack": "npm run build && cp -f ../../LICENSE ../../README.md ./",
"postpack": "rm ./LICENSE ./README.md"
},
Expand Down

0 comments on commit fbfa314

Please sign in to comment.