Skip to content

Commit

Permalink
* (bluefox) Added DANGEROUSLY_DISABLE_HOST_CHECK for buildReact
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Sep 19, 2024
1 parent 2b4cd64 commit 0ba06b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ node node_modules/@iobroker/build-tools/convertI18n.js path/to/i18n
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**
* (bluefox) Added DANGEROUSLY_DISABLE_HOST_CHECK for buildReact

### 1.0.2 (2024-09-10)
* (bluefox) Added i18n convert script

Expand Down
10 changes: 8 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
type ChildProcess,
exec, fork,
type IOType,
type CommonSpawnOptions,
type ExecOptions,
} from 'node:child_process';
import { dirname, join } from 'node:path';

Expand Down Expand Up @@ -252,11 +254,15 @@ export function buildReact(
}

return new Promise((resolve, reject) => {
const cpOptions = {
const cpOptions: CommonSpawnOptions = {
stdio: 'pipe' as IOType,
cwd: src,
};

cpOptions.env = {
DANGEROUSLY_DISABLE_HOST_CHECK: 'true',
};

let script;
if (options?.craco) {
script = `${src}/node_modules/@craco/craco/dist/bin/craco.js`;
Expand Down Expand Up @@ -291,7 +297,7 @@ export function buildReact(
let child: ChildProcess;
if (options?.ramSize || options?.exec) {
const cmd = `node ${script}${options.ramSize ? ` --max-old-space-size=${options.ramSize}` : ''} build`;
child = exec(cmd, cpOptions);
child = exec(cmd, cpOptions as ExecOptions);
} else {
child = fork(script, ['build'], cpOptions);
}
Expand Down

0 comments on commit 0ba06b8

Please sign in to comment.