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

Upgrades: TypeScript, Sync with Blueprint #424

Merged
merged 38 commits into from
Nov 27, 2024

Conversation

NullVoxPopuli
Copy link
Collaborator

@NullVoxPopuli NullVoxPopuli commented Nov 23, 2024

Continuing:

Changes:

  • minimum tested ember version is 3.28
  • minimum tested TS is 5.4
  • no longer test non-embroider builds (this addon has no build behavior to test)
  • pnpm 9 + pnpm/action-setup @ 4 (to solve some CI-only issues)

PRs that can be extracted

  • pnpm update
  • ts conversion
  • blueprint update
  • ci updates

PRs to do

  • release plan
  • remove DT types
  • remove rollup

@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review November 23, 2024 02:24
@NullVoxPopuli NullVoxPopuli added enhancement New feature or request breaking labels Nov 23, 2024
@SergeAstapov
Copy link
Collaborator

Why not 4.12 as minimum version? Any limitation? This would allow to have 2 previous majors with seemingly not much effort as not much (if any) changed in v5

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Nov 23, 2024

I am not sure, 5.4 is just how this was handed to me -- I suspect we can:

  • be even more modern with the build
    • ditch rollup
    • compile with vite
    • simplify package.json scripts (vite-plugin-dts)
  • support as far back as 3.28

it is rather annoying to configure ember try to have this wide range though.

but I can copy paste from other addons

.github/workflows/CI.yml Outdated Show resolved Hide resolved
Comment on lines -114 to -115
- embroider-safe
- embroider-optimized
Copy link
Contributor

Choose a reason for hiding this comment

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

should we be removing this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, because we always test embroider-optimized now. there is no point in testing less than optimized

"targetFormat": "hbs",
"transforms": []
}],
["module:decorator-transforms", { "runtime": { "import": "decorator-transforms/runtime" } }],
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use the runEarly: true flag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

idk -- it's not in the blueprint -- what's it for?

addon/config/ember-cli-update.json Outdated Show resolved Hide resolved
const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
const { Webpack } = require('@embroider/webpack');
return require('@embroider/compat').compatBuild(app, Webpack, {
Copy link
Contributor

Choose a reason for hiding this comment

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

this defeats the purpose of ember-try entirely; or am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nay -- we still test ember-source 3.28 all the way to canary

Copy link
Contributor

Choose a reason for hiding this comment

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

but only on embroider, which is not a very realistic test imo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't have anything that the difference in build system needs to care about, so why make our test setup more complex?

in an addon like this, the build system is for us, the maintainers, to better debug and maintain the addon, not for declaring support.

Also, we get to lean on the fact that embroider-strict is the most correct thing we can test against right now (unless we completely switch over to vite), so anything that works with embroider here is guaranteed to work with classic builds. It's the tests between embroider and ember-auto-import that guarantee that. We don't need to provide that coverage as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

if this was the builld system of the addon code itself I would agree but the purpose of this test-app is to simulate how the addon could be used in the wider ecosystem
you cannot say that every single app out there that might want to use tracked-buil-ins will be on fully static embroider which is what this change is saying

testing how classic build pipeline behaves with the output of the addon build step is the purpose of ember try - if I'm mistaken in any of the above statements please let me know, but otherwise I strongly believe this change is wrong

there is a reason why default v2 addon bp outputs a test app with maybeEmbroider and not fully static build code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you cannot say that every single app out there that might want to use tracked-buil-ins will be on fully static embroider which is what this change is saying

naw, that's not what I'm saying -- I'm saying all embroider-strict compatible addons are compatible with less strict environments.

there is a reason why default v2 addon bp outputs a test app with maybeEmbroider and not fully static build code

Because it hasn't been updated in ages, and is still mostly the app blueprint from ember-cli.
There are at least 4 things I change about every v2 addon I make, and this is one of them.
Even at work, I put all the test-apps on embroider-strict, and they work perfectly in the non-embroider consuming apps.

But also, I haven't put much work in to wanting to update the blueprint myself, because i know we want to kill the test-app entirely, and have it be a vite environment in the same package as the addon itself -- removing the need for a monorepo entirely.

Now, vite does support things that embroider-webpack and classic don't support yet, so unless you know what to avoid, it is actually dangerous right now to only use vite (blindly).
Those features that embroider-vite has are:

  • v2 addon w/ type=module support (this is broken in auto-import and embroider-webpack)
  • I can't remember anything else rn, it might just be that

NullVoxPopuli and others added 2 commits November 23, 2024 12:37
Co-authored-by: Alex <void-mAlex@users.noreply.github.com>
@@ -55,6 +55,7 @@ function convertToInt(prop: number | string | symbol): number | null {
return num % 1 === 0 ? num : null;
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm... what is this even merging with? Is this actually necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

At the bottom of the file. It is needed ya. The way we make these things look like normal arrays is the declaration merge.

Object is doing the same thing

@NullVoxPopuli NullVoxPopuli changed the title Coverts to v2 add-on, upgrades TS, and converts object to .ts #423 Update blueprint, upgrade TS, and converts object to .ts Nov 26, 2024
@NullVoxPopuli NullVoxPopuli merged commit 0ad41fd into master Nov 27, 2024
16 checks passed
@NullVoxPopuli NullVoxPopuli deleted the nvp/convert-object-to-ts branch November 27, 2024 19:18
@SergeAstapov SergeAstapov changed the title Update blueprint, upgrade TS, and converts object to .ts Upgrades TS, drop support for Ember.js < 3.28 and converts object to .ts Nov 27, 2024
@NullVoxPopuli NullVoxPopuli changed the title Upgrades TS, drop support for Ember.js < 3.28 and converts object to .ts Upgrades, TS, Sync with Blueprint Nov 27, 2024
@github-actions github-actions bot mentioned this pull request Nov 27, 2024
@SergeAstapov SergeAstapov changed the title Upgrades, TS, Sync with Blueprint Upgrades: TypeScript, Sync with Blueprint Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants