jensbuehl / aoe4-guides

Source code for aoe4guides.com: Yet another Age of Empires IV build order tool
https://aoe4guides.com
MIT License
18 stars 7 forks source link

Build fixes #91

Closed fsarachu closed 5 months ago

fsarachu commented 5 months ago

Vite build fixes

Why:

Cloned this repo to submit some improvement ideas and had to update some stuff to get the project running locally, so I'm creating a PR with the fixes that allowed me to build the project.

PS: Also had to setup Firebase to get the app running, and had no idea how to do it (never used Firebase before), so will send a separate PR updating the Readme with the steps I followed to get it running.

What:

  1. Fix package vulnerabilities:

    npm install was giving the following output:

    $ npm install
    
    added 536 packages, and audited 537 packages in 13s
    
    70 packages are looking for funding
      run `npm fund` for details
    
    19 vulnerabilities (10 low, 5 moderate, 4 critical)
    
    To address all issues, run:
      npm audit fix
    
    Run `npm audit` for details.

    Fixed this by running npm audit fix

  2. Fix build error:

    npm run dev was giving the following output:

    $ npm run dev
    
    > aoe4-guides@1.7.13 dev
    > vite
    
    failed to load config from /Users/fsarachu/Projects/aoe4-guides/vite.config.mjs
    error when starting dev server:
    SyntaxError: Unexpected identifier 'assert'
        at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
        at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:163:18)
        at callTranslator (node:internal/modules/esm/loader:429:14)
        at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:435:30)

    Fixed this by running npm update.

  3. Remove unnecessary alias:

    After the previous fixes, running npm run dev was now giving the following error:

    npm run dev
    
    > aoe4-guides@1.7.13 dev
    > vite
    
    VITE v5.2.12  ready in 608 ms
    
    ➜  Local:   http://localhost:5173/
    ➜  Network: use --host to expose
    ➜  press h + enter to show help
    1:58:41 AM [vite] warning: rewrote source-map-js to source-map but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
    Plugin: alias
    1:58:41 AM [vite] warning: rewrote source-map-js to source-map but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
    Plugin: alias (x2)
    1:58:41 AM [vite] warning: rewrote source-map-js to source-map but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
    Plugin: alias (x3)
    ✘ [ERROR] Could not read from file: /Users/fsarachu/Projects/aoe4-guides/source-map
    
        node_modules/postcss/lib/map-generator.js:3:56:
          3 │ let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')
            ╵                                                         ~~~~~~~~~~~~~~~

    Fixed this by removing some polyfills and aliases from vite.config.mjs

  4. Enforce Node version:

    Added .nvmrc file and "engines" constraint in package.json with the current LTS Node version.

netlify[bot] commented 5 months ago

Deploy Preview for aoe4guides-prod ready!

Name Link
Latest commit d98d0df8283f845836ae762951bbb4860d60ea98
Latest deploy log https://app.netlify.com/sites/aoe4guides-prod/deploys/665c06af1a96a20008d7d6b8
Deploy Preview https://deploy-preview-91--aoe4guides-prod.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

jensbuehl commented 5 months ago

Thanks! I'll take a look and test when time permits. Seems reasonable.

Which ideas had you in mind feature wise?

PS: Thanks for the great explanation what changed and why! Appreciate small PRs and commits.

fsarachu commented 5 months ago

Thanks! I'll take a look and test when time permits. Seems reasonable.

Which ideas had you in mind feature wise?

PS: Thanks for the great explanation what changed and why! Appreciate small PRs and commits.

Sure! I think some improvements could be made in the mobile version, for example making the explanatory tooltip show up when tapping an item (currently only shows on desktop when hovering over units/building/etc).

Also I would like to play with adding some more tools, like hotkeys hints for each building/unit (incorporating something from aegis). Still very early ideas, but maybe some "hotkey practice" mode that would allow you to learn and train all the hotkeys used in the build order. Or even a build order practice mode, that would help you memorize all the steps via a quiz or something similar.

Anyways, I'll submit a PR when I have something and we can discuss it on top of that. Let me know if you have any thoughts about this!

fsarachu commented 5 months ago

BTW, is there any easy way I could set up some local test data to have at least a few build orders available locally to test the app? Maybe you already have some mock data or truncated DB version that would save me some time from doing it myself.

jensbuehl commented 5 months ago

Hotkey practice here: Aegis (aoe-aegis.vercel.app)https://aoe-aegis.vercel.app/

BR


Von: Franco Sarachu @.> Gesendet: Sonntag, 2. Juni 2024 21:29 An: jensbuehl/aoe4-guides @.> Cc: Jens @.>; State change @.> Betreff: Re: [jensbuehl/aoe4-guides] Build fixes (PR #91)

Thanks! I'll take a look and test when time permits. Seems reasonable.

Which ideas had you in mind feature wise?

PS: Thanks for the great explanation what changed and why! Appreciate small PRs and commits.

Sure! I think some improvements could be made in the mobile version, for example making the explanatory tooltip show up when tapping an item (currently only shows on desktop when hovering over units/building/etc).

Also I would like to play with adding some more tools, like hotkeys hints for each building/unit (incorporating something from aegishttps://www.aegis.lol/). Still very early ideas, but maybe some "hotkey practice" mode that would allow you to learn and train all the hotkeys used in the build order. Or even a build order practice mode, that would help you memorize all the steps via a quiz or something similar.

Anyways, I'll submit a PR when I have something and we can discuss it on top of that. Let me know if you have any thoughts about this!

— Reply to this email directly, view it on GitHubhttps://github.com/jensbuehl/aoe4-guides/pull/91#issuecomment-2143995645, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6MUKK2CO3LVDUOJ4H6FQTZFNXBXAVCNFSM6AAAAABIUYPW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTHE4TKNRUGU. You are receiving this because you modified the open/close state.Message ID: @.***>

jensbuehl commented 5 months ago

Well, the solution could be to ask me for debug credentials I guess and use the dev firestore. We should not work on main and prod firestore anyways. 😉

You may ping me on discord and I can share the developer key with you. This should get you started with test data.

BR


Von: Franco Sarachu @.> Gesendet: Sonntag, 2. Juni 2024 21:31 An: jensbuehl/aoe4-guides @.> Cc: Jens @.>; State change @.> Betreff: Re: [jensbuehl/aoe4-guides] Build fixes (PR #91)

BTW, is there any easy way I could set up some local test data to have at least a few build orders available locally to test the app? Maybe you already have some mock data or truncated DB version that would save me some time from doing it myself.

— Reply to this email directly, view it on GitHubhttps://github.com/jensbuehl/aoe4-guides/pull/91#issuecomment-2143996130, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6MUKNEMPGVDPWSLZESZ6LZFNXIRAVCNFSM6AAAAABIUYPW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTHE4TMMJTGA. You are receiving this because you modified the open/close state.Message ID: @.***>