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

Convert to V2 Addon, drop support for ember-source < v4 #476

Merged
merged 6 commits into from
Dec 5, 2024
Merged

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented May 5, 2024

Applies https://github.com/embroider-build/addon-blueprint
+
some updates from ember-cli 6.1 (better eslint)

Marked as breaking because

  • in v1 apps and addons: ember-auto-import is required to import @ember/test-waiters
  • minimum ember-source is 4.0 -- due to: Error: @ember/test-helpers needs to depend on ember-auto-import in order to use @ember/test-waiters
    • @ember/test-helpers v3 has ember-auto-import
      • only supports ember-source v4 and above
    • @ember/test-helpers v2 does not have ember-auto-import
      • supports ember-source earlier than v4, but this version cannot be used with the v2 addon version of @ember/test-waiters

Comparing with v3:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer needed, due to using build in types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer needed, due to using build in types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer needed, due to using build in types

@@ -2,7 +2,7 @@

const getChannelURL = require('ember-source-channel-url');

module.exports = async function() {
module.exports = async function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

new prettier settings (not changeable)

@@ -4,7 +4,6 @@ on:
push:
branches:
- master
- 'v*'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're not releasing on tag-pushes as we have a mass migration to release-plan which tags as a part of releasing, rather than releasing because of a tag

- run: pnpm lint

test:
timeout-minutes: 10
name: "Tests: ${{ matrix.EMBROIDER && 'embroider' || 'classic' }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is no longer any build behavior, so we aren't testing embroider and classic in a matrix -- we expect that embroider handles any behaviors used by this library

@@ -108,16 +90,12 @@ jobs:
- test-apps/base-tests
ember-try-scenario:
Copy link
Contributor Author

@NullVoxPopuli NullVoxPopuli Dec 2, 2024

Choose a reason for hiding this comment

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

to cut down on CI noise, this is now just testing the ranges of support,

3.16 - minimum 4.0 minimum
x.latest - last LTS for a major, X
the 3 variable embers

Choose a reason for hiding this comment

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

@NullVoxPopuli looks like some kind of mistake as now it only has 4.0, 4.12 and 5.12, no more 3.16 and no 3.28?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this comment is out of date actually -- we cannot support ember < v4

addon/.eslintrc.cjs Outdated Show resolved Hide resolved
addon/.npmignore Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

replaced by package.json#files

@NullVoxPopuli NullVoxPopuli force-pushed the v2-addon branch 2 times, most recently from c582fbd to 1fcb179 Compare December 2, 2024 23:20
"types": "./declarations/index.d.ts",
"default": "./dist/index.js"
},
"./__private__/types": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

used by tests only. there were no import restrictions in the prior version of test-waiters.

@@ -1,4 +1,4 @@
import { PendingWaiterState, Waiter, WaiterName } from './types';
Copy link
Contributor Author

@NullVoxPopuli NullVoxPopuli Dec 2, 2024

Choose a reason for hiding this comment

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

using type imports is important for not shipping too much stuff to the runtime (especially stuff that doesn't exist (types-only imports don't exist at runtime, and would error otherwise))

"start:addon": "pnpm --filter @ember/test-waiters start -- --no-watch.clearScreen",
"start:test-app": "pnpm --filter test-app start",
"test": "pnpm --filter '*' test"
},
"devDependencies": {
"@glint/core": "^1.5.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

because of vscode reasons, some LSP/Tooling dependencies need to be added to the root package.json.

No CLI tool cares that these are here

@NullVoxPopuli NullVoxPopuli changed the title Convert to V2 Addon Convert to V2 Addon, drop support for ember-source < v4 Dec 3, 2024
@@ -19,47 +18,41 @@ jobs:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3

Choose a reason for hiding this comment

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

why not sync up with blueprint to use pnpm/action-setup and actions/setup-node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

less to think about, tbh.
also also back when I made action-setup-pnpm, both setup-node and pnpm/action-setup did not infer either of their versions from the correct places.
Today the difference is (per job) 1 line vs ~ 4, I think, not too bad

@@ -108,16 +90,12 @@ jobs:
- test-apps/base-tests
ember-try-scenario:

Choose a reason for hiding this comment

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

@NullVoxPopuli looks like some kind of mistake as now it only has 4.0, 4.12 and 5.12, no more 3.16 and no 3.28?

"files": [
"declarations",
"dist",
"src",

Choose a reason for hiding this comment

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

@NullVoxPopuli why would we need src to be published?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so go-to-definition can go to source instead of declarations (requires declaration maps, iirc)

"globals": "^15.12.0",
"loader.js": "^4.7.0",
"execa": "^9.5.1",
"fix-bad-declaration-output": "^1.1.4",

Choose a reason for hiding this comment

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

is this actually needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a default thing I use in v2 addons, because the /// <reference thing with peers is too annoying to fix otherwise if it comes up

Choose a reason for hiding this comment

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

ok, so it's just in case here rather actually needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idk. It is used in the rollup config.

It's just not a problem i want to run in to, since TS is very against properly working peers - there isn't a better path forward:(

Choose a reason for hiding this comment

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

thanks for explanation! IMO it's ok to keep it as long as any future reader can easily understand/use it which should be the case here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, in the rollup config I link to some discussion on the TS repo about peer-provided types

@@ -128,7 +128,7 @@ class NoopTestWaiter implements TestWaiter {
/**
* Builds and returns a test waiter. The type of the
* returned waiter is dependent on whether the app or
* addon is in `isDevopingApp()` mode or not.

Choose a reason for hiding this comment

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

I may like to Dev Oping, more like Dev Oopsing lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol

@@ -13,7 +13,7 @@ import { module, test } from 'qunit';

// @ts-ignore
import { Promise } from 'rsvp';
import Token from '@ember/test-waiters/token';
import Token from '@ember/test-waiters/__private__/token';

Choose a reason for hiding this comment

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

how does this extra /__private__/ works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ef4
Copy link
Contributor

ef4 commented Dec 3, 2024

in all addons, declaring @ember/test-waiters in package.json is required to import from it

I think that this is not supposed to be true and if it's true it's a bug in ember-auto-import. We try to maintain compatibility so that all v2 addons are always available to every package, in keeping with the classic behavior.

@NullVoxPopuli
Copy link
Contributor Author

so far, in the auto-import test suite: I'm unable to create a rero 🤔 https://github.com/embroider-build/ember-auto-import/pull/650/files

maybe everything is fine then!

@NullVoxPopuli
Copy link
Contributor Author

removed the second bullet -- the only requirement for v1 addons is that they have ember-auto-import -- as long as they do, folks should be able to use the new/upcoming version of @ember/test-waiters

@ef4 ef4 merged commit 75f08ff into master Dec 5, 2024
15 checks passed
@ef4 ef4 deleted the v2-addon branch December 5, 2024 21:33
@github-actions github-actions bot mentioned this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants