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

Update Elixir and Phoenix and all deps #395

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lleger
Copy link
Member

@lleger lleger commented Aug 6, 2022

  • Look over your code one last time.
  • Test all functionality you expect to be QA'd. Don’t forget to QA user interface changes in the browser.
  • Describe what changes this PR includes.
  • Post screenshots for design review if applicable.
  • Fill in QA Notes listing clear, ordered steps for testers.

Description

Also updates generated files from new Phoenix project. I updated this
manually comparing a fresh Phoenix 1.6.11. I also used the PhoenixDiff
project to double check.

Closes [sc-20388].

Screenshots

N/A

QA Notes

PR Author Browser Info: N/A

**QA Tester Browser Info:**

## Environment Setup

- [ ] `asdf install`
- [ ] `mix deps.get`

## Testing Steps

- [ ] Tests should pass
- [ ] App should boot

## Notes

- [ ] [Tester should add any comments, questions, or concerns that pop up during QA]

@custodian custodian bot added the in-progress Work is ongoing or pending label Aug 6, 2022
@shortcut-integration
Copy link

COPY config config
COPY mix.* ./
RUN mix do deps.get --only=$MIX_ENV, deps.compile
COPY mix.exs mix.lock ./
Copy link
Member Author

Choose a reason for hiding this comment

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

The changes here are mostly due to how Docker caches. Each line creates a new layer. Based on what needs to be recompiled, separating some steps and copying at different points helps maximize the Docker cache, which speeds up the build.

These are picked up from the new Phoenix default Dockerfile.

"deploy": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"scripts": {},
Copy link
Member Author

Choose a reason for hiding this comment

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

@ngscheurich Any thoughts on how to write a script here that mirrors mix lint I added to combine all the JS linters/formatters we have in CI into one command to run locally?

Copy link
Contributor

Choose a reason for hiding this comment

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

@lleger Yep! I'm going to add a commit for this.

def deliver_confirmation_instructions(user, url, true) do
%{email: "confirmation_instructions", user_id: user.id, url: url}
|> UserEmailWorker.new()
|> Oban.insert()
Copy link
Member Author

Choose a reason for hiding this comment

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

The Swoosh README (written by Jose) recommends not doing this unless you have a business case for it, so by default I'm removing this code. It can be added later if the specific app requires it.

@@ -1,35 +0,0 @@
defmodule PhoenixStarterWeb.UserSocket do
Copy link
Member Author

Choose a reason for hiding this comment

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

These are just not generated by default anymore and instead are in a generator.

@lleger lleger force-pushed the logan/sc-20388/update-versions-and-add-any-improvements branch 3 times, most recently from b29b15d to a00917a Compare August 6, 2022 04:51
Also updates generated files from new Phoenix project. I updated this
manually comparing a fresh Phoenix 1.6.11. I also used the [PhoenixDiff]
project to double check.

[phoenixdiff]: https://www.phoenixdiff.org/?source=1.5.6&target=1.6.11
@lleger lleger force-pushed the logan/sc-20388/update-versions-and-add-any-improvements branch from a00917a to 5d0dc9d Compare August 6, 2022 04:57
@@ -88,10 +88,6 @@ jobs:
working-directory: ./assets
- run: npx eslint js --ext .js,.jsx,.ts,.tsx
working-directory: ./assets
- run: npm run deploy
Copy link
Member Author

Choose a reason for hiding this comment

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

This was running web pack, which we no longer need to do.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ngscheurich Is there a lint we can run for Typescript to ensure our types pass? I think this deploy step was added to get the TS checks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, esbuild does not do any type-checking so we'll still need to depend on the typescript package and run npx tsc --noEmit in CI.

@@ -174,9 +170,7 @@ jobs:

- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
Copy link
Member Author

Choose a reason for hiding this comment

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

No longer needed, Dialyxir does this automatically now.

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -69,17 +71,24 @@ defmodule PhoenixStarter.MixProject do
[
ignore_warnings: ".dialyzer_ignore.exs",
plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
flags: [:error_handling, :race_conditions, :underspecs, :unknown],
Copy link
Member Author

Choose a reason for hiding this comment

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

race_conditions dropped in OTP 25

Copy link
Member Author

Choose a reason for hiding this comment

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

@lleger lleger marked this pull request as ready for review August 6, 2022 05:07
@lleger lleger requested a review from ngscheurich August 6, 2022 05:07
@lleger lleger added needs-review Work is finished; awaiting code review and removed in-progress Work is ongoing or pending labels Aug 6, 2022
Copy link
Contributor

@ngscheurich ngscheurich left a comment

Choose a reason for hiding this comment

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

Looks great.

@@ -88,10 +88,6 @@ jobs:
working-directory: ./assets
- run: npx eslint js --ext .js,.jsx,.ts,.tsx
working-directory: ./assets
- run: npm run deploy
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, esbuild does not do any type-checking so we'll still need to depend on the typescript package and run npx tsc --noEmit in CI.

"deploy": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"scripts": {},
Copy link
Contributor

Choose a reason for hiding this comment

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

@lleger Yep! I'm going to add a commit for this.

<%= live_patch "Update profile", to: Routes.user_settings_path(@socket, :profile) %>
<%= live_patch "Update email", to: Routes.user_settings_path(@socket, :email) %>
<%= live_patch "Update password", to: Routes.user_settings_path(@socket, :password) %>
<%= live_patch("Update profile", to: Routes.user_settings_path(@socket, :profile)) %>
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the Phoenix.LiveView.HTMLFormatter added these parens all over the place? I don't like it but I suppose we should abide by the formatter.

@custodian custodian bot added ready-to-merge Work is finished and reviewed; awaiting merge and removed needs-review Work is finished; awaiting code review labels Aug 9, 2022
env:
NODE_ENV: production
working-directory: ./assets
- run: npm run ci
Copy link
Contributor

@ngscheurich ngscheurich Aug 9, 2022

Choose a reason for hiding this comment

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

@lleger Replaced the individual run steps with a single NPM script.

@ngscheurich
Copy link
Contributor

@lleger I added some NPM scripts for linting, formatting, and type checking. These surfaced some TypeScript errors which I'll have a look at tomorrow.

Comment on lines +6 to +15
"ci": "npm run lint && npm run format:check && npm run type-check",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "npm run lint:css && npm run lint:js",
"lint:css": "stylelint css/**/*.css",
"lint:css:fix": "stylelint css/**/*.css --fix",
"lint:fix": "npm run lint:css:fix && npm run lint:js:fix",
"lint:js": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:js:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"type-check": "tsc --noEmit"
Copy link
Contributor

Choose a reason for hiding this comment

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

@lleger How do these scripts look to you?

@@ -6,6 +6,7 @@
"module": "es6",
"moduleResolution": "node",
"noImplicitAny": true,
"skipLibCheck": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is standard in TypeScript projects initialized with tsc --init and now we don't have to remember to include it as a CLI arg.

@ngscheurich ngscheurich added in-progress Work is ongoing or pending and removed ready-to-merge Work is finished and reviewed; awaiting merge labels Aug 9, 2022
Comment on lines +3 to +19
/* Language and Environment */
"target": "ES6",
"lib": ["DOM", "ES2017"],
"jsx": "react",

/* Modules */
"module": "es6",
"moduleResolution": "node",
"noImplicitAny": true,

/* Interop Constraints */
"esModuleInterop": true,

/* Type Checking */
"strict": true,
"target": "es5"

/* Completeness */
"skipLibCheck": true
Copy link
Contributor

Choose a reason for hiding this comment

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

This aligns us with current best practices documented at https://www.typescriptlang.org/tsconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress Work is ongoing or pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants