Implement single Command per multiple packages for latestVersion
https://github.com/omaha-consulting/winstall/issues/167
Can install multiple packages within a single winget install command. The UI radio to toggle the singleCmd mode could be placed at another location
Thanks, but this gives an error.
Thanks for the feedback. Unfortunately I was blind-developing since
- I did clone the repo and installed via
npm ibut this yielded react 16 vs 17 dependency conflict, so I had tonpm i --legacy-peer-deps- see complete logs below - then
npm run devbut hittinghttp://localhost:3000yields errorOops! Could not fetch data from Winstall API. The console shows other errors,utils\fetchWinstallAPI.js (52:28) @ fetchWinstallAPI Error: TypeError: Only absolute URLs are supported- complete log below - so I also tried
npm run buildbut resulted in many build errors - see complete logs below
It would be great if original authors/team could resolve these dev environment setup issues before anyone can contribute.
Complete logs collapsed
npm install
C:\Dev\Iconem\winstall>npm i
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peer react@"^17.0.2 || ^18.0.0-0" from [email protected]
npm ERR! node_modules/next
npm ERR! next@"^12.0.8" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.13.1" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! react-dom@"16.13.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm run dev
C:\Dev\Iconem\winstall>npm run dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> [email protected] dev
> next
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
> [PWA] PWA support is disabled
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
event - compiled client and server successfully in 10.6s (211 modules)
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
wait - compiling / (client and server)...
event - compiled client and server successfully in 2.3s (362 modules)
Only absolute URLs are supported
Only absolute URLs are supported
wait - compiling /api/auth/[...nextauth]...
event - compiled client and server successfully in 93 ms (338 modules)
[next-auth][warn][NEXTAUTH_URL]
https://next-auth.js.org/warnings#nextauth_url
[next-auth][warn][NO_SECRET]
https://next-auth.js.org/warnings#no_secret
wait - compiling /apps...
event - compiled client and server successfully in 203 ms (333 modules)
wait - compiling /apps (client and server)...
event - compiled client and server successfully in 128 ms (358 modules)
wait - compiling /_error (client and server)...
event - compiled client and server successfully in 60 ms (359 modules)
error - utils\fetchWinstallAPI.js (52:28) @ fetchWinstallAPI
Error: TypeError: Only absolute URLs are supported
50 | }
51 |
> 52 | return { response, error };
| ^
53 | };
54 |
55 | module.exports = fetchWinstallAPI;
error - utils\fetchWinstallAPI.js (52:28) @ fetchWinstallAPI
Error: TypeError: Only absolute URLs are supported
50 | }
51 |
> 52 | return { response, error };
| ^
53 | };
54 |
55 | module.exports = fetchWinstallAPI;
wait - compiling / (client and server)...
event - compiled client and server successfully in 52 ms (374 modules)
Only absolute URLs are supported
Only absolute URLs are supported
npm run build
C:\Dev\Iconem\winstall>npm run build
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> [email protected] build
> next build
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
info - Checking validity of types
warn - No ESLint configuration detected. Run next lint to begin setup
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
> [PWA] Compile server
> [PWA] Compile client (static)
> [PWA] Auto register service worker with: C:\Dev\Iconem\winstall\node_modules\next-pwa\register.js
> [PWA] Service worker: C:\Dev\Iconem\winstall\public\sw.js
> [PWA] url: /sw.js
> [PWA] scope: /
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
info - Creating an optimized production build
warn - Compiled with warnings
./components/AppExport/ExportApps.js
Attempted import error: 'RadioConfig' is not exported from './AdvancedConfig' (imported as 'RadioConfig').
Import trace for requested module:
./pages/generate.js
./components/AppExport/ExportApps.js
Attempted import error: 'AdvancedConfig' is not exported from './AdvancedConfig' (imported as 'AdvancedConfig').
Import trace for requested module:
./pages/generate.js
./components/AppExport/ExportApps.js
Attempted import error: 'RadioConfig' is not exported from './AdvancedConfig' (imported as 'RadioConfig').
Import trace for requested module:
./pages/generate.js
./components/AppExport/ExportApps.js
Attempted import error: 'AdvancedConfig' is not exported from './AdvancedConfig' (imported as 'AdvancedConfig').
Import trace for requested module:
./pages/generate.js
info - Collecting page data
[ ] info - Generating static pages (0/13)
Error occurred prerendering page "/apps". Read more: https://nextjs.org/docs/messages/prerender-error
Error: TypeError: Only absolute URLs are supported
at fetchWinstallAPI (C:\Dev\Iconem\winstall\.next\server\chunks\111.js:52:19)
at async getStaticProps (C:\Dev\Iconem\winstall\.next\server\pages\apps.js:378:39)
at async renderToHTML (C:\Dev\Iconem\winstall\node_modules\next\dist\server\render.js:438:20)
at async C:\Dev\Iconem\winstall\node_modules\next\dist\export\worker.js:275:36
at async Span.traceAsyncFn (C:\Dev\Iconem\winstall\node_modules\next\dist\trace\trace.js:75:20)
Error occurred prerendering page "/packs". Read more: https://nextjs.org/docs/messages/prerender-error
Error: TypeError: Only absolute URLs are supported
at fetchWinstallAPI (C:\Dev\Iconem\winstall\.next\server\chunks\111.js:52:19)
at async getStaticProps (C:\Dev\Iconem\winstall\.next\server\pages\packs.js:240:40)
at async renderToHTML (C:\Dev\Iconem\winstall\node_modules\next\dist\server\render.js:438:20)
at async C:\Dev\Iconem\winstall\node_modules\next\dist\export\worker.js:275:36
at async Span.traceAsyncFn (C:\Dev\Iconem\winstall\node_modules\next\dist\trace\trace.js:75:20)
Only absolute URLs are supported
Only absolute URLs are supported
info - Generating static pages (13/13)
> Build error occurred
Error: Export encountered errors on following paths:
/apps
/packs
at C:\Dev\Iconem\winstall\node_modules\next\dist\export\index.js:500:19
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Span.traceAsyncFn (C:\Dev\Iconem\winstall\node_modules\next\dist\trace\trace.js:75:20)
at async C:\Dev\Iconem\winstall\node_modules\next\dist\build\index.js:1005:17
at async Span.traceAsyncFn (C:\Dev\Iconem\winstall\node_modules\next\dist\trace\trace.js:75:20)
at async C:\Dev\Iconem\winstall\node_modules\next\dist\build\index.js:879:13
at async Span.traceAsyncFn (C:\Dev\Iconem\winstall\node_modules\next\dist\trace\trace.js:75:20)
at async Object.build [as default] (C:\Dev\Iconem\winstall\node_modules\next\dist\build\index.js:82:25)
Note after digging through fetchWinstallAPI.js, it seems that I'm simply missing env variables NEXT_PUBLIC_WINGET_API_BASE, NEXT_PUBLIC_WINGET_API_KEY, NEXT_PUBLIC_WINGET_API_SECRET and NEXT_OFFICIAL_PACKS_CREATOR. There are no indications on the repo as to where to get these from.
It seems that the latest builds which are served at winstall.app have diverged quite significantly from where this repo main branch is at. Has this happened after the winget.pro take-over? It's pretty hard to make PRs if the codebases are so much different and dev environment setup is not more explicit.
Anyway, I cheated a bit by setting set NEXT_PUBLIC_WINGET_API_BASE=https://winstall.app/_next/data/4u2-IVAjwkTP5DcjnoraW/, and managed to have my PR work - see screenshot. I still had to add two fixes for the PR to run:
- Replace
setApps(data);withsetApps(data.pageProps.data);inpages\apps.js - Replace
fetchWinstallAPI('/apps',, withfetchWinstallAPI('/apps.json',everywhere where needed (pages\apps.js,pages\index.js,pages\packs\create.js,pages\packs\edit.js,pages\sitemap.xml.js)
Gaining screen space using single command vs one command per package
Advanced config new UI parameter
Hi @mherrmann, just a quick ping, this PR for a single winget command for multiple packages can be merged if it's ok from your point-of-view!
I'm sorry, this is still giving (JSON decode) errors. I suspect the new errors are coming from your switch to to .json suffix. winstall.app does run on master. I understand this is all slow and painful to set up but I do not have time to dig deeper or provide better instructions. Sorry.
Thanks for getting back! Just re-run the whole stack to make sure everything works, and it went smoothly. The steps to reproduce - which could be avoided following little updates -
- Get id of current web build by going to https://winstall.app/, then open the Network tab of chrome/firefox requests and look for
https://winstall.app/_next/data/{build-id} - Pull my PR which is against
master,npm i --legacy-peer-deps set NEXT_PUBLIC_WINGET_API_BASE=https://winstall.app/_next/data/9WtphRTE4CwprWfIQ-M9Ynpm run devthen go to http://localhost:3000/apps select a bunch of apps,Generate Scriptand select the advanced-optionSingle command for multiple packages
This sequence of steps returns the above screen. Hope this makes sense!
I tried it in production and it produced the JSON decode errors I mentioned above.
Ok, that's weird. I'm trying to revert these 2 below commits from but then fetching http://localhost:3000/apps results error 500 visible in the following screen:
- Replace setApps(data); with setApps(data.pageProps.data); in pages\apps.js
- Replace fetchWinstallAPI('/apps',, with fetchWinstallAPI('/apps.json', everywhere where needed (pages\apps.js, pages\index.js, pages\packs\create.js, pages\packs\edit.js, pages\sitemap.xml.js)
Could it be that my process.env.NEXT_PUBLIC_WINGET_API_BASE is not the correct one? Or rather that auth header NEXT_PUBLIC_WINGET_API_KEY, NEXT_PUBLIC_WINGET_API_SECRET are incorrect and it returns wrong results.
EDIT: I've reverted these changes in the last commit if you want to test it in production/
Hi @mherrmann just saw you recently merged some PRs on this repo, interested in merging this one? Would be very useful to allow multi package installs from a single winget command. Otherwise feel free to close the PR!
@jo-chemla I'm afraid I don't have time to look into it, sorry. I'll close the PR.
Thanks for getting back - a bit sad given how simple the PR was, plus it was working as intended on my end and fixing it for someone knowledgeable with that repo codebase would have been probably a no-brainer.
But totally understandable, thanks!