diff --git a/global-run.cjs b/global-run.cjs index 8257ca1..b644e9c 100755 --- a/global-run.cjs +++ b/global-run.cjs @@ -18,5 +18,5 @@ const memoryAllocation = Math.floor((totalMemory / (1024 * 1024)) * 0.8); // Con console.log(`Index can use up to: ${memoryAllocation}MB RAM`); // Running the application -spawn('node', [`--max-old-space-size=${memoryAllocation}`, path.resolve(__dirname, 'build', 'cjs', 'downloadnet.cjs')], { stdio: 'inherit' }); +spawn('node', [`--max-old-space-size=${memoryAllocation}`, path.resolve(__dirname, 'build', 'global', 'downloadnet.cjs')], { stdio: 'inherit' }); diff --git a/scripts/build_only.sh b/scripts/build_only.sh index 1f514a2..1532a6b 100755 --- a/scripts/build_only.sh +++ b/scripts/build_only.sh @@ -18,16 +18,19 @@ else ./node_modules/.bin/esbuild src/app.js --bundle --outfile=build/esm/downloadnet.mjs --format=esm --platform=node --minify --analyze ./node_modules/.bin/esbuild src/app.js --bundle --outfile=build/cjs/out.cjs --platform=node --minify --analyze fi -echo "const bigR = require('module').createRequire(__dirname); require = bigR;" > build/cjs/dn.cjs +echo "const bigR = require('module').createRequire(__dirname); require = bigR; process.traceProcessWarnings = true; " > build/cjs/dn.cjs +# polyfill for process.disableWarning idea as node arg --disableWarning=ExperimentalWarning is likely not accessible in this setup +#echo "const __orig_emit = process.emit; process.emit = (event, error) => event === 'warning' && error.name === 'ExperimentalWarning' ? false : originalEmit.call(process, event, error);" >> build/cjs/dn.cjs +# although we can use the sea config key disableExperimentalSEAWarning to achieve same cat build/cjs/out.cjs >> build/cjs/dn.cjs echo "#!/usr/bin/env node" > build/global/downloadnet.cjs -cat build/cjs/out.cjs >> build/global/downloadnet.cjs +cat build/cjs/dn.cjs >> build/global/downloadnet.cjs chmod +x build/global/downloadnet.cjs if [[ "$OSTYPE" == darwin* ]]; then - ./stampers/macos.sh dn build/cjs/out.cjs build/bin/ + ./stampers/macos.sh dn build/cjs/dn.cjs build/bin/ elif [[ "$OSTYPE" == win* ]]; then - ./stampers/win.sh dn build/cjs/out.cjs build/bin/ + ./stampers/win.sh dn build/cjs/dn.cjs build/bin/ else - ./stampers/nix.sh build/cjs/out.cjs build/bin/ + ./stampers/nix.sh build/cjs/dn.cjs build/bin/ fi diff --git a/stampers/macos.sh b/stampers/macos.sh index 211fbef..4c9b838 100755 --- a/stampers/macos.sh +++ b/stampers/macos.sh @@ -25,6 +25,7 @@ cat < sea-config.json { "main": "${JS_SOURCE_FILE}", "output": "sea-prep.blob", + "disableExperimentalSEAWarning": true, "useCodeCache": true, "assets": { "index.html": "public/index.html",