-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Update Elixir and Phoenix and all deps #395
Conversation
This pull request has been linked to Shortcut Story #20388: Update versions and add any improvements from newer Phoenix versions. |
COPY config config | ||
COPY mix.* ./ | ||
RUN mix do deps.get --only=$MIX_ENV, deps.compile | ||
COPY mix.exs mix.lock ./ |
There was a problem hiding this comment.
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.
assets/package.json
Outdated
"deploy": "webpack --mode production", | ||
"watch": "webpack --mode development --watch" | ||
}, | ||
"scripts": {}, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
b29b15d
to
a00917a
Compare
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
a00917a
to
5d0dc9d
Compare
@@ -88,10 +88,6 @@ jobs: | |||
working-directory: ./assets | |||
- run: npx eslint js --ext .js,.jsx,.ts,.tsx | |||
working-directory: ./assets | |||
- run: npm run deploy |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
assets/package.json
Outdated
"deploy": "webpack --mode production", | ||
"watch": "webpack --mode development --watch" | ||
}, | ||
"scripts": {}, |
There was a problem hiding this comment.
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)) %> |
There was a problem hiding this comment.
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.
.github/workflows/ci.yml
Outdated
env: | ||
NODE_ENV: production | ||
working-directory: ./assets | ||
- run: npm run ci |
There was a problem hiding this comment.
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.
@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. |
"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" |
There was a problem hiding this comment.
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?
assets/tsconfig.json
Outdated
@@ -6,6 +6,7 @@ | |||
"module": "es6", | |||
"moduleResolution": "node", | |||
"noImplicitAny": true, | |||
"skipLibCheck": true, |
There was a problem hiding this comment.
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.
This aligns us with current best practices documented at https://www.typescriptlang.org/tsconfig.
/* 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 |
There was a problem hiding this comment.
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.
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