Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mrc 5951 - Address misc comments #218

Merged
merged 4 commits into from
Nov 13, 2024
Merged

Mrc 5951 - Address misc comments #218

merged 4 commits into from
Nov 13, 2024

Conversation

M-Kusumgar
Copy link
Collaborator

@M-Kusumgar M-Kusumgar commented Nov 5, 2024

This addresses misc comments we made during dicussions. Main changes include:

  • README updates, with sections on adding more Fontawesome icons and a section explaining hot reloading
  • server.js file now takes in a boolean and errors if a boolean isnt provided for --hot-reload option
  • we switch the sources in the app.hbs view based on if hotReload is enabled or not, i didnt switch the js and css srcs explicitly because with chunking in the production file we may need to include more than one script tag
  • removed fontawesome dependency, we dont need it as we have the assets from it already
  • we do not need to start a dev server when playwright does its testing because our express app serves the js files so changed npm run preview (which build for prod and starts a server) to npm run build
  • added comment in fontawesome.css pointing to the README if you want to add more icons
  • parseTime -> parseDateTime
  • removed unnecessary exports from interfaces
  • EventEmitter just works! but before it was { EventEmitter } from ... and now its EventEmitter from ...
  • Token and Renderer types from markdown-it/index.d.ts
  • correct type for PlotData now we explicitly define the PlotData.x and PlotData.y type as number[]
  • correct css src for index.html in config folder, before we used to extract out bootstrap.css by copying that file from node_modules/bootstrap. to keep it simpler ive just gone with using wodin.css which has bootstrap in it. This does mean that we need to update the index.html in wodin configs for all of the repos online but theres like 10 repos max so i think it is worth it for the extra simplcity

@M-Kusumgar M-Kusumgar changed the title Mrc 5951 Mrc 5951 - Address misc comments Nov 5, 2024
Copy link
Contributor

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

This does mean that we need to update the index.html in wodin configs for all of the repos online but theres like 10 repos max so i think it is worth it for the extra simplcity

Better make a ticket in the epic so we remember to do that!

@@ -133,3 +140,9 @@ Use the `./scripts/run-version.sh` script setting the branch references for the
```
./scripts/run-version.sh --app mrc-1234 --api mrc-2345
```

## Hot Reloading
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just mention in here what npm command each of these corresponds to as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

export const processArgs = (argv: string[] = process.argv) => {
const opts = docopt(doc, { argv: argv.slice(2), version, exit: false });
const path = opts["<path>"] as string;
const given = {
baseUrl: opts["--base-url"] as Perhaps<string>,
odinApi: opts["--odin-api"] as Perhaps<string>,
redisUrl: opts["--redis-url"] as Perhaps<string>,
hotReload: opts["--hot-reload"] as Perhaps<string>,
hotReload: parseArgBoolean(opts["--hot-reload"], "hot-reload"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like hotReload gets passed out of here whether it's null or not, unlike the other args. But it was doing that anyway I think. So null being falsey we just end up with false as hotReload's default I guess?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parseArgBoolean can return null, it is the same as the other args no? they will also be passed as null if not specified, but yes null being falsey means our default is hot reloading as false

@@ -62,7 +62,7 @@ export default defineConfig({
* Use the preview server on CI for more realistic testing.
* Playwright will re-use the local server if there is already a dev-server running.
*/
command: process.env.CI ? 'npm run preview' : 'npm run dev',
command: process.env.CI ? 'npm run build' : 'npm run dev',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the server has already been run earlier in the workflow on CI, so we just need to build the front end?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im actually not 100% sure how we are doing the playwright stuff yet, this is more of an inbetween change because preview builds the production bundle and then serves it but we dont want that in any situation because our express server first needs to inject some variables into it so but changed it to build, the server should be run after the build so that the bundle is copied to the public folder in the server before it starts up

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a broader point ive also been wondering if its worth just changing to github actions for the browser tests, i think its worth it

@M-Kusumgar
Copy link
Collaborator Author

Better make a ticket in the epic so we remember to do that!

done! https://mrc-ide.myjetbrains.com/youtrack/issue/mrc-5966/update-css-src-in-wodin-repos

@M-Kusumgar M-Kusumgar merged commit bac2e15 into mrc-5945 Nov 13, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants