Skip to content

Commit d4e99f0

Browse files
authored
fix: Default puppeteer-config to not set executable path unless OS is… (#235)
* fix: Default puppeteer-config to not set executable path unless OS is anything but Windows * attempt to remove setting default executable path to troubleshoot mac os test failure in github actions * . * cross-env use for windows
1 parent 7d3b9a5 commit d4e99f0

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

__tests__/disabled-env.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test('disabled-env.prisma', async () => {
66
const folderName = '__tests__';
77
child_process.execSync(`rm -f ${folderName}/${fileName}`);
88
child_process.execSync(
9-
`npx cross-env DISABLE_ERD=true prisma generate --schema ./prisma/disabled-env.prisma`
9+
`cross-env DISABLE_ERD=true prisma generate --schema ./prisma/disabled-env.prisma`
1010
);
1111
const exists = fs.existsSync(`${folderName}/${fileName}`);
1212
expect(exists).toBe(false);

package-lock.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"all-contributors-cli": "^6.26.1",
109109
"babel-jest": "^29.6.2",
110110
"concurrently": "^8.2.0",
111+
"cross-env": "^7.0.3",
111112
"jest": "^29.6.2",
112113
"mermaid": "^10.3.0",
113114
"prettier": "3.0.1",

src/generate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export default async (options: GeneratorOptions) => {
442442
const tempPuppeteerConfigFile = path.resolve(
443443
path.join(tmpDir, 'puppeteerConfig.json')
444444
);
445-
const executablePath = '/usr/bin/chromium-browser';
445+
let executablePath: string | undefined;
446446
let puppeteerConfigJson: PuppeteerConfiguration & {
447447
args: string[];
448448
} = {
@@ -468,6 +468,7 @@ export default async (options: GeneratorOptions) => {
468468
console.log(
469469
`\nPrisma ERD Generator: Unable to find chromium path for you MacOS arm64 machine. Attempting to use the default at ${executablePath}. To learn more visit https://github.com/keonik/prisma-erd-generator#-arm64-users-\n`
470470
);
471+
executablePath = '/usr/bin/chromium-browser';
471472
}
472473
}
473474
fs.writeFileSync(

0 commit comments

Comments
 (0)